Skip to content

fix(core): a child never leaves its parent waiting silently - #959

Merged
0xallam merged 2 commits into
mainfrom
devin/1785672171-completed-child-parent-notice
Aug 2, 2026
Merged

fix(core): a child never leaves its parent waiting silently#959
0xallam merged 2 commits into
mainfrom
devin/1785672171-completed-child-parent-notice

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

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 a completed child had a single channel — the report agent_finish sends — and report_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 full wait_for_agents timeout on a message nobody would send.

  • _TERMINAL_NOTICE gains a completed entry, and agent_finish sends it whenever it skips the report:
    parent_notified = False
    if report_to_parent and await coordinator.claim_parent_notice(me):
        ...send report...; parent_notified = True
    await coordinator.set_status(me, "completed")
    if not parent_notified:
        await notify_parent_on_terminal(coordinator, me, "completed")
  • _child_loop gets a finally backstop (_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_agent notifies 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_graceful now returns the stopped ids so the tool can address them. The stopped notice no longer claims "hit its turn limit", since it now also covers explicit stops.
  • Dedupe lives in the coordinator: claim_parent_notice(agent_id) hands out one notice per running stint, and returning to running clears 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_terminal is now public (called from the tools layer).

Tests: test_terminal_child_wakes_parked_parent is parametrized with completed, plus coverage for a report-less agent_finish waking a parked parent, a delivered report suppressing the backstop notice, and both stop_agent cases.

Note: tests/test_execution.py::test_finish_scan_bypasses_active_agent_guard_after_reserve fails in a full-suite run on main as well (a ReportState.run_record ordering issue) — unrelated to this change.

Link to Devin session: https://app.devin.ai/sessions/2f28685f6b0e4bcfbd407373c9580516
Requested by: @0xallam

@0xallam 0xallam self-assigned this Aug 2, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR ensures that child-agent terminal paths notify their parents once instead of leaving them waiting for a report that will never arrive.

  • Adds coordinator-level deduplication shared by completion reports and terminal notices.
  • Adds completed and explicit-stop notifications plus a child-loop exit backstop.
  • Propagates stopped-agent identifiers so non-stopping parents can be notified.
  • Expands lifecycle tests for report-less completion, deduplication, and nested-agent stopping.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains within the eligible follow-up-review scope.

Important Files Changed

Filename Overview
strix/core/agents.py Adds per-running-stint parent-notification claims and returns stopped descendant identifiers for downstream notification.
strix/core/execution.py Extends terminal notices to completed children and adds an exit-time notification backstop around detached child loops.
strix/tools/agents_graph/tools.py Coordinates completion-report deduplication and notifies parents affected by third-party subtree stops.
tests/test_execution.py Adds regression coverage for completed-child wakeups, report suppression, report-less completion, and nested stop notifications.

Reviews (2): Last reviewed commit: "fix(tools): tell a waiting parent when s..." | Re-trigger Greptile

@devin-ai-integration devin-ai-integration Bot changed the title fix(core): wake the parent when a child ends without a completion report fix(core): a child never leaves its parent waiting silently Aug 2, 2026
@0xallam

0xallam commented Aug 2, 2026

Copy link
Copy Markdown
Member

@greptile

@0xallam
0xallam merged commit b6cf156 into main Aug 2, 2026
2 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.

[BUG] Coordinator stalls for hours in wait_for_message when child agent is 'completed' (not just MaxTurnsExceeded, cf #870)

1 participant