feat: enforce deterministic delegated Pi profiles#966
Open
BazsaX254 wants to merge 22 commits into
Open
Conversation
added 22 commits
July 23, 2026 23:46
Author
|
Maintainers: this forked PR's CI and Require no-mistakes workflows are awaiting approval (runs 30074245249 and 30074245201). Please approve them when convenient so validation can proceed. Thank you. |
Author
|
@kunchenguid could you please approve the two pending workflow runs for this fork PR? Both CI and the no-mistakes requirement are blocked before execution by GitHub's fork-workflow approval step. The exact runs are 30074245249 and 30074245201. Thanks. |
This was referenced Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Implement FirstMate-owned deterministic delegated Pi profile enforcement for Pi workers, scouts, helper routes, batches, supported secondmates, and recovery across tmux, Herdr, Zellij, Orca, and cmux, while leaving the primary Pi path xhigh. The opt-in operator-owned home profile must pin Pi 0.81.1, an exact model and effective context metadata, explicit medium thinking, and compaction at exactly 60 percent using reserveTokens = contextWindow - floor(0.60 * contextWindow), failing closed before launch on ambiguity, hostile environment/project/extension surfaces, raw launch wrappers, override/model cycling, or unsupported routes. Preserve only required FirstMate extensions, keep existing backend refusals, avoid KING-specific shared policy, and provide provider-free portable tests with overridable Pi/package/compiler discovery, exact local 272000 context and 108800 reserve proof, strict greater-than boundary behavior, resume stability, primary xhigh separation, and full backend coverage. This replacement branch also fixes the sole confirmed PR 877 CI failure by including fm-operational-input.sh in the synthetic current-main backend baseline used by tests/fm-backend.test.sh, without changing runtime behavior. Do not invoke a model or live Pi worker, mutate Herdr lifecycle, global Pi state, production configuration, close PR 877, merge anything, or add an agent co-author.
What Changed
Risk Assessment
✅ Low: The corrective changes address the prior findings, provide a genuine xhigh primary Pi launcher, preserve delegated-profile isolation, and introduce no material source-verifiable risks.
Testing
Provider-free tests demonstrated Pi 0.81.1 enforcement, exact 272000/108800 arithmetic, strict greater-than 60% compaction, resume stability, hostile-input refusal, protected extensions, primary xhigh separation, all five backend handoffs, batches, and secondmate recovery/inheritance. The synthetic-current-main backend regression passed after supplying its absent
tasks-axiprerequisite. The optional TypeScript compiler check skipped becausetscwas unavailable, but executable runtime guard coverage passed. This is CLI-only behavior, so transcript artifacts—not screenshots—are the appropriate reviewer evidence.Evidence: Pi profile end-to-end evidence
Evidence: Spawn enforcement evidence
Evidence: Backend CI-recovery evidence
Evidence: Secondmate inheritance evidence
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
🔧 **Rebase** - 1 issue found → auto-fixed ✅
bin/fm-spawn.sh- merge conflict rebasing onto origin/main🔧 Fix applied.
✅ Re-checked - no issues remain.
🔧 **Review** - 5 issues found → auto-fixed (2) ✅
bin/fm-spawn.sh:446- The Pi templates add__PIBRIEFENV__, but no substitution defines or removes it. Every profiled and ordinary Pi launch therefore attempts to execute a command literally named__PIBRIEFENV__and fails before Pi starts.bin/fm-pi-profile.sh:95- This contradicts “Do not ... mutate ... global Pi state [or] production configuration.” The validator executespi --version; Pi 0.81.1 runs migrations before processing that flag, and this call neither preloads the startup guard nor pinsPI_CODING_AGENT_DIR. It can therefore migrate the caller's project or ambient Pi configuration during validation. Read the resolved package metadata instead, or isolate this invocation identically to launch.bin/fm-spawn.sh:446- The required fail-closed handling of “hostile ... extension surfaces” is incomplete for Pi secondmates. The template explicitly loads supervision extensions from the secondmate worktree, while the surrounding recovery path deliberately launches dirty or diverged homes unchanged. Modified files at these paths therefore execute as trusted extensions. Verify their bytes against FirstMate-owned sources or load protected copies before launching.tests/fm-pi-compaction-profile.test.sh:355- The required “full backend coverage” is not provided: this loop only grepsfm-spawn.shfor backend case labels and the common handoff text. It never drives a profiled Pi spawn through Herdr, Zellij, Orca, or cmux, so backend-specific ordering or rendering failures remain untested.tests/fm-pi-compaction-profile.test.sh:365- The required portable proof of “primary xhigh separation” is optional and silently skipped unless an externally suppliedFM_PI_PRIMARY_LAUNCHERis set; no repository CI configuration supplies it. The default test run therefore does not verify that the primary remains xhigh.🔧 Fix: Harden delegated Pi validation, extensions, and backend coverage
2 issues (1 error, 1 warning) still open:
tests/fm-pi-compaction-profile.test.sh:454- The required portable test of “primary xhigh separation” still does not exercise a primary Pi path: it invokesfm-spawn.sh, whose contract is exclusively to spawn direct reports, with no delegated profile and labels that worker “primary.” This proves only that an unprofiled delegated worker accepts xhigh, not that the actual primary launcher remains xhigh.bin/fm-spawn.sh:1330- The extension-integrity fix changes Pi secondmates to load protected extensions from$FM_ROOT, but the operator documentation and launch-placeholder comments still state that they load the secondmate home's mutable copies. Update those contracts so recovery and security guidance describes the implemented ownership boundary.🔧 Fix: Enforce xhigh in genuine primary Pi launcher
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-pi-compaction-profile.test.shbash tests/fm-spawn-dispatch-profile.test.shbash tests/fm-backend.test.sh(first run identified missingtasks-axitest prerequisite)PATH=/tmp/no-mistakes-evidence/01KY8NX86C6M3E68PBHGWGPXFY/fakebin:$PATH bash tests/fm-backend.test.shbash tests/fm-secondmate-harness.test.shgit status --shortandgit diff --exit-code✅ **Document** - passed
✅ No issues found.
🔧 Fix: Suppress false ShellCheck JavaScript expansion warning
1 warning still open:
✅ **Push** - passed
✅ No issues found.