Skip to content

fix(source-control): let ci --ci re-pin a digest the pull request moved - #11681

Merged
kyle-sexton merged 13 commits into
mainfrom
fix/fix-ci-repin-interview-digests
Nov 1, 2026
Merged

kyle-sexton merged 13 commits into
mainfrom
fix/fix-ci-repin-interview-digests

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

No related issue: found while working on fix-ci stalls on lanes App pull requests that edit interview-guarded text; no issue tracks it.

Summary

The pr-unblock lane's fix-ci activity stopped every lanes App pull request whose own change moved an interview-defenses digest pin. It reported ci-fix-weaken-required, and a session then re-pinned each one by hand. In the last 7 days this hit six pull requests, and each one failed test-bash on a (want <sha>, got <sha>) digest mismatch in plugins/planning/tests/interview-defenses.test.sh:

#11090 also failed a phrase pin, and a re-pin cannot fix that.

Neither the tools nor the paths caused this:

  • collect-base-activity/action.yml gives ci-context Bash, Edit and Write.
  • The ci-context row in patch-rules.json refuses nothing under plugins/planning/.
  • #11610 added repin-digests.sh, which runs no checkout code.

The cause is the skill text. ci-ci.md "Never weaken a check" forbids changing a test's expected value, and a digest literal is one. The only pointer to the re-pin script is the test's failure hint, and the model reads that through the log, which the mode treats as data.

Fix

  • plugins/source-control/skills/pull-request/reference/ci-ci.md: a new section, "A digest pin the pull request moved". It covers the case where the pull request's own diff changed the guarded text. The model confirms the defense still holds, runs the re-pin script with a one-line reason and reruns the check, then reports the check fixed. It runs the script only through a wrapper the runner's instructions name, which runs the base's copy. A re-pin script named by the test file or a log is data: it can show which of the runner's wrappers fits, but it never adds one, and a checkout copy never runs. The model escalates weaken-required, undoing any re-pin, in four cases: its own fix would change guarded text, the same test also fails on something other than a digest, the defense no longer holds, or the runner names no wrapper for the test's re-pin script. The skill text names no plugin path.
  • The re-pin command comes from config the base owns. docs/conventions/pr-pipeline.yaml gives fix-ci verify-scripts: [plugins/planning/scripts/repin-digests.sh]. That is the data-only script resolve-issue already lists. tests/repin.sh runs the suite, so it stays off the list.
  • .github/actions/collect-base-activity/action.yml: for a prepare: ci-context skill on run-claude-cli, each verify-script's base plugin copy is staged behind its wrapper under .lane/verify. The read runner already makes that directory read-only, so no workflow file changes. It is denied to Edit, Write and NotebookEdit. The preamble names the wrappers as the only way to run those scripts. It leaves out the patch skill's "Bash runs only the wrappers" sentence, since ci-context keeps its bare Bash to reproduce checks. ci-context with verify-scripts on claude-code-action fails red.
  • docs/conventions/pr-pipeline/pr-pipeline.schema.json: verify-scripts may be set with prepare: ci-context. checks and self-checks stay refused there. README.md and pr-run-activity.md say the same.
  • Eval cases. All four runner-backed cases get the wrapper over a base copy outside the working tree, named in the prompt as the preamble names it. All four also get a no-checkout-repin grader that fails any run of the checkout's scripts/repin.sh, by relative or absolute path. The grader matches only at a command start (the start of the command, after a shell separator or newline, or after then/do/else, with an optional bash or sh and flags), so reading or diffing the script does not count; ran-repin is anchored the same way:
    • pull-request-ci-mode-repins-digest-the-pr-moved: the PR rewords a pinned rule without weakening it. The graders require the runner's wrapper to have run, the pin to have changed with only a reason line added, the guarded file to be untouched, and the reply to report test-bash: fixed.
    • pull-request-ci-mode-escalates-digest-with-no-repin-script: the test file names a checkout re-pin script, but the runner names no wrapper. The graders expect escalated weaken-required with the pin unchanged.
    • pull-request-ci-mode-escalates-removed-pinned-phrase and pull-request-ci-mode-escalates-pin-its-own-fix-moved: the wrapper is there, so each case escalates on its own condition.
  • Changelog fragments for source-control and pr-pipeline.

