Repository navigation
fix(run): key background launch tracking by run, not session (#400) - #463
Merged
Merged
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
The headless background-task tracker keyed launched sessions by sessionID alone, so two runs of one session (a task_id resume, or a re-emitted launch racing a resolve) collapsed into one pending entry and a terminal envelope for an earlier run could settle a later one, letting headless runs exit while a child was still running. - Stamp every background launch's part metadata with runId (sessionID@started_at, the registry's run key) on the start, extend, and promote paths - Carry the run key on terminal <task> envelopes as a run attribute - Key the tracker's pending set by run id, falling back to the session ID for envelopes without one (older servers, attach mode)
agenteinstinct1-max
force-pushed
the
fix/background-run-key-dedupe
branch
from
October 21, 2026 08:15
20fbc8d to
91d3eca
Compare
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (5 files)
Reviewed by free · Input: 81.9K · Output: 3.2K · Cached: 379.9K |
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.
Closes #400.
The headless background-task tracker keyed launched sessions by
sessionIDalone: two runs of one session (atask_idresume, or a re-emitted launch part racing a resolve) collapsed into one pending entry, and a terminal envelope for an earlier run could settle a later one, soopencode runcould exit while a child was still running. The authoritative run key ([email protected]_at) existed in the job registry but never reached the tracker.runId(sessionID@started_at) in their metadata on all three launch paths (immediate background, extend, promote)<task>envelopes carry the run key as arunattribute; the headless loop resolves by it, falling back to the session ID for envelopes without one (older servers, attach mode)Tests: 3 new tracker cases (concurrent runs of one session both pending, stale envelope does not settle a resumed run, re-emitted launch dedupes); delivery-envelope assertions updated to expect the run attribute.
bun test test/cli/run/229 pass,bun test test/tool/task.test.ts65 pass.