Skip to content

feat(guardrails): make the fix-request post guard configurable - #12014

Merged
kyle-sexton merged 6 commits into
mainfrom
feat/guardrails-fix-request-config
Nov 1, 2026
Merged

kyle-sexton merged 6 commits into
mainfrom
feat/guardrails-fix-request-config

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

No related issue: owner decision in session under standing direction §10

Summary

The guardrails hook block-fix-request-post stops sessions from posting the PR-fix lane fix request. The risk it names is a prompt-injected agent steering the lane, which comes from our own actors. The owner ruled that this repository lifts the guard. This PR makes the guard configurable per repository instead of deleting it, so hardening it later takes a one-line config change.

Fix

  • New setting fix_request_post (block or allow) in docs/conventions/guardrails.yaml, read from the repository's default branch (origin/HEAD, never the working tree or index, so the guarded session cannot lift it with an edit and git add), validated by the new plugins/guardrails/schemas/guardrails.schema.json. The default stays block, so consumer repositories behave as before.
  • The hook reads the setting only on a call it would otherwise block, so other calls pay nothing. Under allow it exits 0. No such ref or file, a missing key, a file that does not parse, or any other value keeps block; the last two print a notice naming the file and value.
  • The hook header's WHY and Escape sections name the setting and its values. The plugin README row and a config-cascade Implementers row (no-floor) record the surface.
  • This repository's docs/conventions/guardrails.yaml sets allow.
  • Changelog fragment: guardrails, minor.

Verification

  • plugins/guardrails/hooks/block-fix-request-post.test.sh before the hook change: the new stay-quiet case failed, FAIL: quiet: allow mode, phrase posted (direct, dispatched): expected '0 0', got '2 2' (PASS=302 FAIL=5).
  • After the change: PASS=308 FAIL=0. The new cases are allow mode at the repository root, allow mode from a subdirectory, and allow mode through the MCP tool (all quiet). They also cover block mode, allow only staged with no default branch, allow staged over block on the default branch (the security-review finding), an unknown value, a missing key, and a file that does not parse (all still block). Every existing block-mode case passes. The fixture directory is now its own git repository, so a checkout around the temp directory cannot change the result.
  • scripts/check-convention-yaml.sh: 13 files parse and validate. scripts/sync-config-cascade-semantics.py --check: up to date. scripts/check-changelog-fragments.sh --check: valid. scripts/validate-plugin-contracts.mjs: passes. shellcheck and shfmt: clean.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 1, 2026 12:10
Add fix_request_post (block default, allow) to a repository's tracked
docs/conventions/guardrails.yaml, with schemas/guardrails.schema.json.
Under allow, block-fix-request-post lets a would-be block through; an
untracked file, missing key, unparsable file or other value keeps block.
The lookup runs only on a would-block call. This repository sets allow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 1, 2026 17:55
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T17:57:31.970404Z 0111a80 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 9438be0aa4369078d56dfbf2c8472935dc0ff8b3: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Code review (incremental, 09d445a..9438be0): PR #12014, fix_request_post scope documented

I read every hunk of the incremental diff in all 6 changed files. For context I also read the hook's _bfr_allowed/block path and the section-9 tests in the head file.

What changed: the author took the "document it" option from my earlier finding (discussion_r4436974719). The setting is now documented as keyed to the session's repository, meaning the payload's cwd at its local origin/HEAD, and as applying whichever repository the post targets. This wording now appears in the hook header, in KNOWN GAPS (which also names a rewritten local origin/HEAD), and in the README row, the config-cascade row, the schema description and the changelog fragment. A new test pins the behaviour: gh pr comment 5 -R other/repo from the allow fixture stays quiet.

