Repository navigation
test(retained): wait for the second prompt before releasing the handed-off subagent - #44
Merged
Merged
Conversation
…d-off subagent claude_background_subagent_survives_a_new_turn waited for any "prompt" log entry, which the first turn had already written, so on a slow runner the subagent was released before the new turn was reading the process. Where its frames landed (this turn's stream or the parked buffer) then decided the assertions, and the test failed intermittently on macOS CI. Wait for the second turn's own prompt instead. Reproduced deterministically by delaying the new turn's start by 300 ms or more; passes with up to 2.5 s. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
[Low impact] This test-only change appears safe to merge. SummaryThis test-only change waits for the second turn’s prompt before releasing the background subagent.
Reviews (1) · Last reviewed commit: "test(retained): wait for the second prom..." · Reviewed by Greptile |
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.
claude_background_subagent_survives_a_new_turnfailed intermittently on macOS CI (seen on #43, passed on rerun).Cause
The test waited for
wait_for_log("prompt"), but the first turn's prompt was already in the log, so the wait returned immediately. On a slow runner the subagent could be released (after a fixed 200 ms) before the handed-off turn was reading the process. Whether its frames then landed in the new turn's stream or in the parked buffer decided which assertion tripped (the follow-up text, or the nested tool call's task id).Reproduction
Delaying the new turn's start by 300 ms or more reproduces the failure deterministically (temporary env-gated sleep in the claim path, not included). With the fix the test passes with delays up to 2.5 s.
Change
Test only: wait for the second turn's own prompt (
wait_for_prompt("second")) before sleeping and releasing the subagent.🤖 Generated with Claude Code