From 3b7cbe7d38751ae5a9d899aa843512563e873048 Mon Sep 17 00:00:00 2001 From: anvyle Date: Wed, 29 Apr 2026 15:13:49 +0200 Subject: [PATCH] test(copilot): add diagnostic logging to helpers.test.ts CI fails with reasoning length 0 instead of 1, but the same code passes locally with --frozen-lockfile + clean regen. Log runtime state from inside the failing test so the next CI run surfaces what isInteractiveToolPart sees and what splitReasoningAndResponse returns. Will revert once root cause is found. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../__tests__/helpers.test.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/helpers.test.ts index be9de262d5..49d8321dd2 100644 --- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/helpers.test.ts +++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/__tests__/helpers.test.ts @@ -7,6 +7,7 @@ import { splitReasoningAndResponse, } from "../helpers"; import type { MessagePart } from "../helpers"; +import { ResponseType } from "@/app/api/__generated__/models/responseType"; function textPart(text: string): MessagePart { return { type: "text", text } as MessagePart; @@ -228,7 +229,27 @@ describe("splitReasoningAndResponse", () => { }), textPart("Here is the plan."), ]; + // DEBUG: surface runtime state in CI to diagnose env-specific failures. + // eslint-disable-next-line no-console + console.log( + "[DEBUG splits]", + JSON.stringify({ + types: parts.map((p) => p.type), + toolPartIsInteractive: isInteractiveToolPart(parts[1]), + responseTypeImport: ResponseType.task_decomposition, + }), + ); const { reasoning, response } = splitReasoningAndResponse(parts); + // eslint-disable-next-line no-console + console.log( + "[DEBUG splits result]", + JSON.stringify({ + reasoningLen: reasoning.length, + reasoningTypes: reasoning.map((p) => p.type), + responseLen: response.length, + responseTypes: response.map((p) => p.type), + }), + ); expect(reasoning).toHaveLength(1); expect(reasoning[0]).toBe(parts[0]); expect(response).toHaveLength(2);