Repository navigation
perf(source-control): narrow hook filters and move PR waits off the foreground - #6653
Conversation
…oreground - pr-body-linkage-gate runs from Bash(*pr create*), Bash(*pr new*) and Bash(*pr edit*) instead of Bash(*gh *); both worktree gates run under Bash(*worktree add*) instead of Bash(*worktree*). - worktree create: with no user present, skip EnterWorktree outside .claude/worktrees/ and work by explicit path with git -C. - pull-request create writes the body with the Write tool, gates read the file, and gh gets --body-file (REST: -F body=@file). - pull-request monitor: the cloud baseline poll and per-push CI wait run through Monitor or run_in_background, never a foreground loop. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VxGrZW26Qs1qeo3RFgmbvp
The README still named the old Bash(*gh *) and Bash(*worktree*) filters. It now describes the pr-body gate's three entries (pr create, pr new, pr edit) and the worktree gates' Bash(*worktree add*) filter. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VxGrZW26Qs1qeo3RFgmbvp
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. |
|
Claude finished @kyle-sexton's task in 5m 5s —— View job Security review in progress
|
|
Claude finished @kyle-sexton's task in 7m 57s —— View job Code review complete
Skip gate: none applied — PR is open, not a draft, and the diff has real review surface. Scope: Findings🔴 Important — two eval fixtures describe a mechanism this PR removed, and the PR's own claim that they "still describe the behavior" is incorrect.
Both phrases ("parameter-expansion concat", "the quoted heredoc", "the trailing concat") name the old §2.4.1/§2.4.3 implementation that this PR deletes (see Fix: reword both 🟡 Suggestion (posted inline on Everything else checked out
Not independently verified (no shell execution available in this environment): the PR's claimed local test runs ( |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a348e97aa
ℹ️ 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".
|
claude-security-review has reviewed this pull request through fa4b02d; a later push is reviewed from there. |
|
claude-review has reviewed this pull request through fa4b02d; a later push is reviewed from there. |
check-test-tmp-cleanup fails a suite that calls mktemp without an EXIT trap. Create the body file once and remove it on exit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VxGrZW26Qs1qeo3RFgmbvp
A literal `pr create` or `worktree add` in an `if` filter skipped the gate for `gh pr create` or a tab between the words, which the gates' own tokenizers accept. Use `*pr*create*`, `*pr*new*`, `*pr*edit*` and `*worktree*add*`, which still skip `gh pr view` and `git worktree list`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VxGrZW26Qs1qeo3RFgmbvp
…te.md context/create.md step 3 still made EnterWorktree unconditional; it now points at the no-user exception. The SKILL.md bullet records a docs pointer, as-of date and recheck trigger and drops the timing figure. Pull-request evals 9 and 11 describe the post-gate append to the body file instead of the removed parameter-expansion concat. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VxGrZW26Qs1qeo3RFgmbvp
|
Claude finished @kyle-sexton's task in 6m 48s —— View job Code review complete
Skip gate: none applied — PR is open, not a draft, and the incremental diff has real review surface. Scope: incremental review since This increment is mostly a clean response to the two outstanding review threads: it rewords the pull-request Findings🔴 Important (posted inline on 🔴 Important — the Codex review comment on this PR ("Propagate the headless exception through the create contract") is only half-addressed. This increment correctly updates the spoke ( Everything else checked out
Not independently verified (no shell execution available in this environment beyond static reads): the PR's claimed local test runs. Those remain author-claimed and unconfirmed by this review. |
|
Claude finished @kyle-sexton's task in 2m 44s —— View job Security review complete
Skip gate: not applied — the diff touches Scope (incremental, as instructed): only the files that changed since No security issues found in this slice
No CRITICAL/IMPORTANT/SUGGESTION findings to report for this incremental slice. |
…st word A bare `*` between the words let `*pr*create*` match `pr` and `create` inside unrelated words, such as `cp report.txt prod_create/`, since the `if` glob has no word boundaries. `*pr *create*` and `*worktree *add*` still accept extra spaces between the words; a tab or line continuation right after the first word skips the hook, as the README now says. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VxGrZW26Qs1qeo3RFgmbvp
|
Claude finished @kyle-sexton's task in 3m 15s —— View job Code review complete
Skip gate: none applied — PR is open, not a draft, and the incremental diff has real review surface. Scope: incremental review since This increment responds to the two outstanding No blocking findings
Not independently verified: the PR's claimed local test runs ( |
|
Claude finished @kyle-sexton's task in 2m 56s —— View job Security review complete
Skip gate: not applied — this increment edits the Scope (incremental, as instructed): only the three files named in the task, diffed from No security issues found in this sliceThis commit is the fix for the prior round's 🔴 Important finding (bare
I re-ran the exact adversarial example from the prior finding against the new pattern: One residual gap, already disclosed rather than hidden: the new README text itself states that a tab or line continuation landing immediately after I also checked whether the same fix closes the match as tightly for
Not independently verified (no shell execution available in this environment beyond static reads): the PR's claimed local test runs. |

No related issue: performance change set approved in the fleet perf audit (items B5, W1, E1s source-control part, B15).
Summary
Four source-control changes that cut hook spawns and foreground waits:
pr-body-linkage-gatenow runs from threeifentries,Bash(*pr create*),Bash(*pr new*)andBash(*pr edit*), replacingBash(*gh *). Both worktree gates now useBash(*worktree add*)instead ofBash(*worktree*). In the audit, the old filters matched 62-70% of Bash calls./source-control:worktree createsays that with no user present it skipsEnterWorktreeoutside.claude/worktrees/and works by explicit path withgit -C <literal path>. That call raises an approval ask, and headless runs deny it./source-control:pull-request createwrites the PR body with the Write tool. The §2.4.2 gates read that file, andgh pr creategets--body-file(the REST fallback sends-F body=@<file>). Inline--bodycalls had been rejected by the command length cap.run_in_backgroundpoll, never a foregroundsleep/untilloop. The babysit loop already used Monitor, so it is unchanged.Fix
gh <global flags> pr create|new|edit(pr-body-linkage-gate.sh:580-596), so a*gh pr create*filter would missgh -R o/r pr createand thegh pr newalias. As the work plan says, this PR uses three entries:*pr create*,*pr new*and*pr edit*.$BODYshell-variable assembly (content_for_section, theTEMPLATEconcat and the quoted-heredoc rationale) is replaced by one Write-tool step. The attribution footer is still appended only after the gates pass, now byprintf '\n\n%s\n' "$ATTRIBUTION" >>"$BODY_FILE", so pull-request evals 9 and 11 (parameter-expansion splice; skipped whennone) still describe the behavior.skills/pull-request/scripts/check-body-sections.test.sh. It evals create.md's §2.4.2.2 block verbatim with aBODYvariable, so its harness now writes each fixture body to a temp file and setsBODY_FILE. The 14 cases and their expected verdicts are unchanged. Before this harness edit the suite failed 7 of 14 against the new block; after it, 14 of 14 pass..changes/source-control/perf-source-control-narrow-hooks-bg-waits-4b2a3171.md, withbump: patch.Verification
Run locally on this branch (base origin/main 51a781b):
scripts/affected-tests.sh --run --jobs 8: all 12 shell suites passed (2 optional Windows/version SKIPs). The 2 Python suites passed separately:test_guards.pyandtest_check_contract_clause_coverage.py, 48 passed.pr-body-linkage-gate.test.sh178/0,pr-linkage-spawn-budget.test.sh23/0,worktree-add-containment-gate.test.shpass,pr-linkage-mcp-gate.test.sh57/0.worktree-gates-spawn-budget.test.shandworktree-add-claim-gate.test.shran through affected-tests.scripts/check-changed-skills.sh origin/main: 2 skills checked, 0 failed (warnings only, pre-existing size).scripts/check-purged-em-dashes.sh: no em dashes.scripts/check-changelog-fragments.sh --checkand--check-required origin/main: pass.scripts/validate-plugins.sh,check-hooks-description.sh,check-hook-slow-shapes.sh,check-hook-wiring-liveness.sh: pass..markdownlint-cli2.jsoncon the 5 changed Markdown files: 0 errors. typos on all changed files: clean. ShellCheck on the changed test: clean.jqon hooks.json shows the fiveifvalues above.Related
plugins/source-control/**, so this needs a code-owner review or the owner's own merge.plugins/source-control/README.md:184-185and:281still describe theBash(*gh *)andBash(*worktree*)filters as supersets of each gate's first check.🤖 Generated with Claude Code
https://claude.ai/code/session_01VxGrZW26Qs1qeo3RFgmbvp