Repository navigation
fix(tests): resolve per-user npm tools in daemon-spawned validation shells - #4
Merged
Merged
Conversation
…hells Validation-gate shells spawned by the no-mistakes daemon carry a minimal PATH without the captain's npm prefix (~/.npm-global/bin), so tasks-axi gates skipped and gate agents improvised machine-wide binary hunts (find/mdfind over $HOME), tripping macOS TCC permission checks for Documents, Desktop, Photos, MediaLibrary, Calendar, and AddressBook attributed to the no-mistakes responsible process. tests/lib.sh now appends the fixed, well-known per-user npm bin dirs (NPM_CONFIG_PREFIX/bin, ~/.npm-global/bin) when they exist - a bounded existence check on named paths, never a scan - and owns the canonical optional-tool gate fm_test_need_tool, whose skip line names the exact install command and forbids filesystem hunts. All tasks-axi gates use it. tests/fm-test-toolpath.test.sh covers the resolution, append semantics, no-duplicate and untouched-PATH cases, and the canonical skip line.
adonis-garcia-git
added a commit
that referenced
this pull request
Aug 21, 2026
…steer drops (#5) * feat(bin): add an opt-in steer-acknowledgment contract so silent steer drops surface within minutes A steer can submit cleanly (composer verification proves submission) and still never be processed into a turn by the worker - the 2026-08-20 incident left a rebase order unprocessed for 15 minutes while supervision reported the work as under way. Close that gap with an acknowledgment layer over the existing architecture, no new daemon: - bin/fm-steer-ack-lib.sh owns durable per-order records under state/pending-acks/, the [ack=<token>] mark, ack detection against the task's status file, the watcher tick, and task cleanup. - fm-send.sh --ack (opt-in) prefixes the visible mark and arms the record before delivery; failed or unconfirmed submits discard it; secondmate, --key, and harness-command targets are refused; plain sends are unchanged. - The generated ship and scout briefs teach workers to append 'resolved [key=ack-<token>]: starting <restatement>' as the first action on a token-marked order, consistent with the keyed status grammar. - The watcher clears acked or orphaned records each cycle and queues exactly one durable actionable check wake per order unacknowledged past the window (default 180s, FM_STEER_ACK_WINDOW_SECS), enqueue-before-suppress. - Teardown clears the task's leftover records. Records are mutated only by the steer path, the watcher singleton, and teardown, so lock-refused read-only sessions never touch them. * fix(tests): gate Pi .ts-import and Kimi tomllib subtests on the local runtime's actual capabilities Four suites failed on machines whose runtimes cannot exercise them, in the same silent-capability class the per-user npm-tool fix (#4) addressed: - Node below 22.18 has no default type stripping, so subtests that dynamically import tracked .ts extensions with plain node failed with ERR_UNKNOWN_FILE_EXTENSION instead of skipping. Probe the capability once and skip with a clear reason in fm-calm-pi-extension (the missing-adapter-export subtest, which fabricates its own fake Pi package and so cannot ride the sibling package-presence gates), fm-pi-watch-extension (whole file - every subtest imports the .ts extension), and the two Pi subtests in fm-turnend-guard. - The Kimi hook fails closed without python3+tomllib (Python >= 3.11), so on an older interpreter every config-validation path collapses into the same tomllib refusal and fm-kimi-harness's accept/refuse matrix cannot run at all; skip the file with the concrete requirement named. CI with current runtimes still runs everything; only genuinely incapable environments skip, each with the exact missing capability in the reason. * no-mistakes(document): document steer-ack library in bin toolbelt inventory
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
Investigate and fix why no-mistakes pipeline runs from the firstmate repo trip macOS TCC permission checks for Documents, Desktop, Photos, MediaLibrary, Calendar, and AddressBook (observed 2026-08-20 ~18:15, log show --process tccd AUTHREQ_ATTRIBUTION naming ~/.no-mistakes/bin/no-mistakes). Investigation proved no repo script walks protected folders: the no-mistakes daemon spawns gate shells with a minimal PATH lacking ~/.npm-global/bin, so repo tests gating on bare 'command -v tasks-axi' printed 'skip: tasks-axi not found', and pipeline gate agents then improvised machine-wide find/mdfind hunts for the binary (verbatim in the run logs), traversing protected home folders; macOS attributed those accesses to the responsible no-mistakes process. The fix is deliberately repo-owned and bounded: tests/lib.sh now appends the fixed well-known per-user npm bin dirs (NPM_CONFIG_PREFIX/bin and HOME/.npm-global/bin) to PATH at source time when they exist - explicit existence checks on named paths, never a scan - and owns a new canonical optional-tool gate fm_test_need_tool whose skip line names the exact npm install command and explicitly forbids filesystem hunts, defusing future agent hunts on machines where the tool is genuinely absent. All four tasks-axi gates (fm-decision-wait, fm-decision-hold-lifecycle, fm-backlog-handoff, fm-secondmate-lifecycle-e2e) were converted to that helper. New behavioral test tests/fm-test-toolpath.test.sh (7 cases: minimal daemon-like PATH resolution, NPM_CONFIG_PREFIX participation, append-never-shadow semantics, untouched PATH when dirs are absent, no duplicate append, silent success, canonical skip line) is registered as pure-contract-unit in bin/fm-test-run.sh; the lane coverage guard passes because portable-serial is computed dynamically. Deliberate choices: append rather than prepend so per-user dirs never shadow existing PATH entries; scope limited to npm-installed tools because brew tools are already on the daemon PATH; no changes to production bin/ scripts because the watcher runs with the captain's session PATH; root causes inside the no-mistakes product itself (daemon PATH construction, no anti-scan rule in gate-agent prompts) are documented in the task report data/fm-nm-folder-scan/report.md rather than patched around. Before/after TCC evidence: under the daemon's exact PATH the HEAD test skips, the fixed test runs fully and passes, and log show over the run window shows zero protected-folder TCC checks. bin/fm-lint.sh clean; full 99-file behavior suite run: only 4 pre-existing local-toolchain failures (python3 without tomllib, Node 22.14 unable to run .ts Pi extensions) which reproduce identically on unmodified HEAD.
What Changed
tests/lib.shnow appends the well-known per-user npm bin directories ($NPM_CONFIG_PREFIX/binand$HOME/.npm-global/bin) toPATHat source time when they exist, using explicit existence checks on named paths, so npm-installed tools liketasks-axiresolve even under the daemon's minimal PATH. This stops pipeline gate agents from improvising machine-wide filesystem hunts that tripped macOS TCC permission checks on protected home folders.fm_test_need_toolwhose skip line names the exactnpm install -gcommand and explicitly forbids filesystem hunts, and converts all fourtasks-axigates (fm-decision-wait,fm-decision-hold-lifecycle,fm-backlog-handoff,fm-secondmate-lifecycle-e2e) to use it.tests/fm-test-toolpath.test.sh(7 cases covering minimal-PATH resolution,NPM_CONFIG_PREFIXparticipation, append-never-shadow semantics, untouched PATH when dirs are absent, no duplicate append, silent success, and the canonical skip line), registered in the pure-contract-unit lane inbin/fm-test-run.sh.Risk Assessment
✅ Low: The change is bounded to test infrastructure (tests/lib.sh, four gate conversions, one new behavioral test, one runner family registration), implements exactly the intent's required bounded existence-check semantics with correct quoting, dedup, and append-never-shadow behavior verified against the runner's skip detection and hermetic suites, and contains no forbidden scanning or production-script changes.
Testing
Exercised the change end-to-end by reproducing the daemon scenario: with a minimal system-only PATH (tasks-axi installed solely in ~/.npm-global/bin, as on this machine), the base commit's decision-wait gate printed the bare skip line that previously invited machine-wide binary hunts, while at the target commit the same gate and all three other converted tasks-axi suites resolved the tool through lib.sh's bounded per-user dir append and passed fully; the new 7-case toolpath contract test passed, the runner coverage guard accepted the new registration, and the absent-tool path emitted the canonical skip line naming the install command and forbidding filesystem searches. The downstream TCC-attribution claim itself was not re-measured since it requires a live pipeline gate-agent run (out of scope for this phase); the repo-side causal mechanism it depends on is what was demonstrated. No transient artifacts remain in the worktree.
Evidence: Before/after transcript: daemon-like PATH, base skips vs fixed runs, canonical skip line
=== BEFORE: base 0497a53, fm-decision-wait.test.sh under daemon-like PATH === skip: tasks-axi not found === AFTER: target 9435911, same PATH === ok - captain-hold wait-start recorded at first observation and preserved on re-scan ... (all 10 cases pass) === AFTER: absent-tool gate === skip: some-absent-tool not found on PATH or in the known per-user tool dirs (install with: npm install -g some-npm-package; never search the filesystem for it)Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
tests/lib.sh:70- Bare optional-tool skip gates remain for non-npm tools (herdr, jq, tmux, treehouse, cmux - e.g. tests/fm-backend-herdr-smoke.test.sh prints 'skip: herdr not found' with no anti-hunt language), so a gate agent could in principle still improvise a filesystem hunt when one of those tools is genuinely absent. This matches the intent's explicitly bounded scope ('scope limited to npm-installed tools because brew tools are already on the daemon PATH') and the deeper root cause (no anti-scan rule in gate-agent prompts) is documented as a no-mistakes product issue, so this is an acknowledged residual, not a defect in this change. Adopting fm_test_need_tool for those gates is an optional follow-up, not a blocker.✅ **Test** - passed
✅ No issues found.
bash tests/fm-test-toolpath.test.sh- all 7 cases pass (minimal-PATH resolution, NPM_CONFIG_PREFIX participation, append-never-shadow, untouched PATH when dirs absent, no duplicate append, silent success, canonical skip line)Before/after reproduction under a daemon-like PATH lacking ~/.npm-global/bin (env -i HOME=... PATH=<system+nix dirs only> bash tests/fm-decision-wait.test.sh): at base commit 0497a53 it prints the bareskip: tasks-axi not found; at target 9435911 it resolves tasks-axi via the appended per-user dir and passes all 10 casesenv -i ... bash tests/fm-backlog-handoff.test.shunder the same daemon-like PATH - runs fully, ALL TESTS PASSEDenv -i ... bash tests/fm-decision-hold-lifecycle.test.shunder the same daemon-like PATH - runs fully and passesenv -i ... bash tests/fm-secondmate-lifecycle-e2e.test.shunder the same daemon-like PATH - the handoff phase executes (no skip) and all phases passbin/fm-test-run.sh --check-coverage- coverage guard passes (100 files) with fm-test-toolpath.test.sh registered in the pure-contract-unit familyManual check of the canonical skip line for a genuinely absent tool: namesnpm install -g <pkg>and explicitly forbids filesystem hunts✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.