Skip to content

fix(bin): let process ancestry outrank inherited env markers in harness detection - #2677

Open
karanmrn wants to merge 7 commits into
kunchenguid:mainfrom
karanmrn:fm/hooks-runtime-scout
Open

fix(bin): let process ancestry outrank inherited env markers in harness detection#2677
karanmrn wants to merge 7 commits into
kunchenguid:mainfrom
karanmrn:fm/hooks-runtime-scout

Conversation

@karanmrn

Copy link
Copy Markdown

Summary

  • Fix harness misdetection: a codex primary that inherited CURSOR_AGENT/CURSOR_INVOKED_AS from its launch context detected as cursor and received the wrong supervision protocol, so the watcher was never re-armed (observed live 2026-08-20).
  • bin/fm-harness.sh detect_own now resolves process ancestry first; verified environment markers remain the fallback when no harness ancestor is visible. The cursor-before-claude ordering and the pi-signed refinement are preserved. Ancestry matches only exact verified executable identities (including codex-aarch64-a and kimi-code); substring, interpreter-argument, and path-component shapes never classify.
  • FM_HARNESS_ANCESTRY_BOUNDARY=<pid> is a test seam that stops the ancestry walk, so suite verdicts cannot depend on the harness hosting the suite. A leak into a real session only degrades detection to the marker fallback.
  • New behavioral regression test tests/fm-harness-detect.test.sh pins the precedence, the exact-identity boundaries, and the fallback. Existing kimi/muse expectations updated; cursor, secondmate, and turnend-guard suites pinned with the seam and marker hygiene at controlled invocations.
  • Separate test fix: the calm-pi follow-up assertion no longer races the pane render; it waits for both the captain answer and the processing result before asserting the exact count.

Validation

  • no-mistakes pipeline green at this head: review (findings fixed in-pipeline), tests, docs, lint.
  • Local: changed selection 48 scripts 0 failed; calm-pi suite alone; four targeted harness suites; six detector-consumer suites; fm-lint clean.

…ss detection

A codex primary that inherits CURSOR_AGENT/CURSOR_INVOKED_AS from the
context that launched it detected as cursor and received the wrong
supervision protocol, so nothing re-armed the watcher (observed live
2026-08-20). Ancestry is positional truth; markers are inheritable.

Detect by the parent-chain walk first and keep the verified markers as
the fallback when no harness ancestor is visible, preserving the
cursor-before-claude ordering and the pi-signed refinement inside that
fallback. Add FM_HARNESS_ANCESTRY_BOUNDARY as a test seam so suite
verdicts cannot depend on the harness that runs the suite, add a
behavioral regression test for the precedence, pin the marker-fallback
cases in the existing suites with that seam, and make the calm-pi
follow-up pane assertion wait for the settled pane instead of one
early capture.
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