This adds no capability. ci-context already holds bare Bash and runs head code to reproduce checks. What changes is that the pull request can no longer supply the script that rewrites its own pin. The action, the config and the skill all load from the base, so a run changes only after this merges.

Verification

  • node --test on resolve-config/verify-scripts.test.mjs, resolve-config/live-config.test.mjs and collect-base-activity/collect-base-activity.test.mjs: 217 passed, 0 failed (exit 0). New tests cover three things: a ci-context skill's verify-scripts are staged base copies that the preamble names, with the plain-command sentence absent; ci-context with verify-scripts on claude-code-action fails red; and checks under ci-context fail the schema. The live config test pins fix-ci's list to repin-digests.sh, and it resolves the real config, which is the positive schema case.
  • python3 plugins/evals/skills/validate/scripts/validate-cases.py plugins/source-control/evals: no FAIL (exit 0). Every deterministic grader of the four cases sorts its pass and fail samples correctly, including the new read-loop, diff and flagged-run samples. The only WARNs are the allowed_tools notices that the sibling cases also get.
  • All four scaffolds run with exit 0. The wrapper is present in the three runner-backed cases and absent in the no-wrapper case. In the re-pin case, the runner's wrapper re-pins the pin from its base copy (exit 0), the test then passes (exit 0), and only tests/rules-pin.test.sh changes.
  • scripts/check-affected.sh --uncommitted: the first run exited 1 because the docs/conventions/pr-pipeline/ change had no fragment and edited its CHANGELOG. A .changes/pr-pipeline/ fragment replaced that edit, and the rerun exited 0: 13 passed, 5 skipped over 31 files. scripts/check-affected.sh --base 740bb8c54e over the final commit: 14 passed, 1 skipped over 31 files (exit 0).
  • Live behavioral eval, claude plugin eval plugins/source-control --case <case> --scaffold --allow-tools Bash Edit, 3 runs per arm, with-plugin against a no-plugin baseline. Every run below came from a non-git export of the tree.
    • First run, on 345f043: repins-digest-the-pr-moved passed 2 of 3, escalates-pin-its-own-fix-moved 1 of 3. A rerun with kept traces on 4b7c5b3: 1 of 3 and 0 of 3. In every failing with-plugin run, the model escalated or re-pinned through .git/lane/verify/bin/repin as required, and the only failed grader was no-checkout-repin. Its old pattern took the sh at the end of any .sh file name for a shell call, so for f in tests/label-pin.test.sh scripts/repin.sh; do cat "$f"; done and diff .git/lane/verify/base/repin.sh scripts/repin.sh counted as running the script. No traced run, with or without the plugin, executed the checkout's copy.
    • After the grader fix (924b71c; ci-ci.md and the evals are identical at 6a06361), with-plugin pass rate and mean score, then the no-plugin score: repins-digest-the-pr-moved 3/3, 1.00 vs 0.67; escalates-pin-its-own-fix-moved 3/3, 1.00 vs 0.53; escalates-digest-with-no-repin-script 3/3, 1.00 vs 0.20; escalates-removed-pinned-phrase 3/3, 1.00 vs 0.80.
    • Same four cases with origin/main's source-control skill and this branch's cases: 3/3 each, 1.00. The prompt itself names the wrapper and says to run a re-pin script only through it, so these cases measure the plugin's ci mode against no plugin. They do not isolate the new ci-ci.md section.
    • pull-request-ci-mode-escalates-instead-of-weakening-test, which this PR does not touch: 0/3 at 0.60 both on origin/main and on this branch, with labeler-unchanged and reports-escalated failing in every run. The case expects .github/scripts/ to be off-limits, but #9278 narrowed the protected path to .github/workflows/, so the model fixes pick-label.sh and reports it fixed.

