refactor(core): share subagent job execution with recovery - #46944
Open
kitlangton wants to merge 2 commits into
Open
refactor(core): share subagent job execution with recovery#46944kitlangton wants to merge 2 commits into
kitlangton wants to merge 2 commits into
Conversation
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.
Why
Live subagent execution and restart recovery each build their own job and select its final answer differently: the tool reads the latest 20 messages, while recovery scans the current model context. Maintaining both definitions makes restart behavior diverge from the normal path.
Execution also retains a
UserInterruptedErrorvariant that production never constructs. User interruption already travels through fiber interruption and the coordinator's explicit reason.What Changes
SubagentJob.start, sharing child resume, job metadata, and result selection.Scope
This consolidates subagent job execution and removes one dead interruption path. It does not add leases, change coordinator ownership, or redesign recovery accounting. Child-claim terminal events (#46943) and the claim-column rename (#46945) are separate changes. Land the rename last and reconcile its overlapping child-claim query with #46943.
Verification
96 tests passed; Core typecheck passed, using the repository-pinned Bun 1.4.0. Result-selection tests exercise live and recovered jobs against real persisted messages, including failed/incomplete candidates, empty output, and a result outside the 20-message window. Existing tests cover interruption, recovery accounting, job lifecycle, and notification deduplication.
The unmodified pre-push typecheck hook also passed: 33 successful tasks, 27 cached. No live provider/server end-to-end run was performed.