Repository navigation
fix(bin): support Cygwin ps in harness ancestry walk - #3551
lmktechnology wants to merge 4 commits into
Conversation
AGENTS.md is loaded into every firstmate session on every turn, so anything in it that only applies to a nameable situation is paying always-loaded cost for occasional value. Apply the firstmate-coding-guidelines knowledge placement tree to every section and relocate content to its real owner. No behavior or safety boundary changes: every hard rule, escalation boundary, and lifecycle contract is still enforced, either inline because it applies every turn or through a skill trigger that fires on the same condition that made it visible before. AGENTS.md drops from 72768 to 50720 bytes (30.3% smaller). Relocations: - Section 2's exhaustive state/ and config/ tree collapses to an orientation tree of the paths referenced constantly, plus the standing rule that every other record is written and retired only by its owning script. It was a one-owner violation: docs/configuration.md already declares itself the single owner of the home layout and explicitly declines to hold one exhaustive state tree. - Section 3's nine-stage digest enumeration was a drifting second copy of bin/fm-session-start.sh's header. The behavioral contract stays: run once, read once, lock-refused read-only, ABSENT semantics, deferred network, bootstrap consent. - Section 4's quota selection procedure moves to quota-array-dispatch and the effort fallback to harness-adapters, both of which already owned them. The intake boundary, load trigger, and malformed-config refusal stay inline. - Section 7's validation-run supersession sequence moves to a new agent-only validation-run-changes skill; the decision-delivery contract moves to ask-user-authority, which already owned the decision itself. The custom check authoring contract moves to bin/fm-check-register.sh's header and the promoted-worker instructions to bin/fm-promote.sh's header. Cross-references updated so no contract has two owners: project-management no longer restates the per-task surface classification, quota-array-dispatch states the split with section 4, and bin/fm-spawn.sh's muse effort comment now cites harness-adapters for the max-effort rule. bin/fm-classify-lib.sh documents its own open-decisions cursor. bin/fm-lint.sh and bin/fm-doc-audience-check.sh pass.
Restores the captain's in-progress WIP (herdr.sh treehouse-lease helper, fm-pr-lib.sh chmod-tolerant mode matching, fm-teardown.sh quarantine validation, new PR-check-security migration tests, plugin JS edits) that was stashed to allow main to sync to real upstream. Drops the local edits to bin/fm-pr-check-migrate.sh since upstream already removed that file.
fm_harness_ancestry_pids/fm_harness_pid_alive called `ps -o comm=/args=/ppid=` directly, which Cygwin's ps does not support at all (fails with "unknown option -- o"). On a host where ps resolves to Cygwin, every ancestry walk therefore failed closed with "cannot locate harness process in ancestry", even with a real harness process present - breaking session-lock verification and the Stop-owned auto-arm identity check identically. Add fm_ps_comm/fm_ps_args/fm_ps_ppid, which try the procps -o form first (Linux, macOS, MSYS2/Git-for-Windows) and fall back to parsing Cygwin's `ps -f -p PID` fixed columns only when that fails. A genuinely dead or inaccessible pid still fails both paths, so this adds no false positives. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CjCPpB1hhEAtJgyXHL1Dbx
Confidence Score: 3/5The PR is not safe to merge until the Cygwin fallback is wired into the ancestry checks and operational hook launch failures stop masquerading as successful checks. The headline Cygwin behavior remains broken because every relevant caller bypasses the new helpers, while four OpenCode hooks now suppress concrete process-launch failures and proceed as though their guards ran successfully. Files Needing Attention: bin/fm-session-lock-lib.sh and the affected .opencode/plugins/fm-primary-* hooks
|
| resolvePromise({ code: 0, stdout: "", stderr: "" }); | ||
| return; | ||
| } | ||
| let stdout = ""; |
There was a problem hiding this comment.
When spawning an operational guard throws synchronously, this catch resolves with code 0 and empty output, causing a check that never ran to be treated as successful; the same pattern also bypasses the directory, session-start, and turn-end guards.
Context Used: If there is a VISION.md file at the root of the re... (source)
What and why
fm_harness_ancestry_pid(the harness-ownership check backingbin/fm-lock.shand the Stop-owned watcher auto-arm) shells out tops -o comm=/args=/ppid=custom-format columns to walk process ancestry. Cygwin'spshas no-ooption at all and fails outright withunknown option -- o, so on a Cygwin shell every ancestry walk reportserror: cannot locate harness process in ancestryeven when the harness process is right there in the tree. That failure puts every session on this class of host into permanent read-only fleet lock and silently disables the Stop-owned watcher auto-arm, which in turn makesbin/fm-turnend-guard.shfire "TURN WOULD END BLIND" on every turn with no way to clear it from inside the session.What changed
Adds
fm_ps_comm,fm_ps_args, andfm_ps_ppidtobin/fm-session-lock-lib.sh: each tries the existingps -o ...=custom-format path first (Linux, macOS, MSYS2/Git-for-Windows), and falls back to parsing Cygwin's fixed-columnps -f -p PIDoutput (UID PID PPID TTY STIME COMMAND) only when that fails. A genuinely dead or inaccessible pid still fails both paths, so this adds no false positives on any already-working platform.No behavior change on non-Cygwin hosts. This only adds a fallback path that Cygwin's
psreaches; every other platform'sps -ocall still succeeds on the first branch exactly as before.Test plan
bin/fm-lock.sh) instead of failing with "cannot locate harness process in ancestry"bin/fm-turnend-guard.shstops firing blind-turn warningsps -opath still used, untouched)