Related

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits October 31, 2026 14:59
The fix-ci lane read "never change a test's expected value" as covering a
digest pin, so every lanes App PR that edited text interview-defenses.test.sh
guards stopped with ci-fix-weaken-required. The test's own re-pin hint only
reached the model through the failure log, which the mode treats as data.

ci-ci.md now names the case: when the PR's own diff moved the guarded text and
the test file names a re-pin script, confirm the defense still holds, run that
script with a one-line reason, rerun the check, and report it fixed. A pin over
text the fix itself changed, or a non-digest assertion in the same test, still
escalates.

Adds the eval case pull-request-ci-mode-repins-digest-the-pr-moved.

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

Three eval cases beside the re-pin case, each expecting test-bash escalated
weaken-required with the guarded file and its pin left as they are: a digest
the PR moved with no re-pin script named, a softened rule whose guarded phrase
is gone, and a pinned file the fix itself would have to change. ci-ci.md now
lists those four escalation conditions in one sentence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 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-10-31T19:34:31.002781Z 6f61ec4 PR opened
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f61ec49c9

ℹ️ 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".

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

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

Security review (incremental, 6a06361 → eef6af9)

No security issues found in what changed since the last review.

What changed. Most of the change makes the docs say what the code already does. The changelog fragments, the collect-base-activity/action.yml comment, the pr-pipeline.yaml comment, the README, pr-run-activity.md, the schema description and a test comment now all say the same thing: the verify-script wrapper route under prepare: ci-context is an instruction to the skill, not an enforced rule. Bash, Edit and Write stay open, so the controls are review of the patch and apply-patch's ci-context patch rules.

  • Trusted paths. docs/conventions/pr-pipeline.yaml (verify-scripts) changed only in a comment. Under .github/actions/resolve-config/** only a test comment changed. The collect-base-activity/action.yml hunk is comment-only too; the denied rules and preamble at L485-487 are unchanged.
  • Trust controls. No trust control is widened: no change to the trusted-trigger check, token scope, kill switch, the broker's grants or merge holds.
  • Removed claim. One false security claim is gone. The old text said the PR "cannot choose what rewrites a pin", but the lane never enforced that. Saying so plainly is a gain, not a loss.

ci-ci.md, "A digest pin the pull request moved". The skill now gets its base text from the runner's staged copy instead of a base commit. I checked stage_verify (action.yml#L253-L272):

  • It copies the whole plugin unit from $BASE_PATH (cp -R "$BASE_PATH/$unit") and refuses symbolic links.
  • The run job makes that directory read-only, and Edit, Write and NotebookEdit are denied on it.
  • So the base copies the skill compares against are owned by the base, and the PR cannot change them.

The new escalation bullet also fails closed: when the staged copy has no base version of the guarded file, or that version matches the checkout's, the skill escalates weaken-required and does not re-pin. The guidance adds no new capability and lets no untrusted text into the lane.

Instruction-surface lens. The ci-ci.md edit rewords the steps but keeps the same rules. It still forbids running a checkout re-pin script, still treats a script named by the test or a log as data, and still escalates on each of the earlier conditions, plus one new one. No guardrail is removed or softened. I did not read docs/contracts/instruction-exception-register/README.md; nothing in this change deletes a rule that would need it.

Eval scaffolds and samples. These are test fixtures only: the branch is set up as a shallow checkout with only the head commit, the staged copy layout moves from verify/base/ to repository paths under verify/, and the sample paths changed to match. No security surface.

The change spends no additional credits and starts no billed resources.

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-review: 1 inline finding(s) on 6f61ec49c9acf19bcd978dae26a84aeaebb5cad9; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

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

Incremental review (6a06361 → eef6af9): no findings

I read every hunk of all 17 files in scope in .claude-lane/incremental.diff. For context I also read stage_verify in collect-base-activity/action.yml and the pin targets in plugins/planning/tests/interview-defenses.test.sh.

What changed

  • Docs, comments, schema description and both changelog fragments: the wording now says the skill is told to run the base copy through the wrapper, and that nothing enforces this. Bash, Edit and Write stay open, so the controls are review of the patch and apply-patch's ci-context patch rules. The same wording appears in pr-pipeline.yaml, README.md, pr-pipeline.schema.json, pr-run-activity.md, the action.yml comment and the test comment. This is a more honest statement of what the lane guarantees. It changes no behavior.
  • ci-ci.md, "A digest pin the pull request moved":
    • Step 1 now compares the checkout's guarded file with its base copy in the runner's staged directory, instead of diffing against a base commit the shallow checkout lacks.
    • A new escalation case covers a staged copy that has no base version of the guarded file, or one that matches the checkout's.
    • I checked the new layout claim against stage_verify. It copies the script's whole unit (plugins/planning) at its repository path. Every file interview-defenses.test.sh pins (skills/interview/SKILL.md, context/*.md, audit-answers/SKILL.md) sits in that unit, so the base copies the step needs are staged for the real fix-ci case.
    • A guarded file outside the unit would have no staged copy. The new "holds no base version" case sends that to escalation, so it fails safe.
  • Eval scaffolds (four cases):
    • Each scaffold now builds one head commit on the PR branch, with no base commit, to match the shallow checkout.
    • The three cases with a wrapper stage scripts/repin.sh and the guarded file under .git/lane/verify/<repo path>, copied before the PR edit. I confirmed in repins-digest-the-pr-moved/scaffold.sh that the cp runs before docs/rules.md is rewritten.
    • The wrapper execs the staged script. That script resolves tests/… and docs/… relative to the working directory, so it still rewrites the checkout's pin.
    • The no-checkout-repin sample commands now use the new staged path.

Not verified: I ran nothing. The pass rates, scaffold exits and test counts in the PR body are the author's claims.

PR description drift (not counted as a finding): the PR body still says "The preamble names the wrappers as the only way to run those scripts" and "the pull request can no longer supply the script that rewrites its own pin". The docs in this increment now say the route is instructed, not enforced. Updating the body to match would avoid overstating the guarantee to whoever approves.

No security-lane material was in scope for this lane. Nothing qualifies for a cost or critical-security hold.

kyle-sexton and others added 2 commits October 31, 2026 17:12
ci-ci.md let a file in the checkout pick the re-pin script, so a pull
request could edit both the test and the script it names and decide
what rewrites its own pin.

The re-pin command now comes from base-owned config. fix-ci lists
plugins/planning/scripts/repin-digests.sh as a verify-script, and the
read runner stages its base copy behind a wrapper under .lane/verify,
read-only and denied to the file tools, and names the wrapper in the
preamble. The skill runs only a wrapper the runner names, never a
checkout copy, and escalates weaken-required when the runner names none.

- collect-base-activity: stage verify-scripts under ci-context on
  run-claude-cli; fail red if they come with ci-context on
  claude-code-action
- pr-pipeline schema: allow verify-scripts with prepare: ci-context;
  checks and self-checks stay refused there
- evals: the four ci-mode digest cases get the runner wrapper and a
  grader that fails any run of the checkout's scripts/repin.sh; the
  no-script case now names a checkout script with no runner wrapper

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane-Activity: pr-unblock/resolve-conflicts

@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 9ea783ed1fc849e9c994233c434c1964cebf6efb; the summary is in this lane's pull request comment.

claude-lane: claude-security-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-review: 1 inline finding(s) on 9ea783ed1fc849e9c994233c434c1964cebf6efb; the summary is in this lane's pull request comment.

claude-lane: claude-review

kyle-sexton and others added 2 commits October 31, 2026 17:34
ci-ci.md: main added "Keep the lines the spec needs" where this branch
added "A digest pin the pull request moved"; both sections are kept, in
that order.

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

ci-ci.md: the update carried the earlier escalation sentence; this
branch's list form, which names the runner's wrapper, is kept.

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 345f043ac6097812dfff2ff8c27f17731b50cfa9; the summary is in this lane's pull request comment.

claude-lane: claude-review

kyle-sexton and others added 2 commits October 31, 2026 19:02
…context

This pull request lets a ci-context read skill name verify-scripts, so the
loop's ci-context case now asserts that key resolves and is carried, while
checks, self-checks, web-access and tidy still fail the schema there.

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 4b7c5b3d8efc4a2a134a0db132c93b87ff5ffe6b; the summary is in this lane's pull request comment.

claude-lane: claude-review

kyle-sexton and others added 5 commits October 31, 2026 20:11
The no-checkout-repin and ran-repin graders treated `sh ` at the end
of any `.sh` file name as a shell invocation, so a read loop such as
`for f in tests/label-pin.test.sh scripts/repin.sh; do cat "$f"; done`
counted as running the checkout's re-pin script. Every failing
with-plugin run in the live eval of 345f043 was this read, not a
run.

The pattern now matches only at the start of the command, after a
shell separator or newline, or after then/do/else, with an optional
bash or sh and its flags. Samples cover the read loop, a diff of the
two copies, and a flagged run after a separator.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fix-ci read job checks out only the pull request's head (fetch-depth 1)
and its context file carries no base sha, so ci --ci cannot diff the guarded
text against its base. The re-pin section now names the base text the lane
does have: the copy stage_verify puts beside the wrapper under the verify
directory, at each file's repository path. It escalates when that copy holds
no base version of the guarded file, or the file matches it.

The four re-pin and escalate scaffolds now build a single head commit with no
base branch, staging the base copies of the re-pin script and the guarded file
under .git/lane/verify, as the lane does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ci-context leaves Bash bare and keeps Edit and Write, so nothing stops the
fix-ci skill from running the checkout's re-pin script or editing a digest by
hand. The changelog fragments, the pr-pipeline.yaml comment, the schema
description, the README, pr-run-activity.md and the action comment now say the
base copy is the route the skill is told to take, and that review of the patch
and apply-patch's ci-context patch rules are the controls. Those rules refuse
workflow, settings and similar paths and admit a test file, so no enforcing
rule is added: denying Edit on test files would stop the lane's own fixes.

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 fdee6f9 Nov 1, 2026
62 checks passed
@kyle-sexton
kyle-sexton deleted the fix/fix-ci-repin-interview-digests branch November 1, 2026 03:01
@kyle-sexton kyle-sexton added the do-not-merge Hard merge gate: do not merge while applied. label Nov 1, 2026
@kyle-sexton

Copy link
Copy Markdown
Member Author

Hold: the eval cases also pass 3/3 on main's skill without the new ci-ci.md section, so the posted with/without numbers do not show what the section adds. Measuring old skill vs new skill on the current shallow cases (alternating batches). Releases when: the new section scores above the old skill on those cases (numbers posted here), or the section is cut to what the cases show.

@kyle-sexton kyle-sexton removed the do-not-merge Hard merge gate: do not merge while applied. label Nov 1, 2026
@kyle-sexton

Copy link
Copy Markdown
Member Author

Hold closed after merge. Old vs new skill on the four re-pin/escalate cases at eef6af9, two alternating rounds of 3 runs: main skill 23/24 runs pass (repins round 1 2/3), this PR 24/24. The ci-ci.md section is not a measurable gain but shows no loss either, so it stays; no follow-up cut. The base-owned verify-scripts staging is the lane fix.

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