From 64e632092eba5fddf0a99bf46da2e053de24f37a Mon Sep 17 00:00:00 2001 From: Merge Sim Date: Tue, 1 Sep 2026 22:31:30 -0700 Subject: [PATCH] test(claude): wait for the child to record the frame, not just for its report The scripted CLI writes its report at startup, so `until(readReport)` returned a report with no user messages whenever the child had not yet read the line. The assertion then failed under parallel load. Poll for the frame instead of for the file. Claude-Session: https://claude.ai/code/session_01AobxxokqQ3qcxS7sy7ckum --- src/main/claude/claude-stream-json-connection.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/claude/claude-stream-json-connection.test.ts b/src/main/claude/claude-stream-json-connection.test.ts index bff96258397..55d9d5a4565 100644 --- a/src/main/claude/claude-stream-json-connection.test.ts +++ b/src/main/claude/claude-stream-json-connection.test.ts @@ -187,7 +187,13 @@ describe('Claude stream-json connection', () => { parent_tool_use_id: null, session_id: SESSION_ID }) - const report = await until(() => readReportSafely(scenario), 'the scripted CLI report') + // The report exists from the child's first line of work, so poll for the frame + // itself: `send` settles on the SDK's completed write, and the child still has + // to read that line before it can record it. + const report = await until( + () => (readReportSafely(scenario)?.userMessages.length ? readReportSafely(scenario) : null), + 'the user frame recorded by the child' + ) expect(report.userMessages).toHaveLength(1) await until(() => messages.find((message) => message.uuid === 'uuid-replay-1'), 'the replay')