Skip to content

🤖 refactor: split startReservedAgentTaskLeased, part 5: stop latch, attempt stamp and desktop admission - #7760

Merged
ThomasK33 merged 2 commits into
refactor/task-launch-split-4from
refactor/task-launch-split-5
Oct 30, 2026
Merged

ThomasK33 merged 2 commits into
refactor/task-launch-split-4from
refactor/task-launch-split-5

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Part 5 of 5. It moves the stop-latch barrier's body into deferLaunchForStopLatch, the stamp of a row without an attempt id into stampLaunchAttempt, the adopt into adoptLaunchAttempt (sync) and the desktop admission with its cancels into admitLaunchDesktopRecovery. startReservedAgentTaskLeased ends 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 void for await, a moved statement and a dropped await in its self-test). Each new step has CC 7 or less, with 100 % line coverage. startReservedAgentTask and materializeReservedTaskWorkspace are 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 with preservePhysicalWorkspace: true, and the parent's checkout still exists. Before it, a mutant that made cancelMaterializedLaunch delete the physical checkout survived every suite. The stack's advisor showed that the local harness can reach this path through the lease wrapper. Scratch edit preservePhysicalWorkspace: false fails 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 finally releases 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

…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 -->
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T11:00:12.305143Z ee040d7 Manual request
🔒 Security Review ✅ Completed 2026-10-30T11:00:48.511402Z ee040d7 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 8cbb10dafe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 8cbb10dafe

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

22 agent steps · 7 replayed from cache · 15 model calls · 46.4k tokens (27% cached)
Spend: $0.09 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 1 step · 1 call 6.1s
🟢 a chat survives a restart of the server 1 step · 1 call 6.1s
🟢 compaction.e2e.ts · 1 passed 1 step · 1 call 5.1s
🟢 /compact replaces the old chat with a summary 1 step · 1 call 5.1s
🟢 pluginTrustRestart.e2e.ts · 1 passed 4 steps · 2 calls 9.4s
🟢 a trusted plugin hook stays trusted after the server restarts 4 steps · 2 calls 9.4s
🟢 settingsRoundTrip.e2e.ts · 1 passed 2 steps · 1 call 8.6s
🟢 a chat survives trips through Settings 2 steps · 1 call 8.6s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 4.2s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 4.2s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 2.6s
🟢 the agent opens the playground workspace 2 steps · 1 call 2.6s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 7.1s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 7.1s
🟢 todoNudge.e2e.ts · 1 passed 1 step · 1 call 6.2s
🟢 the agent finishes open TODO items after the turn-end nudge 1 step · 1 call 6.2s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 29.0s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 4.4s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 3.9s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 4.8s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 3.3s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 5.6s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 7.0s

e2e 0.20.0 · 1m 21s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 7.9k tokens (33% cached)
Spend: $0.01 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 6.0s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 6.0s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 5.5s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 5.5s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 5.3s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 5.3s

e2e 0.20.0 · 18.8s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $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.
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: ee040d7ad9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: ee040d7ad9

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 5212181 Oct 30, 2026
33 of 34 checks passed
@ThomasK33
ThomasK33 deleted the refactor/task-launch-split-5 branch October 30, 2026 11:38
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.

1 participant