Skip to content

Claude Code workers: a late result no longer undoes a turn that was already ended - #54

Merged
flujo-app merged 1 commit into
mainfrom
claude-late-result
Nov 28, 2026
Merged

flujo-app merged 1 commit into
mainfrom
claude-late-result

Conversation

@flujo-app

Copy link
Copy Markdown
Owner

Found while running the local Windows and Linux checks for #52: a required MCP server that did not connect ends the turn failed now and then on Linux with Node 24 (2 of 6 full runs), never when run alone.

The bug

When a required MCP server did not connect, or Claude Code opened a different session than requested, ClaudeSessionDriver ended the turn as failed and stopped the process. If Claude Code's result line was read in the same chunk, before the process was gone, receiveResult overwrote the outcome with completed. Real Claude Code takes seconds before its first answer, so this was unlikely in a fleet, but possible. A worker could then report a completed turn without its board or another required server.

The fix

receiveResult leaves a turn that is already being ended as it is. Token counts are still recorded.

Test

The fake Claude Code can now hold its session start and write it with the first reply in one chunk (--fake-init-with-reply). With that, the test fails every time without the fix (actual: 'completed') and passes with it.

Local checks (Windows and Linux, as in public-sdk.yml)

Commit 4590594, from a clean git -c core.autocrlf=false archive snapshot with a clean npm ci each time. Linux ran in disposable node:*-bookworm-slim Docker containers as the node user.

Platform Node npm audit focused tests Python (Modal, RunPod) packed install, SDK check, CLI help installed MCP tests evidence regressions
Windows v22.17.0 10.9.2 passed 339 passed passed passed 1 passed 7 passed
Windows v24.22.1 11.19.1 passed 339 passed passed passed 1 passed 7 passed
Linux v22.17.0 10.9.2 passed 339 passed passed passed 1 passed 7 passed
Linux v24.22.1 11.19.1 passed 339 passed passed passed 1 passed 7 passed

All four combinations passed.

…lready ended

When a required MCP server did not connect (or Claude Code opened another
session), the driver ended the turn as failed. If the turn's result line was
read in the same chunk, before the process was gone, it overwrote that with
completed. The result now leaves a turn that is being ended as it is.

The fake Claude Code can now write the session start and the first reply in
one chunk (--fake-init-with-reply), which made this fail every time; it
showed up before only now and then, on a busy Linux run with Node 24.
@flujo-app flujo-app added the bug Something isn't working label Nov 28, 2026
@flujo-app
flujo-app merged commit 0bf96ce into main Nov 28, 2026
2 checks passed
@flujo-app
flujo-app deleted the claude-late-result branch November 28, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant