Repository navigation
fix(server): keep subagent prompt hints for each own server and steady own_restart_note - #314
Merged
Merged
Conversation
Own mode kept upstream's promptHints in one map for the process, so a server opened after another in the same process took the first one's event sequences as its own. own_restart_note runs two own servers in one test process, and the second stored a subagent's prompt by reference whenever a sequence from the first database landed on a row with the same prompt, where upstream, a fresh process, stored it in full. Keep the hints for each database file and start them empty when own mode opens its database, as upstream's event store does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With two replies, the ACP adapter closes the first when the second starts and writes it again as an answer at the turn's end. When a busy server read the second reply and the turn's end in one millisecond, the second write changed nothing and its node.updated was skipped, so the turn's events depended on the server's speed. Under load, upstream skipped it in own_restart_note while own mode's bridge did not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
own_restart_note::differentialfailed once on #313's CI (harness shard 8, continuation on): ont-awaited, a subagent turn item stored its prompt in full in upstream but by reference (prompt: ""pluspromptSequence) in own mode. Looping the case under load turned up a second flake in the same harness. Both are fixed here.Prompt hints were process-wide in own mode
Upstream keeps
promptHints(the sequence of the last event that stored each subagent's prompt in full) in its event store, so a server starts with an empty map. Own mode kept one static map for the process.own_restart_noteruns two own servers in one test process, one per case. The second server took the first one's sequences as its own, and when one of them happened to land on a row with the same prompt in its own database, it stored the prompt by reference where upstream, a fresh process, stored it in full.The hints are now kept for each database file and start empty when own mode opens its database (
turns::write::forget_prompt_hints), as upstream's event store does. A unit test covers a copied database and a reopened one.Two replies a turn made the fake ACP agent's turns depend on the server's speed
With two assistant replies, the ACP adapter closes the first when the second starts, and the turn's end writes it again as an answer (
markClosingAssistantSegments), stamped with the time it is read. When a busy server read the second reply and the turn's end in one millisecond, that write changed nothing and itsnode.updatedwas skipped. Under load, upstream skipped it while own mode's bridge did not, and every later event of the thread shifted by one (111 differences). Both servers run the same adapter, so this was the harness's race:fake-claude-agent-acp.mjsnow sends one reply a turn.docs/ci.mdnotes both rules under Harnesses.Verification
own_restart_note::differentialpassed 30 times in a row locally, three at a time (Node 26.13.1, scratchHOME,TERN_KEYCHAIN=off). Before the agent change, it failed 1 run in 15 under load.own_subagentsandown_composer_context, which use the same agent, pass.cargo fmt --all,cargo clippy --workspace --all-targets --locked -- -D warnings,cargo test --workspace --locked.🤖 Generated with Claude Code