Repository navigation
🤖 refactor: split startReservedAgentTaskLeased, part 5: stop latch, attempt stamp and desktop admission - #7760
Conversation
…ttempt stamp and desktop admission The last split part: the head of the reserved launch. The method keeps the asserts, the row read and its not-starting exit, the stop-latch barrier, the superseded exit, and one call to the next step. No behaviour change. - deferLaunchForStopLatch: the body of the barrier (the revert to queued behind its rowSupersedes check, the failure mark, the emit, the second latch check after it and the drain). The latch check stays in the method, so a launch that is not deferred waits no extra microtask. - stampLaunchAttempt: a row without a valid attempt id is stamped and marked unproven (its write failure marks the launch failed), read back and published, then the adopt step and the desktop step. - adoptLaunchAttempt (sync): plan.attemptId and the owned attempt. It runs before the cancel and desktop checks, as before. - admitLaunchDesktopRecovery: the cancel check, admitTaskDesktopRecovery before the materialize step, the second cancel check, then the materialize step. startReservedAgentTaskLeased: CC 23 -> 6 (60 at the base of the stack). New steps: CC 5, 7, 3, 6. Every step of the split is at CC 8 or less. --- _Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ <!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=xhigh -->
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
🟢 e2e stories (Haiku): 14 passed22 agent steps · 7 replayed from cache · 15 model calls · 46.4k tokens (27% cached) All 14 tests in 9 files
e2e 0.20.0 · 1m 21s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 7.9k tokens (33% cached) All 3 tests in 3 files
e2e 0.20.0 · 18.8s · electron · run artifacts 🟢 e2e agent repros (Haiku): no tests selectedSpend: $0.00 of the $1.00 cap (proxy ledger) e2e 0.20.0 · 5.3s · 2 targets (web, phone) · run artifacts |
From the stack-10 advisor: no test pinned that cancelMaterializedLaunch preserves a shared checkout. Scratch edit preservePhysicalWorkspace: false fails only this test.
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Summary
Part 5 of 5. It moves the stop-latch barrier's body into
deferLaunchForStopLatch, the stamp of a row without an attempt id intostampLaunchAttempt, the adopt intoadoptLaunchAttempt(sync) and the desktop admission with its cancels intoadmitLaunchDesktopRecovery.startReservedAgentTaskLeasedends at CC 6 (from 65 before the stack). Changed lines: 76.No behaviour change: same calls to other methods, same awaits, same order. A script inlines every step and compares the call, await, write, return and throw sequence with the parent commit: identical at every part (it caught
voidforawait, a moved statement and a dropped await in its self-test). Each new step has CC 7 or less, with 100 % line coverage.startReservedAgentTaskandmaterializeReservedTaskWorkspaceare still method calls, so the tests that spy on them still apply. The steps form a chain: each step calls the next right after its own last await, so no write, admission or send moves a microtask later.Test added on top
A second commit adds one test to
taskService.reservedLaunch.test.ts: a shared launch cancelled right after the materialize step cleans up withpreservePhysicalWorkspace: true, and the parent's checkout still exists. Before it, a mutant that madecancelMaterializedLaunchdelete the physical checkout survived every suite. The stack's advisor showed that the local harness can reach this path through the lease wrapper. Scratch editpreservePhysicalWorkspace: falsefails only this test.Risks
Every reserved task launch runs this code. One timing change remains: each level of the chain adds one microtask at its very end, after the last collaborator call, so the lease wrapper's
finallyreleases the lease up to 10 microtasks later than before. No collaborator call moves. All 5040 targeted tests pass at every part. The mutation pass left gaps in old behaviour, tracked in the stack's follow-up issue.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$351.07