What I checked

  • Docs match the code: the wording matches _bfr_allowed, which resolves the root from _BFR_CWD and reads refs/remotes/origin/HEAD:docs/conventions/guardrails.yaml (block-fix-request-post.sh#L151-L167). The six surfaces agree with each other. The old "blocks … there" per-repository wording, which my finding cited, is gone from the fragment and the README.
  • Test counts: section 9 now has three direct verdict quiet cases, and the mcp helper keeps its own count, so N_QUIET + 3 is correct.
  • Prior finding: resolved by the documented behaviour plus the new test, so I have not posted it again.
  • Manifests: no plugin.json or marketplace.json changed, so the manifest checks don't apply. The fragment keeps bump: minor, which still fits.
  • Closing issues: none. The PR cites an owner decision with no linked issue, so there are no acceptance criteria to check.
  • Verification: the PR body's pass/fail counts are the author's claims. I had no shell, so I did not run the tests.

Scope: whether a session should be able to lift the guard for posts to other repositories, or by rewriting origin/HEAD, is a trust-boundary question. It is left to the security lane that covers this repository.

Spend: none.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 9438be0aa4369078d56dfbf2c8472935dc0ff8b3: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Security review (incremental): PR #12014, since 09d445a8

Scope. I read every hunk of the 6 in-scope files in .claude-lane/incremental.diff:

  • the changelog fragment
  • the config-cascade README row
  • the guardrails README row
  • block-fix-request-post.sh: header comments only
  • block-fix-request-post.test.sh: one new case
  • the schema description

I also checked the hook's _bfr_allowed function (block-fix-request-post.sh#L151-L167) to confirm the new text matches what the code does. It does: the hook reads refs/remotes/origin/HEAD:docs/conventions/guardrails.yaml from the repository that holds the payload's cwd.

None of these files matches a trusted-path glob, and no plugin manifest changed.

What changed. No executable code changed in this round. The hook's comments, the README, the changelog fragment, the config-cascade row and the schema description now say three things:

  • fix_request_post is keyed to the session's repository, not to the repository the post goes to.
  • Under allow, a post to any repository passes.
  • A session that rewrites its local origin/HEAD (with git remote set-head or git update-ref) chooses the value the hook reads. The KNOWN GAPS section now lists this.

The new test case (gh pr comment 5 -R other/repo passes under allow) pins that documented behaviour.

Prior finding (discussion_r4436975090, SUGGESTION). This change applies the minimum fix that finding asked for: the header and changelog no longer claim the session cannot lift the guard, and both gaps are now declared. The behaviour is unchanged and now accurately documented, for a guard that already calls itself a command-text deterrent. Under the owner's throughput threat model, loosening this person-approval hold is not a finding. I do not repeat it as a new finding and do not count it. Whether to also tie the lookup to the target repository is left to the owner.

Owner throughput exemption (unchanged from the last round): this repository lifting the fix-request person-approval hold is a named friction hold, so it is not a finding.

Instruction-surface lens. Nothing in this round narrows a rule further. The edits describe existing behaviour more accurately.

No token scope, secret, trusted actor, untrusted text reaching a credentialed lane, or billing surface changes. No security issues found in this round.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 1 inline finding(s) on 0111a80fe0d7c3f513da80737905dd3fc1fd685f; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

kyle-sexton and others added 2 commits November 1, 2026 14:02
Read the setting from origin/HEAD instead of the working tree, so the
session the guard constrains cannot lift it with an edit and git add.
Adds a test: allow staged over block on the default branch still blocks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 09d445a826af80937658ba29890c9f07482fb44d; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 1 inline finding(s) on 09d445a826af80937658ba29890c9f07482fb44d; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

kyle-sexton and others added 2 commits November 1, 2026 14:58
State that the setting is read from the session's repository and
applies to posts to any repository, and list cross-repository posts and
a rewritten local origin/HEAD as known gaps. Pin the behavior with a
test: a -R post from an allow repository passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit e6ff351 Nov 1, 2026
51 checks passed
@kyle-sexton
kyle-sexton deleted the feat/guardrails-fix-request-config branch November 1, 2026 21:03
kyle-sexton added a commit that referenced this pull request Nov 1, 2026
Resolves the guardrails README guard table: #12014's fix-request row, then
the block-github-post-content row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant