Repository navigation
🤖 refactor: split startReservedAgentTaskLeased, part 1: admission, send and status - #7756
Conversation
…nd and status First split part, tail first: the end of the reserved launch moves into two steps that the method calls once, after the init block. No behaviour change: the same calls and awaits run in the same order and tick. - admitReservedLaunchPrompt: the start options, the linearization-point cancel check, the launch fence admission (refusal: cleanup and throw) and plan.sendAdmitted, then the send step. - sendReservedLaunchPrompt: the send or resume under the admission token (sendIdentities and skipOnSendCompaction stay on the sendMessage kind), the send-failure cleanup and throw, and the `running` write (onlyFromStatus "starting", expectedAttemptId) and the scheduled drain. The checkout the later steps read is one readonly record (ReservedLaunchCheckout), built by spread right after the materialize step, where sharesParentCheckout is derived. Two helpers take it: - cleanupLaunchCheckout replaces the six identical cleanupMaterializedTaskWorkspace calls in the method (same arguments in the same order; the init logComplete stays at each call site). - cancelMaterializedLaunch replaces the closure of the same name. Both return the collaborator's promise (plain methods, not async), so each call site's await is the original await. Each step calls the next one right after its own last await, so no write, admission or send runs a microtask later, and startReservedAgentTask still awaits the whole chain before it releases the lease. startReservedAgentTaskLeased: CC 60 -> 54. New steps: CC 4, 4, 1, 1. --- _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. Breezy! 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.3k tokens (28% cached) All 14 tests in 9 files
e2e 0.20.0 · 1m 17s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 8.0k tokens (32% cached) All 3 tests in 3 files
e2e 0.20.0 · 20.9s · 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 |
Summary
Part 1 of 5 of the
startReservedAgentTaskLeasedsplit (stack 10, tail first). It moves the admission, the send and the final status write intoadmitReservedLaunchPromptandsendReservedLaunchPrompt, and replaces the six identicalcleanupMaterializedTaskWorkspacecalls withcleanupLaunchCheckout. CC 60 → 54. Changed lines: 133.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.Implementation
ReservedLaunchCheckoutis a readonly record built right after materialize, wheresharesParentCheckoutis derived.planstays the only mutable record.admitTaskWorkspaceTurn, and the admission before the send.sendIdentitiesandskipOnSendCompactionstay on thesendMessagekind only. The status write keepsonlyFromStatus: "starting"andexpectedAttemptId.cancelMaterializedLaunchclosure became a plain method that returns the collaborator's promise.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$351.07