Repository navigation
fix(bin): let verified harness ancestry outrank retained markers (#3) - #3578
Merged
Merged
Conversation
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (3): Last reviewed commit: "fix(bin): let verified harness ancestry ..." | Re-trigger Greptile |
Closes #3517
What Changed
bin/fm-harness.shtreated a verified environment marker (CLAUDECODE,CURSOR_AGENT, etc.) as unconditionally authoritative when detecting which harness owns the current session. A Codex session started from an environment that had retainedCLAUDECODE=1was detected as claude, so session start emitted Claude's Stop-owned supervision protocol to a Codex primary and blocked every turn end for missing Claude recovery. codex, opencode, kimi, and muse publish no identity marker at all, so any retainedCLAUDECODErenamed them - this was a precedence boundary defect, not a single-harness bug.Markers and process ancestry are now separate evidence layers arbitrated by
detect_own:pi-signedis not flattened topi);The correction is symmetric (a retained
CURSOR_AGENTno longer renames a nested claude worker either), and extends to two related walks that shared the same underlying defect:pscall with no false-positive risk.bin/fm-session-lock-lib.sh's andbin/fm-sessionstart-nudge.sh's own ancestry walks (session-lock recognition and the re-read nudge), fixed the same way.fm-harness.shgains anancestry-subtreemode that asks the walk from the pane process and every descendant, requiring comm-strength evidence somewhere in that set.tests/fm-harness-precedence.test.shis the portable regression: built from real renamed processes with no harness installed, every case drives the two evidence layers apart and asserts each alone as well as the combination, and pins Codex's real two-process install topology since the fix depends on the native binary being what a tool subprocess meets first.docs/verification/runtime-backends.mdrecords real evidence from a Codex session undercodex sandboxholding a retained Claude marker (codex-cli 0.152.0 before/after), including the PID-namespace case the first fix round's evidence didn't yet cover.Risk Assessment
✅ Low: the change narrows an over-broad "marker always wins" rule to a principled precedence layering, backed by a portable regression suite built from real process shapes (not mocked harness output) plus a live-verified before/after record. Documentation (
.agents/skills/harness-adapters/, the codex/opencode/kimi/cursor/muse references,docs/verification/runtime-backends.md) is updated to match the corrected contract.Testing
bash tests/fm-harness-precedence.test.shand the other touched suites (tests/fm-cursor-harness.test.sh,tests/fm-kimi-harness.test.sh,tests/fm-secondmate-harness.test.sh,tests/fm-session-lock-ancestry.test.sh,tests/fm-sessionstart-nudge.test.sh,tests/fm-guard-stale-banner.test.sh,tests/fm-turnend-guard.test.sh,tests/fm-watcher-lock.test.sh,tests/fm-x-mode.test.sh) pass in full.Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ Intent recorded for the run.
✅ **Rebase** - passed
✅ Rebased onto current upstream
main. The branch was rebuilt from this PR's own commits only, dropping an add-then-remove commit pair that would otherwise have reverted an upstream change. Conflicts inbin/fm-harness.shandbin/fm-test-run.shwere resolved by keeping both sides, including carrying the upstreamagyancestry match into the new process-verdict walk.✅ **Review** - passed
✅ One finding fixed in round 1: the
agyharness test still asserted the old marker-wins behavior and was vacuous under the new precedence. Fixed to expectagyfrom a real ancestry stub, withagyadded to the precedence suite and its adapter reference. The re-review found no further issues.✅ **Test** - passed
✅ No issues found. The precedence suite, the
agytest, and the sibling harness suites touched in the diff pass.✅ **Document** - passed
✅ One stale marker description in the kimi adapter reference was corrected; no unresolved documentation items.
✅ **Lint** - passed
✅ No issues found.
fm-lint.sh: ShellCheck 0.11.0 (pinned), local changed-file mode.fm-lint-workflows.sh: actionlint 1.7.12 (pinned), 3 workflow files valid.ℹ️ **Push** - by the PR author
The pipeline's push step stopped before pushing because its bot identity cannot edit a pull request opened by the personal account. The PR author then pushed the exact pipeline-validated head
4771aed8bc0d2987dbd119238c154b4ccd615daband wrote this attestation from the run's actually completed steps above (run01M2CECTYE6T2AD376XWNEXNF0). The push step is therefore not listed as a completed pipeline step.