fix: don't treat SubagentStop as the agent turn boundary#79
Conversation
…d a dispatch A spawned subagent (e.g. an Explore agent the implementer skill dispatches) finishing is not the main agent's turn boundary. SubagentStop was normalized to agent.stopped, so the first subagent's completion resolved the workflow's awaitStop, classified a bare-stop, and tore the dispatch down mid-research. Map SubagentStop to a new observational agent.subagent-stopped event that is recorded but never resolves the stop awaiter.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR introduces a new ChangesSubagent-stopped event isolation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
Summary
A dispatched agent that spawns a subagent (e.g. the
implementing-github-issuesskill dispatching anExploreagent for codebase research — which it explicitly recommends) was being torn down the moment that subagent finished.SubagentStopwas normalized to the sameagent.stoppedevent as the mainStop, andawaitStopresolves on the firstagent.stoppedit sees. So when the Explore subagent returned, the dispatcher mistook it for the main agent's turn boundary →classifyStopfound no done/blocked sentinel →bare-stop→completed→ killed the session and destroyed the worktree, mid-research, before any plan or PR.Observed live dispatching Epic #21: the agent spawned an Explore subagent as its first move, and ~140s later its
SubagentStopended the whole dispatch.Fix
agent.subagent-stopped(packages/core/src/events.ts).SubagentStop→agent.subagent-stoppedinstead ofagent.stopped(packages/adapters/claude/src/hooks.ts). It is still recorded for observability but never resolves the workflow's stop awaiter.Test
agent.subagent-stoppedPOST does not resolveawaitStop; a subsequent realagent.stoppeddoes.Follow-up (not in this PR)
bare-stop → completedis still fragile even with this fix — a main agent that ends a turn mid-work would be declared done. The durable cure (a positive done-signal via the Phase 4 PR-ready gate, plus a continuation nudge) is tracked under #27.Summary by CodeRabbit
Release Notes