Repository navigation
feat(guardrails,source-control): one merge-readiness script for the merge guard and the pull-request skill - #18835
Conversation
…erge guard and the pull-request skill The guardrails merge hook and the pull-request skill's merge preflight each judged readiness with different rules. Both now run lib/merge-readiness.sh, copied into each plugin by scripts/sync-shared-copies.sh, so either plugin alone still enforces it. - Rename the hook to merge-guard.sh and its switch to merge_guard_enabled. - Read every page of review threads; past 100 the hook no longer fails open. - End the pr-verify no-verdict wait 30 minutes after the head's last check finished, in the hook as in the skill. - The skill now holds on hold labels in any case, changes-requested reviews and every failed conclusion; no failure is judged informational. Closes #18822 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…etting in the merge preflight The skill runs merge-readiness.sh as a command, outside the guardrails hook environment that carries CLAUDE_PLUGIN_OPTION_MERGE_GUARD_IGNORED_CHECKS, so it always applied the built-in default and could disagree with the merge guard for an operator with a custom value. Run as a command, the script now reads the operator's guardrails@<marketplace> pluginConfigs entry through lib/merge-guard-option.mjs and the shared channel-F reader lib/plugin-options.mjs, ignores an inherited env value, and is UNCHECKED when a settings file cannot be read or node is missing. The test sets a custom value in a fake install's user settings and proves the hook and the skill copy both honor it, and pins the built-in default to plugin.json's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4d5d56296
ℹ️ 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".
…option budget The description ran 693 characters, over the 300-character budget in docs/contracts/plugin-option-naming/README.md, so the plugin contract validator warned and Check Catalog failed. The detail moves to the README's Option details, and the generated options table is regenerated, which Check Plugins reported stale. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
claude-security-review reviewed Security review: PR #18835 at
|
|
claude-review reviewed Code review: shared merge-readiness script (#18835), blocking onlyThis lane already reviewed two earlier heads, so this pass looked only for blocking findings and Nothing blocking at
Closing issue #18822, acceptance criteria:
I ran no tests; every pass count above is the author's claim. Loosened checks would be marked: fail (default; the prompt has no Advisory and manifest lines (4)
Verifier dropped 0 of 0 candidates. |
|
The pr-verify verifier failed head What it wrote (31 lines)This pull request leaves the merge queue, and ci-status holds it out while it carries |
Lane run report
pr-unblock/apply-feedback-patch, attempt 1
Failed GitHub API callsNo failed call recorded by the run job's scripts. pr-unblock/publish-feedback, attempt 1
Failed GitHub API callsNo failed call recorded by the run job's scripts. pr-unblock/report-escalation, attempt 1
Failed GitHub API callsNo failed call recorded by the run job's scripts. |
… runs The 30-minute no-verdict wait measured from the newest completed check run, and an --auto or merge-queue request cleared the pending list before it, so the wait could end while a long check was still running. The wait now starts only once no check run or commit status on the head is pending. - Guardrails releases as a major: removing block_unresolved_pr_merge_enabled turns a saved false back on. - A test proves a saved old-key false no longer switches the guard off. - The reviewThreads pagination and pr-verify tests derive their cases from captured GitHub answers in hooks/fixtures/. Co-Authored-By: Claude Opus 5.5 <[email protected]>
editorconfig-checker in Lint Repo requires a final newline. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane-Activity: pr-unblock/resolve-conflicts
Closes #18822
Summary
The guardrails merge hook and the source-control pull-request skill's merge preflight each judged merge readiness, with different rules (hold-label case, which failures block, how many review threads are read, changes-requested reviews, and the pr-verify no-verdict wait). The owner decided on one shared script, option (a): owner-decisions row docs/owner-decisions.md#L411 (melodic-software/architecture#237). Owner, verbatim: "Yes, go with recommendations."
Fix
lib/merge-readiness.showns every mechanical condition: hold labels (one list,lib/merge-hold-labels.json, any case), unresolved review threads (every page over GraphQL, else the Claude Code cloud route), changes-requested reviews, failed and pending checks with the workflow-file exemption andmerge_guard_ignored_checks, and the pr-verify verdict with one 30-minute no-verdict rule.scripts/sync-shared-copies.shcopies it (and the label list) into guardrailshooks/and source-controlskills/pull-request/scripts/, so either plugin alone enforces it.merge_guard_ignored_checksvalue for both: the hook gets the operator's guardrails setting from Claude Code asCLAUDE_PLUGIN_OPTION_MERGE_GUARD_IGNORED_CHECKS; the skill runs the script outside that hook environment, so in command mode the script reads the sameguardrails@<marketplace>pluginConfigsentry from the operator's managed and user settings throughlib/merge-guard-option.mjsand the shared channel-F readerlib/plugin-options.mjs(both synced intoskills/pull-request/scripts/), ignores any inherited env value (a repository settingsenvblock reaches that shell), applies the option's default when guardrails has no value, and isUNCHECKEDwhen a settings file cannot be read ornodeis missing. Before this, a custom guardrails value never reached the skill.hooks/merge-guard.sh, switched bymerge_guard_enabledbesidemerge_guard_ignored_checks. It keeps command parsing and target resolution, sources the library, and turns its verdict into a refusal that points at/source-control:pull-request merge. Guardrails releases as a major: the removedblock_unresolved_pr_merge_enabledkey turns a savedfalseback on.--head), merges only onREADY, re-runs onBLOCKED no-verify-pass, and holds on any otherBLOCKEDorUNCHECKED. Gate 2 no longer allows an agent-judged informational failure. The provider's hand-written pr-verify read is gone.readiness.md: the script owns the mechanical conditions; the skill owns judgment and process; rulesets are the backstop.MERGE_HOLD_LABELStuple stays hand-written, tied tolib/merge-hold-labels.jsonby a drift test (test_merge_holds_sync.py) rather than generated from it;.github/scripts/lib/lane-vocabulary.mjsARM_HOLDSis unchanged and shares its constants withmerge-holds.mjs, which the existing hold-label test ties to babysit. babysit cannot read the JSON at run time in CI:pr-require-checks.yml(line 5494) sparse-checks-out onlyplugins/source-control/skills/babysit-prs/scripts/*.pyfrom the base. A drift is a failing test, not a silent disagreement.Loosened checks
Each is authorized by the owner-decisions row docs/owner-decisions.md#L411, owner verbatim: "Yes, go with recommendations."
--autoand merge-queue requests stay blocked.merge_guard_enabledreplacesblock_unresolved_pr_merge_enabled; a saved old-keyfalseis dropped, so the guard comes back on (tightening).Tightened: the hook reads threads past 100 (was: unchecked); the skill holds on hold labels in any case, on changes-requested reviews, on
timed_out,cancelled,action_required,startup_failureandstalechecks, and on any failure the setting does not name.Verification
plugins/guardrails/hooks/merge-guard.test.sh727 passed, including "a saved old-key false leaves the guard on", which fails against origin/main's hook (exit 0, expected 2).merge-guard-c.test.sh15 passed. Its thread-pagination and pr-verify cases derive from captured GitHub answers inhooks/fixtures/(tworeviewThreadspages and oneCI Statuscheck-runs page).lib/merge-readiness.test.sh48 passed. The new case (no verdict, a check still in progress,--autogivesBLOCKED no-verify-pass) fails without the fix (READY).plugins/guardrails/hooks/*.test.sh,plugins/guardrails/git-hooks/*.test.sh,plugins/source-control/skills/pull-request/scripts/*.test.shandscripts/check-killswitch-hoist.test.shpassed: 83 suites.scripts/sync-shared-copies.sh --check,scripts/validate-plugins.sh,python3 scripts/sync-plugin-options-docs.py --check,scripts/check-changelog-fragments.sh --check,scripts/check-killswitch-hoist.sh, shellcheck and the comment lint pass.Related
docs/contracts/hook-config-delivery/README.mdlists the skill's read as a channel-F adopter.🤖 Generated with Claude Code