Repository navigation
fix(source-control): defer the MCP linkage gate to a consumer's own tracked copy - #2068
Conversation
…racked copy A repo wiring its own pr-linkage-mcp-gate in .claude/settings.json (the marketplace repo does; its copy is deliberately kill-switch-free tracked policy) got both gates firing exit-2 on every MCP PR call. The plugin copy now defers when the consumer's settings wire a PreToolUse command naming the gate: the settings file states the wiring authoritatively, while the repo-local script has no sound plugin-active signal. Accepted, named cost: a same-named no-op script suppresses the gate — policy gate, not a security guard; the required CI check stays the authority. Also extends scripts/run-plugin-tests.sh to .claude/hooks/*.test.sh: the repo-local gate's test never ran in CI, which is how the two copies drifted silently. source-control 0.49.1 -> 0.49.2. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Claude finished @kyle-sexton's task in 3m 56s —— View job Review complete ✅
No blocking issues. The defer-guard is correctly scoped and the logic traces cleanly:
Named, accepted tradeoff (already documented by the author, not a new finding): the Could not independently verify (tool restrictions in this lane):
|
|
Claude finished @kyle-sexton's task in 1m 52s —— View job Security review complete ✅
Scope: the 5 files changed in this PR ( FindingsNo CRITICAL or IMPORTANT security issues found. This is a shell-hook policy change, not a workflow/permissions/trigger change, so there's nothing in zizmor's advisory lane to defer here — the review below is my own logic/trust-boundary read. SUGGESTION / informational — the disclosed defer-bypass is real but is exactly the cost the author already named and bounded The new defer-guard checks only that some This is the exact tradeoff the PR's own comment and changelog call out ("a same-named no-op script suppresses the gate... this is a policy gate, not a security guard, and the required CI check remains the authority"), so I'm not flagging it as a new/undisclosed risk — the author already reasoned about it and the real enforcement backstop ( No issues found with:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55981ea477
ℹ️ 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 has reviewed this PR 4 times. The lane skips further automatic reviews after 5; deleting this comment resets the count. |
Review findings: the defer projection read only .command, so exec-form wiring (command "bash" with the gate script in args) did not defer — args strings now join the projection with a test pinning the form; and the deferral envelope used the undocumented "deferred" status, which the reference sink maps to error/exit 2 — it now emits status "skipped" with outcome "deferred" in data. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Both findings fixed in 7de935b: the defer projection now includes exec-form args strings (with a test pinning |
|
Claude finished @kyle-sexton's task in 1m 51s —— View job Security review complete ✅
Scope: the 5 files changed in this PR, at HEAD No CRITICAL or IMPORTANT security issues foundBoth Codex findings on the prior commit were about detection completeness, not a bypass in the security-relevant direction, and both are now fixed:
Re-verified from my prior pass, still holds on the current HEAD:
Named, accepted tradeoff (author-disclosed, unchanged by this commit, not a new finding): the |
|
Claude finished @kyle-sexton's task in 3m 13s —— View job Code review complete ✅
No blocking issues. The follow-up commit (
One inline suggestion posted (non-blocking, test-coverage): none of the three new defer-guard tests assert on the actual telemetry envelope — they only check the hook's exit code. Since this PR's whole telemetry fix was about what value lands in Not independently re-verified (already covered by the two automated review passes earlier in this thread, and unchanged by the new commit): the security review's bounded-bypass analysis, and the author-claimed 22/0 · 17/0 suite results / shellcheck-clean claim — I did not execute the test suites or shellcheck myself in this pass either. |
A stub sink captures the envelope on a deferred call and the case asserts status "skipped" with data.outcome "deferred" — the exact regression the prior fix addressed (an unknown status maps to error in the reference sink). Suite: 24/0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Fixed — a stub-sink capture case now asserts the deferral envelope carries status "skipped" and data.outcome "deferred" (suite 24/0), pinning the exact regression the status fix addressed. |
|
Claude finished @kyle-sexton's task in 1m 15s —— View job Security review complete ✅
Scope: the 5 files changed in this PR at HEAD No CRITICAL or IMPORTANT security issues found
Named, accepted tradeoff (author-disclosed, unchanged by this commit, not a new finding): the No test-coverage or style commentary included per this review's scope (security only); my prior test-coverage suggestion on |
|
Claude finished @kyle-sexton's task in 3m 25s —— View job Code review complete ✅
Scope: this pass reviews HEAD No blocking issues. The new telemetry-envelope test ( Two non-blocking suggestions posted inline:
Both prior review-thread findings (Codex's exec-form-args gap and telemetry-status mapping) were verified fixed in commit Not independently re-verified this pass (already covered by earlier passes in this thread, and unchanged since): the security-review's bounded-bypass analysis of the |
…k wait Review suggestions: emit_tel now takes an optional status override (emit_tel "deferred" "skipped") instead of a near-duplicate function; the capture-wait polls in 20ms steps matching the established wait_for_sink shape instead of a coarse 0.3s sleep. Suite: 24/0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Both suggestions applied: emit_tel gained an optional status-override parameter (emit_tel "deferred" "skipped") replacing the near-duplicate function, and the capture-wait now polls in 20ms steps matching the established wait_for_sink shape. Suite 24/0. |
|
Claude finished @kyle-sexton's task in 1m 46s —— View job Code review complete ✅
Scope: this pass reviews the delta introduced by the latest commit, No blocking issues. This commit is exactly what it says on the tin — it applies both non-blocking suggestions I left on the prior commit, and both are correctly done:
Nothing else changed in this commit ( Not independently re-verified this pass (already covered by earlier passes in this thread, and unchanged by this commit): the defer-guard's control flow, fail-direction, exec-form detection, and the security-review's bounded-bypass analysis of the |
|
Claude finished @kyle-sexton's task in 57s —— View job Security review complete ✅
Scope: this PR is now at HEAD No CRITICAL or IMPORTANT security issues found
Named, accepted tradeoff (author-disclosed, unchanged by this commit, not a new finding): the No test-coverage or style commentary included per this review's security-only scope; both maintainability suggestions from my prior code-review pass on |
No linked issue
Summary
Executes #2021 remediation line 4 (de-dup the double-fired MCP linkage gate) per the read-only investigation's verdict: the plugin copy yields to a consumer repo's own tracked equivalent, and the repo-local hook tests join CI so the two copies can never drift silently again.
Fix
plugins/source-control/hooks/pr-linkage-mcp-gate.sh: after the gate-file and scope checks, the hook defers (emit_tel "deferred", exit 0) when<repo>/.claude/settings.jsonwires any PreToolUse command namingpr-linkage-mcp-gate. The plugin side is the sound place to yield — the settings file states the wiring authoritatively; the repo-local script has no reliable "plugin active" signal (plugin source present ≠ plugin enabled). Named, accepted cost documented in the script and changelog: a same-named no-op script suppresses the gate; it is a policy gate, and the requiredpr-issue-linkageCI check remains the authority.scripts/run-plugin-tests.shnow also runs.claude/hooks/*.test.sh—.claude/hooks/pr-linkage-mcp-gate.test.shnever ran in CI, which is how the two copies drifted apart silently. (This also activates the telemetry-sink drift test added on chore: wire the claude-ops reference telemetry sink for this repo's own hooks #2048.)Verification
Both suites green locally (22/0, 17/0); shellcheck clean at info severity; catalog/cheat-sheet regeneration: no diff. The cheaper alternative (deleting the repo-local settings entry) was rejected because docs/CLOUD-SESSIONS.md and docs/MIGRATION-PLAYBOOK.md currently contradict each other on whether cloud sessions load the plugin at all — tracked as #2053; this defer-guard is sound in both worlds.
Related
Refs #2021 (line 4), #2053 (the doc contradiction gating the cheaper fix), #2048 (the drift-test this runner extension activates).
🤖 Generated with Claude Code