Skip to content

[FD-6444] fix(agents): Claude Code's reply keeps every answer across background-task wakes - #846

Draft
earakely-scale wants to merge 2 commits into
mainfrom
edgararakelyan/fd-6444-claude-code-backgrounded-reply
Draft

earakely-scale wants to merge 2 commits into
mainfrom
edgararakelyan/fd-6444-claude-code-backgrounded-reply

Conversation

@earakely-scale

Copy link
Copy Markdown
Collaborator

Why

Claude Code wakes the model again when a background task it started finishes, and ends each wake with a result. One turn can therefore emit several result events:

  • the answer, then a remark on the finished task ("That was just my wait timer finishing");
  • or a holding note ("Waiting on the build"), then the answer.

The bridge replied with the last result. In the first case the answer was lost, so verifiers graded the remark (FD-6444).

What changes

The reply joins the text of every successful result in order, separated by a blank line.

  • Error results are left out.
  • A text that repeats the one before it is left out.
  • A turn with no other text still replies with its last result's text, as before (a failed turn's error).
  • A requested JSON Schema still answers with its structured output.
  • A resumed turn keeps an answer given before the wake that failed.

Evidence so far

  • Prod census: 1,500 recent prod claude-code-cli turns. 2.6% emit more than one result. In about 17 of those 39 the answer is the last result, and in about 13 it's the first. So neither "first" nor "last" is right.
  • Offline replay of those 1,500 turns:
    • all 1,461 single-result turns reply exactly as before;
    • in every multi-result turn the old reply is kept inside the new one;
    • no turn's reply loses text.
  • Real CLI (2.1.322) against tst/util/fake_anthropic: two result events, the second marked origin.kind == "task-notification".
  • Unit tests: test_claude_bridge_reply.py. 4 of its 9 tests fail on main; the other 5 pin unchanged behaviour.

E2E and chaos with real models are in progress.

🤖 Generated with Claude Code

earakely-scale and others added 2 commits November 20, 2026 08:31
…-task wakes

The CLI wakes the model again when a background task it started finishes, and ends each wake with a `result`, so one
turn can emit several: an answer then a remark on the finished task, or a holding note then the answer. The bridge
replied with the last one, which dropped the answer in the first case. The reply now joins each successful result's
text in order, leaving out error results and a text repeating the one before; a turn with no other text replies with
its last result's, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ackground command

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant