Repository navigation
🤖 refactor: split prepareTaskReservation, part 2: parent gates, placement, agentId and bestOf - #7724
Conversation
…me placement and parent branch
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. 👍 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.2k tokens (28% cached) All 14 tests in 9 files
e2e 0.20.0 · 1m 24s · 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 · 25.7s · electron · run artifacts 🟢 e2e agent repros (Haiku): no tests selectedSpend: $0.00 of the $1.00 cap (proxy ledger) e2e 0.20.0 · 6.9s · 2 targets (web, phone) · run artifacts |
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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. |
|
@codex security review |
🛡️ Codex Security ReviewSecurity 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. |
|
@codex security review |
🛡️ Codex Security ReviewSecurity 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. |
|
@codex security review |
🛡️ Codex Security ReviewSecurity 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. |
|
@codex review |
🛡️ 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. |
|
@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". |
…receipt for the head (coder#7729) ## Summary The `Codex Comments` gate (and so `Required`) no longer fails on a PR where Codex's security review found nothing but finished with null findings flags. The gate accepts that one state only beside a clean security receipt for the current head, with no open Codex thread. Every other unknown state still blocks. Fixes coder#7727. ## Background Since about 2026-10-28, Codex's summary board can record a finished security review as `{"has_any_findings": null, "has_unresolved_findings": null, "status": "completed"}`. `codex_summary_status` accepted null flags only while a review runs, so it returned unknown, and the board counted as an unresolved Codex comment. Rerunning the job could not help. Open PRs coder#7722, coder#7724, coder#7723, coder#7721 and coder#7717 all had this state on their latest board. coder#7722 is the observed fixture. ## Implementation `codex_summary_status` accepts a completed `security_review` with both flags null only when ALL of these hold: 1. The review state's `commit_sha` is the PR's current head. 2. The board's security metadata line says `status: completed` for the current head, with `mergeGateEnabled: false`. 3. The board has no `### Security findings` or advisory section. 4. An unminimized Codex comment is the clean security receipt ("Security review completed. No security issues were found in this pull request.") and names a reviewed commit that matches the current head. A receipt without a commit line does not count here. 5. No Codex review thread is unresolved. `check_codex_comments.sh` computes 4 and 5 and passes them as `.clean_security_receipt`. A caller that does not set it gets the old fail-closed behavior. The receipt regex moved into one shared `codex_clean_security_receipt` def, so the informational check and this check use the same text. ## Why the gate stays safe - Null flags still block in every other case: a code review, an older head, no receipt, a receipt for another commit, a minimized receipt, an advisory section, the merge gate on, or an open Codex thread. - The receipt is Codex's own verdict for that exact commit. It carries no finding by construction: the regex is anchored and accepts only fixed text. - Findings never depend on the flags alone. Code and security findings are review threads, and the gate counts open Codex threads separately. Advisory findings are board bullets, and they block as before. - A running review with null flags is unchanged: it still exits 10 (in progress). ## Validation - New test `test_null_security_flags_pass_only_with_a_clean_receipt_for_this_head`, run against the real shell entrypoint with the observed coder#7722 board and receipt as fixtures (with and without the cached payload). Cases: clean receipt for this head passes (0); no receipt (1); an open Codex thread (1); a receipt for an older head (1); board and receipt for an older head (1); an advisory section (1); the merge gate on (1); running with null flags (10); a minimized receipt (1). - On main, only the "clean receipt for this head" case fails (1 instead of 0). Every blocking case blocks before and after. - `make test-codex-comments` passes in full. - A live run of `./scripts/check_codex_comments.sh 7722` with this change: "No unresolved Codex comments found". --- _Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high` • Cost: `$248.33`_ <!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high costs=248.33 -->
🛡️ 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. |
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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. |
|
@codex review |
🛡️ 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. |
|
Codex Review: Didn't find any major issues. What shall we delve into next? 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 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 2 of 2: splits the start of
TaskService.prepareTaskReservationin place, with no behaviour change. The start covers the parent read and gates, runtime placement, the parent branch read, and the agentId andbestOfchecks. The method drops from CC 47 to CC 7. On top of part 1. 234 changed lines in two commits.Across both parts,
prepareTaskReservationgoes from CC 62 to CC 7, and every new function scores CC 8 or less.Steps in this part
resolveReservationAgentIdparses the agentId and resolves the desktop owner.normalizeReservationBestOfchecksbestOf.readReservationParentmakes the metadata read with its abort check, then runs the parent checks and the depth check.resolveTrustedParentProjectrefuses an archived parent or an untrusted project.refuseStoppedOrReportedParentrefuses a parent aftertask_stoporagent_report.readReservationParentBranchplaces the task, makes the branch read with its abort check, and writes the debug log.resolveParentRuntimeandresolveSharedTaskWorkspacechoose the runtime and decide whether the task shares the parent checkout.The split adds 5 one-line
if (!x.success) return x;checks. Every one is reached by tests. The only line without coverage is still alog.debug, as before.Rules every part keeps
prepareTaskReservationkeeps its signature. It runs under the parent tree locks, before the global mutex, and takes no lock itself. No step takes a lock.createManyUnderTaskTreeLifecycleLockslater, at approximately 2 to 3 microtasks per chain level. That caller then checkssignal?.abortedand releases the parent tree locks that much later. Checks that run before the first await settle at the same time as before.readCancellablecalls, 4interruptedError()calls and the same other calls.make crap-checkagainst the parent commit reports 0 violations, with and without coverage. Every new function scores CC 8 or less, and the highest CRAP with coverage is 8.0.bun teston the taskService, ledger, workspaceTurnManager, workflows, tools and workspaceService suites passes. The only failures were 60 s timeouts inworkflowScriptDiscovery.test.ts, which does not import TaskService and scans this host's global skill folders. It passed on the last part.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$257.41