Skip to content

fix(core): wake parent on terminal child status#873

Draft
3nesdeniz wants to merge 2 commits into
usestrix:mainfrom
3nesdeniz:agent/fix-terminal-child-wakeup
Draft

fix(core): wake parent on terminal child status#873
3nesdeniz wants to merge 2 commits into
usestrix:mainfrom
3nesdeniz:agent/fix-terminal-child-wakeup

Conversation

@3nesdeniz

@3nesdeniz 3nesdeniz commented Jul 25, 2026

Copy link
Copy Markdown

Problem

When an interactive child exhausts its turn budget, Strix marks it as stopped.
The parent can nevertheless remain parked in wait_for_message because only the
child's wake event is set and no inbox item is delivered to the parent.

Root cause

Terminal-state propagation was split across call sites. Crashes had a dedicated
parent notification, normal completion sent a report from agent_finish, and
stopped / failed transitions had no parent notification at all. Graceful
stops also assigned stopped directly, bypassing the coordinator's status
transition path.

Changes

  • Treat completed, stopped, failed, and crashed as terminal transitions
    in AgentCoordinator.set_status.
  • Deliver one high-priority terminal-status message to the actual parent on the
    first transition into a terminal state, including the failure reason when
    present.
  • Keep agent_finish's structured completion report as the primary
    notification and suppress a duplicate generic message. If report delivery
    fails, make one generic fallback attempt.
  • Route graceful stops through the same terminal-transition path.
  • Avoid interrupting the caller's own active turn when it stops its direct
    child: the tool result already confirms that stop. If a caller stops a deeper
    descendant, notify that target's actual parent instead.
  • For cascades, notify only the top-level target's external parent; internal
    parents are part of the same stop cascade.
  • Remove the crash-only notification path now covered by the coordinator.
  • Add regression coverage for the exact MaxTurnsExceeded path, all four
    terminal statuses, idempotence, completion-report delivery fallback,
    direct/deep stop routing, and cascade notification behavior.

Validation

  • uv run pytest -q — 412 passed
  • uv run pytest -q tests/test_agent_terminal_notifications.py — 14 passed
  • uv run ruff check .
  • uv run ruff format --check strix/core/agents.py strix/core/execution.py strix/tools/agents_graph/tools.py tests/test_agent_terminal_notifications.py
  • uv run mypy strix/core/agents.py strix/core/execution.py strix/tools/agents_graph/tools.py tests/test_agent_terminal_notifications.py
  • uv run pyright --pythonpath .venv/bin/python tests/test_agent_terminal_notifications.py
  • uv run bandit -q -c pyproject.toml strix/core/agents.py strix/core/execution.py strix/tools/agents_graph/tools.py
  • git diff --check

I also ran the documented make check-all. On a clean upstream/main
worktree at cd8270c, its repository-wide mypy step reports the same existing
70 errors (primarily Textual typing drift and missing Pygments stubs), and the
repository-wide Bandit target reports the same existing B105/B310 findings.
The changed-source and new-test checks listed above are clean.

Fixes #870

@5hy7xz92nd-oss 5hy7xz92nd-oss left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect and run and test all

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.

Coordinator hangs waiting for subagent stopped after MaxTurnsExceeded

2 participants