Repository navigation
🤖 refactor: split maybeStartQueuedTasksFromReservations, part 2: per-task gates and parent reads - #7746
Conversation
…task gates and parent reads Part 2 of 3. It moves the head of the per-task loop body into steps, so the whole body is now one step, reserveQueuedTaskSlot, that returns "reserved", "skipped" or "shutdown". The method's CC goes from 56 to 20. Each new step has CC 8 or less. - reserveQueuedTaskSlot keeps the workflow-owner check, the stop barrier and the streaming task (which still takes a slot, #7743). Then it runs the sync refusals and marks a refused task failed with the same message as before. - Module-level, no `this`: queuedTaskLaunchStart (the brief send or the legacy resume), resolveQueuedTaskParent (the four parent and runtime refusals), queuedTaskTrustRefusal and findUntrustedSecondaryProject. - The steps after the refusals form a chain. Each step calls the next one right after its own await: readQueuedTaskParentMeta (the metadata read and its fallback), resolveQueuedTaskSkipInitHook, then requestQueuedTaskLaunch (the name check, the model and createdAt), which hands the request to part 1's leaseQueuedTaskLaunch. - The snapshots cross the steps in readonly records built by spread: QueuedDrainSnapshot (config and taskIndex after the prepass), QueuedTaskParent, QueuedTaskCandidate and QueuedTaskParentRead. No behaviour change: same awaits on collaborators, same calls in the same order (compared with a script), same markTaskLaunchFailed messages, same log messages and fields. --- _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.5k tokens (27% cached) All 14 tests in 9 files
e2e 0.20.0 · 1m 18s · 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.6s · 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 |
…ueue-start-split-2
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! 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. |
…ueue-start-split-2
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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 2 of 3. It moves the per-task body into
reserveQueuedTaskSlot, which returnsreserved,skippedorshutdown, and its steps: the parent and trust refusals, the parent metadata read with its fallback, theskip_init_hookread and the launch request. The method's CC goes from 56 to 20. Changed lines: 470.No behaviour change: same awaits, same calls to other methods in the same order (checked with a script that inlines every step), same
markTaskLaunchFailedmessages. Each new step has CC 8 or less, with 100 % line coverage. The method keeps the_unlaunchedLeasesdisposer, the mutex block and the per-task loop. No step takes the mutex or starts a drain, and every step call inside the mutex block is awaited.Implementation
reserveQueuedTaskSlot. A streaming queued task still takes a slot. 🤖 fix: a streaming queued task takes two parallel-task slots in one drain #7743 tracks that double count, and this stack does not change it.markTaskLaunchFailedcall site each. Every path still makes exactly one call, with the same message.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$313.07