From 802c11029bd83681e28dd5392864352faf6ddfed Mon Sep 17 00:00:00 2001 From: HiranoMasaaki Date: Wed, 4 Mar 2026 23:41:51 +0000 Subject: [PATCH 1/2] chore: use stderr for E2E debug logging to ensure visibility in CI Co-Authored-By: Claude Opus 4.6 --- e2e/perstack-cli/continue.test.ts | 13 ++++++------- e2e/perstack-cli/providers.test.ts | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/e2e/perstack-cli/continue.test.ts b/e2e/perstack-cli/continue.test.ts index 337fc2ad..e34c936d 100644 --- a/e2e/perstack-cli/continue.test.ts +++ b/e2e/perstack-cli/continue.test.ts @@ -41,13 +41,12 @@ describe.concurrent("Continue Job", () => { { timeout: LLM_TIMEOUT }, ) const continueResult = withEventParsing(continueCmdResult) - if (!continueResult.events.find((e) => e.type === "completeRun")) { - console.log(`[DEBUG continue] exitCode: ${continueCmdResult.exitCode}`) - console.log( - `[DEBUG continue] events: ${JSON.stringify(continueResult.events.map((e) => e.type))}`, - ) - console.log(`[DEBUG continue] stdout: ${continueCmdResult.stdout.slice(0, 2000)}`) - console.log(`[DEBUG continue] stderr: ${continueCmdResult.stderr.slice(0, 2000)}`) + process.stderr.write( + `\n[DEBUG continue] exitCode=${continueCmdResult.exitCode} events=${JSON.stringify(continueResult.events.map((e) => e.type))}\n`, + ) + process.stderr.write(`[DEBUG continue] stdout:\n${continueCmdResult.stdout.slice(0, 3000)}\n`) + if (continueCmdResult.stderr) { + process.stderr.write(`[DEBUG continue] stderr:\n${continueCmdResult.stderr.slice(0, 1000)}\n`) } expect(assertEventSequenceContains(continueResult.events, ["resumeFromStop"]).passed).toBe(true) expect( diff --git a/e2e/perstack-cli/providers.test.ts b/e2e/perstack-cli/providers.test.ts index 7c90bfb8..2e392f83 100644 --- a/e2e/perstack-cli/providers.test.ts +++ b/e2e/perstack-cli/providers.test.ts @@ -31,13 +31,12 @@ describe.concurrent("LLM Providers", () => { provider, }) const result = withEventParsing(cmdResult) - if (result.exitCode !== 0 || !result.events.find((e) => e.type === "completeRun")) { - console.log(`[DEBUG ${provider}] exitCode: ${result.exitCode}`) - console.log( - `[DEBUG ${provider}] events: ${JSON.stringify(result.events.map((e) => e.type))}`, - ) - console.log(`[DEBUG ${provider}] stdout: ${result.stdout.slice(0, 2000)}`) - console.log(`[DEBUG ${provider}] stderr: ${result.stderr.slice(0, 2000)}`) + process.stderr.write( + `\n[DEBUG ${provider}] exitCode=${result.exitCode} events=${JSON.stringify(result.events.map((e) => e.type))}\n`, + ) + process.stderr.write(`[DEBUG ${provider}] stdout:\n${result.stdout.slice(0, 3000)}\n`) + if (result.stderr) { + process.stderr.write(`[DEBUG ${provider}] stderr:\n${result.stderr.slice(0, 1000)}\n`) } expect(result.exitCode).toBe(0) expect(assertEventSequenceContains(result.events, ["startRun", "completeRun"]).passed).toBe( From 29e7643de56ea327d237c95e15eda508f822f4dd Mon Sep 17 00:00:00 2001 From: HiranoMasaaki Date: Wed, 4 Mar 2026 23:51:31 +0000 Subject: [PATCH 2/2] chore: add parse failure logging to event parser Log details when startRun/completeRun/stopRun events fail to parse, to diagnose CI-only E2E failures. Co-Authored-By: Claude Opus 4.6 --- e2e/lib/event-parser.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/e2e/lib/event-parser.ts b/e2e/lib/event-parser.ts index 9abaaf5c..1ebf5f7a 100644 --- a/e2e/lib/event-parser.ts +++ b/e2e/lib/event-parser.ts @@ -55,7 +55,19 @@ function tryParseEvent(text: string, events: ParsedEvent[]): void { if (data.type) { events.push({ ...data, raw: text }) } - } catch {} + } catch (e) { + if ( + text.includes('"startRun"') || + text.includes('"completeRun"') || + text.includes('"stopRun') + ) { + process.stderr.write( + `[PARSE_FAIL] Failed to parse event (len=${text.length}): ${(e as Error).message}\n`, + ) + process.stderr.write(`[PARSE_FAIL] first 200 chars: ${text.slice(0, 200)}\n`) + process.stderr.write(`[PARSE_FAIL] last 200 chars: ${text.slice(-200)}\n`) + } + } } export function filterEventsByType(