Repository navigation
Description
Context
scripts/proposal_policy.py lists the root .pre-commit-config.yaml
in PROTECTED_PATHS, so walk_diff in scripts/proposal_check.py
rejects any proposal that changes it (… is protected and cannot change), and prompt/author.md tells the agent to abstain when a fix
needs it.
That is the right default: the file decides which gates run, and an
agent that could edit it could switch off a check its own change fails.
But it leaves a class of legitimate work no run can do. On 2026-11-22
run https://github.com/lfreleng-actions/github-code-monkey-bot/actions/runs/45085142472
was dispatched against eight issues that remove the pytest hook
from .pre-commit-config.yaml (tests now run in CI alone, and the
organisation is moving pre-commit execution off pre-commit.ci). Seven
abstained and one was rejected, all for this reason alone:
- Chore(pre-commit): Remove the pytest hook dependamerge#661
- Chore(pre-commit): Remove the pytest hook gha-workflow-linter#503
- Chore(pre-commit): Remove the pytest hook github2gerrit-action#575
- Chore(pre-commit): Remove the pytest hook lftools-uv#1133
- Chore(pre-commit): Remove the pytest hook markdown-table-fixer#431
- Chore(pre-commit): Remove the pytest hook pull-request-fixer#461
- Chore(pre-commit): Remove the pytest hook python-nss-ng#315
- Chore(pre-commit): Remove the pytest hook source-clone-action#423 (rejected by the publisher)
More of the same is coming as repositories migrate off pre-commit.ci.
Decision
Gate .pre-commit-config.yaml edits behind an operator switch, exactly
as #143 gated workflow edits, and bound what a revision round may widen.
1. New proposals: an allow_precommit_config_edits input
- Add a boolean reusable-workflow input
allow_precommit_config_edits,
defaultfalse, to.github/workflows/code-monkey.yaml. Record it in
the trusted selection (scripts/selection_document.py, beside
allow_workflow_edits), and have the publisher read it from there
alone: only a JSONtrueturns it on, as for
allow_workflow_editsinscripts/proposal_check.py. - Forward it from the callers:
code-monkey-cron.yaml(a
workflow_dispatchinput; a schedule passes no inputs, so it keeps
the defaultfalse) andtesting.yaml. The cron form has 20 inputs
today and GitHub caps aworkflow_dispatchform at 25, so this one
fits; say so in a comment beside it. - The switch unlocks one path:
.pre-commit-config.yamlat the
repository root, compared asPROTECTED_PATHScompares it today.
Every other protected file stays protected whatever the switch says,
in particular every agent instruction file (AGENTS.mdand the
rest): the switch must never let the agent rewrite its own
instructions. Do not add a general "unprotect" mechanism. - With the switch
false, behaviour is unchanged: the publisher
rejects the proposal with today's reason, extended to name the
switch (as the workflow gate's reason namesallow_workflow_edits),
and the reason reaches the issue comment. - With the switch
true, the publisher accepts the change and records
it: addchanges_precommit_configto the check (proposal_model.py
Check, the step summary, andcheck.json), and add a line to the
pull request's provenance block (provenance_blockin
proposal_policy.py) stating that the pull request changes
.pre-commit-config.yaml, the repository's lint gate, so the human
reviewer cannot miss it. - Pass the switch into the author session's runtime context, as the
workflow switch is (- pre-commit config edits: allowed/not allowed, beside- workflow edits: …incode-monkey.yaml). prompt/author.md: take.pre-commit-config.yamlout of the
unconditional protected list and give it the same runtime-context
rule as.github/workflows/: allowed, edit it; not allowed, abstain
and name it. When allowed, the agent changes only what the issue asks
of the file, and never removes, disables, skips or weakens a hook the
issue does not name.
2. Revision rounds: only if the pull request already changes it
Independent of the switch, so revise-only schedules and review-bot
hand-backs work without it, mirroring rule 2 of #143:
- A revision round may change
.pre-commit-config.yamlonly if its
pull request already changes it, relative to the base the round is
rebased onto. A round touching it otherwise is rejected, with a
reason naming the file that reaches the issue comment. - The trusted publisher decides this from the diff, never from agent
output or review text.scripts/workflow_gate.pyalready solves this
for workflow paths, including commits a round carries over and
rebases that bring in upstream changes; generalise it to a set of
gated paths (workflow files plus this one) rather than duplicating
the logic. prompt/revise.md: the agent may change.pre-commit-config.yaml
only when its pull request already changes it; otherwise it says so
in its reply and leaves the file alone.
3. Out of scope
- No change to any other protected path, to
CODEOWNERS,.gitlint,
REUSE.toml, the zizmor configurations,.aislop/or licences. - The
continuejob and the review bot's hand-back do not forward the
switch, for the reasons Gate workflow edits behind an operator switch #143 gives; revision rounds are covered by
rule 2. - No new label; nothing here is a permission an issue can grant.
Files
.github/workflows/code-monkey.yaml, .github/workflows/code-monkey-cron.yaml,
.github/workflows/testing.yaml, scripts/selection_document.py,
scripts/proposal_policy.py, scripts/proposal_check.py,
scripts/proposal_model.py, scripts/workflow_gate.py,
prompt/author.md, prompt/revise.md, README.md (beside the
allow_workflow_edits paragraph), tests/test_workflow.py
(InputContracts), the tests for the new checks, and docs/DESIGN.md:
the protected-file list in §8, §9.1, §9.2, §18.1, §18.3 and §20.3, and a
row in the §17 decisions table beside "Workflow edits". Edit existing
descriptions in place.
Acceptance
- With the switch
false(the default), a new proposal changing
the root.pre-commit-config.yamlis rejected with a reason
naming the switch, the reason reaches the issue comment, and the
agent abstains. - With the switch
true, such a proposal is accepted, the check
recordschanges_precommit_config, and the pull request's
provenance block says it changes the lint gate. - With the switch
true, a proposal changing any other protected
file (AGENTS.mdat any depth,.gitlint,SECURITY.md) is
still rejected. - A revision round changing
.pre-commit-config.yamlis accepted
only when its pull request already changes it, whatever the
switch says. - Contract tests pin that the input exists, is boolean, defaults to
false, and is forwarded bycode-monkey-cron.yamland
testing.yaml, and that thecontinuejob does not forward it. - Existing tests,
prek(including the aislop gate) and
zizmor --persona auditorpass.
Activity
Refactor(publish): Move provenance block to model
Test(publish): Expect a pre-commit config switch
Feat(publish): Gate pre-commit config edits
lf-releng-code-monkey-bot commentedon Nov 23, 2026
🐒 An AI agent has proposed a change for this issue: pull request #229 (head 8117897). The Copilot review of it is clean. An antagonistic review was requested from the review bot.
Refactor(publish): Move provenance block to model
Test(publish): Expect a pre-commit config switch
Feat(publish): Gate pre-commit config edits
lf-releng-code-monkey-bot commentedon Nov 23, 2026
🐒 Round 1: an AI agent revised pull request #229 (head c4becac). Round 1 on #229. There was one maintainer thread, and I fixed it. - Fixed: added
test_continue_job_forwards_neither_switchtotests/test_workflow.py. It asserts that the croncontinuejob names neitherallow_precommit_config_editsnorallow_workflow_edits. I confirmed it fails when a switch is added to the dispatch. The test is amended into the tip feature commit, so the chain stays at three commits. - Not rebased: the branch stays onbase_sha. No maintainer asked for a rebase and the PR is mergeable. - Checks: none were failing on the head. The unit suite,prekon the changed file andzizmor --persona auditorall pass. - Remains: Copilot's overview flags for a human that hook preservation is enforced by the prompt, not by the publisher. That is the design tradeoff #227 accepted; I made no code change for it.. The Copilot review of it is clean. An antagonistic review was requested from the review bot.