fix(core): a child never leaves its parent waiting silently - #959
Merged
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Greptile SummaryThe PR ensures that child-agent terminal paths notify their parents once instead of leaving them waiting for a report that will never arrive.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains within the eligible follow-up-review scope. Important Files Changed
Reviews (2): Last reviewed commit: "fix(tools): tell a waiting parent when s..." | Re-trigger Greptile |
0xallam
approved these changes
Aug 2, 2026
Member
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.
Summary
Fixes #947, and the sibling gaps around it: every way a child can stop running now produces exactly one message to its parent. Before, terminal notices covered
crashed/failed/stopped-on-turn-limit only, so acompletedchild had a single channel — the reportagent_finishsends — andreport_to_parent=False, a stop driven by another agent, or a loop exiting after the status was already settled all left the parent waiting out its fullwait_for_agentstimeout on a message nobody would send._TERMINAL_NOTICEgains acompletedentry, andagent_finishsends it whenever it skips the report:_child_loopgets afinallybackstop (_notify_parent_on_exit) that notifies on whatever terminal status the child exited with, so no exit path is silent. Skipped during shutdown; cancellation propagates as before.stop_agentnotifies the stopped agents' parents, except the stopper itself (which already knows) — this is the grandchild case: root stops a grandchild, and the middle agent waiting on it otherwise never hears.cancel_descendants_gracefulnow returns the stopped ids so the tool can address them. Thestoppednotice no longer claims "hit its turn limit", since it now also covers explicit stops.claim_parent_notice(agent_id)hands out one notice per running stint, and returning torunningclears the claim so a revived child can report again. The report and the terminal notice claim the same slot, so a parent never receives both.notify_parent_on_terminalis now public (called from the tools layer).Tests:
test_terminal_child_wakes_parked_parentis parametrized withcompleted, plus coverage for a report-lessagent_finishwaking a parked parent, a delivered report suppressing the backstop notice, and bothstop_agentcases.Note:
tests/test_execution.py::test_finish_scan_bypasses_active_agent_guard_after_reservefails in a full-suite run onmainas well (aReportState.run_recordordering issue) — unrelated to this change.Link to Devin session: https://app.devin.ai/sessions/2f28685f6b0e4bcfbd407373c9580516
Requested by: @0xallam