Skip to content

test(retained): wait for the second prompt before releasing the handed-off subagent - #44

Merged
dviejokfs merged 1 commit into
mainfrom
test/hand-off-waits-for-the-second-prompt
Oct 17, 2026
Merged

dviejokfs merged 1 commit into
mainfrom
test/hand-off-waits-for-the-second-prompt

Conversation

@dviejokfs

Copy link
Copy Markdown
Contributor

claude_background_subagent_survives_a_new_turn failed 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

…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>
@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This test-only change appears safe to merge.

Summary

This test-only change waits for the second turn’s prompt before releasing the background subagent.

  • The test waits for the second turn’s prompt before releasing background work.

Reviews (1) · Last reviewed commit: "test(retained): wait for the second prom..." · Reviewed by Greptile

@dviejokfs
dviejokfs merged commit 253f1a3 into main Oct 17, 2026
7 checks passed
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