Skip to content

fix: grant Pi trust and verify launch readiness - #7

Merged
jjtylr merged 15 commits into
mainfrom
fm/fm-pi-trust-readiness-f1
Sep 18, 2026
Merged

jjtylr merged 15 commits into
mainfrom
fm/fm-pi-trust-readiness-f1

Conversation

@jjtylr

@jjtylr jjtylr commented Sep 18, 2026 •

Copy link
Copy Markdown
Owner

Intent

Fix the recurring condition where workers sit indefinitely at “trust this folder” while the supervisor believes they launched. Trust is consistently granted for Firstmate-created isolated copies of registered projects; a fresh path must not require manual intervention or remain unnoticed. A worker launch is not successful until the worker is actually processing its instructions.

What Changed

  • Grant per-launch Pi/Pi-signed project trust only for canonical ship/scout launches from strictly registered projects and repository-matched isolated worktrees, while rejecting executable harness strings that could bypass the verified templates.
  • Gate spawn and relaunch success on a generation-bound lifecycle receipt proving Pi started processing the token-matched launch brief; failed readiness cleans up fresh endpoints or stops the failed relaunch while preserving its reusable endpoint.
  • Add portable and opt-in live regression coverage for trust overrides, readiness evidence, stale or mismatched events, isolation checks, and failure cleanup, with aligned operator documentation.

Risk Assessment

✅ Low: Captain, the implementation is bounded to verified canonical Pi launches and now proves that the token-bearing launch message reached Pi’s processing lifecycle before reporting success; the surrounding cleanup, repository-identity, registry-validation, busy-state, and operator-documentation paths are internally consistent.

Testing

Inspected the target diff, ran focused behavioral and strict-registry checks, verified real Pi’s non-persistent approval semantics, drove successful and missing-readiness Firstmate launches plus adversarial project/command refusals, captured CLI and persisted-state evidence, and cleaned all transient test state; no screenshot was needed because the changed surface is a headless launch contract rather than visual layout.

  • Live validation: ✅ go - 5 of 7 scenarios driven live against the product
Scenario Result Live Evidence
A fresh registered isolated copy receives launch-local Pi trust without manual intervention or a persisted trust decision ✅ pass live fm-spawn-real-pi-authenticated.log and fm-spawn-real-pi-state.json show the project extension loaded from the isolated Treehouse copy under policy never, while the saved trust store remained emp…
Firstmate reports launch success only after the exact token-bearing instructions begin processing ✅ pass live fm-spawn-real-pi-state.json records event=launch-message-start and a readiness receipt matching the current busy generation before fm-spawn-real-pi-authenticated.log reports spawned.
Missing processing evidence fails the launch instead of producing an unnoticed false success ✅ pass live fm-spawn-real-pi.log records the bounded timeout and contains no successful spawn result when credential-empty Pi never began the launch message.
Unregistered projects and same-named clones outside the registered path are refused before worker launch ✅ pass live fm-spawn-unregistered-refusal.log and fm-spawn-wrong-clone-refusal.log show exit 1 before task metadata publication.
Wrapped or executable worker commands cannot bypass the verified canonical Pi path ✅ pass live fm-spawn-raw-harness-refusal.log shows the wrapped Pi command was rejected with exit 1 and no task metadata.
Malformed and duplicate project-registry entries are rejected by strict validation ⏸️ untested no The prior payload recorded only a non-live focused behavior test and did not establish this result against the live product.
Pi-signed provides the same fresh-copy trust and token-bound readiness behavior ⏸️ untested no No canonical pi-signed executable is installed on PATH. Provide the verified Pi-signed wrapper plus an authenticated model configuration, then rerun the live guard and product spawn.
Evidence: Real Pi per-launch trust guard

Source: Real Pi per-launch trust guard

FM_TEST_BEGIN 2026-09-18T19:13:32Z tests/fm-pi-trust-readiness-live-e2e.test.sh family=live-harness-optin expected_gate_skip=live-capability
ok - pi 0.85.1: fresh project trust is granted only by per-launch --approve
ok - pi 0.85.1: denied project trust is granted only by per-launch --approve
ok - pi 0.85.1: never project trust is granted only by per-launch --approve
# pi-signed absent: not exercised by this run
# checked 1 installed Pi-family executable(s)
FM_TEST_END 2026-09-18T19:13:35Z tests/fm-pi-trust-readiness-live-e2e.test.sh exit=0 duration_ms=3223 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=3343
FM_TEST_SUMMARY_FAMILY family=live-harness-optin count=1 duration_ms=3223 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-pi-trust-readiness-live-e2e.test.sh duration_ms=3223
Evidence: Authenticated real Pi product launch

Source: Authenticated real Pi product launch

spawned live-pi-authenticated harness=pi kind=ship mode=no-mistakes yolo=off window=fm-lab-nm-pi-01m2t:w1:p2 worktree=~/.no-mistakes/worktrees/4ecf35ccebba/01M2TJ8ZTSPMR0BVCNED4MZPDC/.nm-live-pi-product/home/.treehouse/project-620001/1/project
Evidence: Token-bound readiness and trust state

Source: Token-bound readiness and trust state

{
  "spawn_meta": {
    "window": "fm-lab-nm-pi-01m2t:w1:p2",
    "endpoint_task_id": "live-pi-authenticated",
    "worktree": "~/.no-mistakes/worktrees/4ecf35ccebba/01M2TJ8ZTSPMR0BVCNED4MZPDC/.nm-live-pi-product/home/.treehouse/project-620001/1/project",
    "project": "~/.no-mistakes/worktrees/4ecf35ccebba/01M2TJ8ZTSPMR0BVCNED4MZPDC/.nm-live-pi-product/home/projects/project",
    "harness": "pi",
    "kind": "ship",
    "mode": "no-mistakes",
    "yolo": "off",
    "tasktmp": "/tmp/fm-live-pi-authenticated",
    "model": "openai-codex/gpt-5.6-terra",
    "effort": "low",
    "busy_gen": "g1789759320.92489.9118",
    "spawn_gen": "s1789759320.89736.31350",
    "backend": "herdr",
    "herdr_session": "fm-lab-nm-pi-01m2t",
    "herdr_workspace_id": "w1",
    "herdr_tab_id": "w1:t2",
    "herdr_pane_id": "w1:p2"
  },
  "busy_state": "v1 gen=g1789759320.92489.9118 seq=3 state=busy source=pi-ext event=launch-message-start ts=1789759322",
  "busy_generation": "g1789759320.92489.9118",
  "readiness_receipt": "g1789759320.92489.9118",
  "receipt_matches_generation": true,
  "project_extension_session_start": {
    "cwd": "~/.no-mistakes/worktrees/4ecf35ccebba/01M2TJ8ZTSPMR0BVCNED4MZPDC/.nm-live-pi-product/home/.treehouse/project-620001/1/project"
  },
  "saved_trust_store_after_launch": {}
}
Evidence: Missing readiness evidence refusal

Source: Missing readiness evidence refusal

error: pi did not start processing its launch brief within the bounded readiness window; inspect window fm-lab-nm-pi-01m2t:w1:p2
warning: leaving task live-pi-product's slot claim on ~/.no-mistakes/worktrees/4ecf35ccebba/01M2TJ8ZTSPMR0BVCNED4MZPDC/.nm-live-pi-product/home/.treehouse/project-620001/1/project in place; the Treehouse project lock is no longer held, so the next spawn's claim replaces it
Evidence: Executable worker-command refusal

Source: Executable worker-command refusal

●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  1 task(s) in flight, but no watcher has a fresh beacon (last beat: never, grace 300s).
●  Trust the emitted supervision protocol for this harness; do not use shell & for watcher repair.
●  This is a supervision warning only; the guarded operation WILL still run.
●  repair missing watcher supervision with a foreground checkpoint: bin/fm-watch-checkpoint.sh --seconds 180.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
error: unknown or executable harness 'env PI_OFFLINE=1 pi'; select an exact verified canonical adapter token
exit_code=1
Evidence: Unregistered project refusal

Source: Unregistered project refusal

WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
error: project "unregistered" is not registered in ~/.no-mistakes/worktrees/4ecf35ccebba/01M2TJ8ZTSPMR0BVCNED4MZPDC/.nm-live-pi-product/home/data/projects.md
error: Pi worker trust requires exactly one valid registry entry for project unregistered
exit_code=1
Evidence: Same-named wrong-clone refusal

Source: Same-named wrong-clone refusal

WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
error: Pi worker trust requires the exact registered clone ~/.no-mistakes/worktrees/4ecf35ccebba/01M2TJ8ZTSPMR0BVCNED4MZPDC/.nm-live-pi-product/home/projects/project; refusing project ~/.no-mistakes/worktrees/4ecf35ccebba/01M2TJ8ZTSPMR0BVCNED4MZPDC/.nm-live-pi-product/rogue/project
exit_code=1
Evidence: Focused Pi trust/readiness behavior matrix

Source: Focused Pi trust/readiness behavior matrix

FM_TEST_BEGIN 2026-09-18T19:12:29Z tests/fm-pi-trust-readiness.test.sh family=backend-dispatch expected_gate_skip=none
ok - Pi and Pi-signed approve isolated ship/scout launches and prove processing without a viewport
ok - conversation trust words do not veto a current-generation processing receipt
ok - Pi readiness follows the exact token-bearing user message
ok - launch seeds, stale callbacks, stale records, and other sources cannot prove Pi readiness
ok - only exact verified canonical adapter tokens reach worker launch
ok - Pi trust accepts only the exact clone named by the project registry
ok - Pi approval is never launched when isolation validation fails
ok - Pi approval requires the isolated copy to share project repository identity
ok - failed Pi relaunch stops the process and preserves its reusable endpoint
ok - readiness interruption cleans up the launched Pi endpoint
ok - Pi launch cleanup remains owned until the final durable commit
FM_TEST_END 2026-09-18T19:13:26Z tests/fm-pi-trust-readiness.test.sh exit=0 duration_ms=56911 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=57015
FM_TEST_SUMMARY_FAMILY family=backend-dispatch count=1 duration_ms=56911 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-pi-trust-readiness.test.sh duration_ms=56911
Evidence: Strict project-registry behavior

Source: Strict project-registry behavior

FM_TEST_BEGIN 2026-09-18T19:24:57Z tests/fm-task-delivery.test.sh family=pure-contract-unit expected_gate_skip=none
ok - fm-spawn/fm-promote: authorized intent preserves exact words and refuses operator-address lines
ok - fm-spawn: every legacy worker receives scoped role instructions without changing project or primary instructions
ok - fm-spawn: a ship spawn requires a valid explicit mode and yolo before anything is created
ok - fm-spawn: scout and secondmate spawns refuse ship delivery flags
ok - fm-spawn: the brief's recorded mode and the spawn's explicit mode must agree
ok - fm-spawn: a rigor downgrade against the registered posture is announced, never blocked
ok - fm-spawn: a scout spawn resolves no delivery posture from the registry
ok - fm-promote: promotion requires the delivery contract and records it exactly once
ok - fm-promote: a symlinked task record is refused and its target is left untouched
ok - fm-promote: a promoted worker receives the same mode-specific delivery contract a briefed one does
ok - fm-project-mode maps policy annotations and strictly validates registrations
ok - fm-spawn/fm-promote: leftover Task placeholders are refused until both subsections are filled
# all fm-task-delivery tests passed
FM_TEST_END 2026-09-18T19:25:34Z tests/fm-task-delivery.test.sh exit=0 duration_ms=36581 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=36686
FM_TEST_SUMMARY_FAMILY family=pure-contract-unit count=1 duration_ms=36581 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-task-delivery.test.sh duration_ms=36581

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 5 issues found → auto-fixed (11) ✅
  • 🚨 bin/fm-spawn.sh:4685 - The criterion “A worker launch is not successful until the worker is actually processing its instructions” is narrowed by this hunk to Pi/Pi-signed. A Codex or Claude worker that exits or waits for authentication after Enter still reaches the unconditional spawned report without processing evidence. Enforce the required invariant before the shared success commit, or obtain explicit approval for Pi-only scope.
  • 🚨 bin/fm-spawn.sh:3330 - Ordinary terminal widths prevent fresh trust from succeeding. Pi 0.85.1 word-wraps its explanation: at 100 columns, packages, and execute project extensions. spans two lines, so this match fails and the worker is killed after polling. Long paths also fail because line padding survives the newline removal in pi_trust_dialog_path_matches. These defects belong to the optional selector machinery identified in R4; removing that machinery in favor of per-launch trust is the smallest remedy.
  • 🚨 bin/fm-spawn.sh:3414 - Ordinary conversation text overrides valid processing evidence. For example, a brief or response quoting “Do not trust” enters this branch even when the current generation already contains pi-ext:agent-start or agent-settled. If that text remains visible through the polling window, spawn kills a successfully started worker. This is another defect in R4’s optional selector machinery; remove its screen-text veto while retaining the lifecycle readiness check.
  • ⚠️ bin/fm-spawn.sh:1989 - Simplification: persistent trust through an interactive selector is not required by the intent. Installed Pi supports --approve for per-launch trust, as the added documentation acknowledges. The selector state machine, version allowlist, viewport prerequisite, and parallel live-test classifier add unnecessary restrictions: this preflight rejects even trusted Pi launches on cmux/Orca, and fresh paths on versions other than 0.85.1 require intervention. That contradicts “a fresh path must not require manual intervention.” Remove these components and grant trust at the validated launch boundary while retaining processing evidence.
  • ⚠️ tests/fm-spawn-dispatch-profile.test.sh:759 - The modified Pi-signed test retains six source-content-only assertions at lines 759–764: finding handler names, ctx.isIdle(), and generation arguments in generated TypeScript does not prove their behavior. These assertions are directly within the changed readiness test’s scope and violate the supplied test-quality rule. Remove the redundant string checks or execute the generated extension and assert lifecycle state, generation rejection, and notification effects using the existing behavioral driver.

🔧 Fix applied.
5 issues (4 errors, 1 warning) still open:

  • 🚨 bin/fm-spawn.sh:4685 - The requirement “A worker launch is not successful until the worker is actually processing its instructions” remains narrowed by this hunk to Pi/Pi-signed ship/scout launches. A Claude or Codex worker waiting for authentication still reaches the unconditional spawned report without processing evidence. Enforce the invariant before the shared success commit, or obtain explicit approval for narrower scope.
  • 🚨 bin/fm-spawn.sh:3330 - Ordinary terminal widths prevent fresh trust from succeeding. Pi 0.85.1 wraps its explanation at 100 columns, splitting this required substring across lines; polling then expires and kills the worker. Wrapped paths also fail because removing newlines preserves Pi's per-line padding. These defects belong to R4's optional selector machinery; removing it in favor of per-launch trust is the smallest remedy.
  • 🚨 bin/fm-spawn.sh:3414 - Conversation text overrides valid processing evidence. A worker investigating trust dialogs can produce a short reply containing “Do not trust”; this branch then ignores its current-generation agent-start or agent-settled receipt. If the reply remains visible, spawn times out and kills the successfully started worker. Remove this screen-text veto with R4's optional selector machinery while retaining lifecycle readiness verification.
  • ⚠️ bin/fm-spawn.sh:1989 - Simplification: persistent trust through an interactive selector is unnecessary because installed Pi supports per-launch --approve. The selector state machine, version allowlist, viewport prerequisite, and parallel live-test classifier exceed the required scope. This preflight rejects even trusted launches on cmux/Orca, and fresh paths on other Pi versions need intervention, contradicting “a fresh path must not require manual intervention.” Remove these components and grant trust at the validated-copy launch boundary, retaining processing evidence.
  • 🚨 bin/fm-spawn.sh:3422 - Pi's documented defaultProjectTrust="never", or a saved denial for a reused slot, returns untrusted without displaying a selector. The external -e lifecycle extension still loads and emits agent_start, so this branch reports success while project settings and extensions remain disabled. That contradicts “Trust is consistently granted for Firstmate-created isolated copies of registered projects.” Remove selector-based granting as proposed in R4 and explicitly grant per-launch trust at the validated-copy boundary.

🔧 Fix applied.
4 errors still open:

  • 🚨 bin/fm-spawn.sh:1738 - The intent limits automatic trust to “isolated copies of registered projects,” but --approve is unconditional for canonical Pi workers. fm-spawn.sh explicitly permits unregistered projects via its no-mistakes fallback, so spawning an unregistered repository now executes its protected project extensions, settings, and packages without a registry-bound authorization check. Decide whether trust should extend to every explicitly dispatched repository; otherwise verify registration before granting approval and refuse before endpoint creation.
  • 🚨 bin/fm-spawn.sh:1979 - The new raw-Pi refusal only recognizes the first non-assignment token. A supported raw command such as env PI_OFFLINE=1 pi is classified as harness env, bypasses this branch, receives neither --approve nor lifecycle verification, and still reaches the unconditional spawned report. Decide whether raw commands are outside the Pi guarantee; otherwise reject them at a boundary shell wrappers cannot bypass. I recommend making canonical --harness pi|pi-signed the only supported Pi worker path.
  • 🚨 bin/fm-spawn.sh:3313 - A Pi readiness timeout during --relaunch calls the generic backend kill, deleting the reusable tmux/Herdr endpoint. Because replacement metadata was already published, the control transaction retains a record pointing to that missing endpoint; another relaunch then cannot verify its working directory. On relaunch failure, stop and verify the Pi process using its control mechanics while preserving the endpoint; reserve endpoint deletion for failed fresh spawns.
  • 🚨 bin/fm-spawn.sh:4550 - The new readiness wait has no abort-cleanup ownership. If the spawn receives SIGINT or SIGTERM during polling, the EXIT trap rolls back metadata and busy state but does not stop the already-launched Pi process, leaving an autonomous worker with no task record. Mark launch delivery as pending before Enter and perform kind-aware process/endpoint cleanup from the EXIT path until readiness commits.

🔧 Fix applied.
3 errors still open:

  • 🚨 bin/fm-spawn.sh:1744 - The criterion “Trust is consistently granted for Firstmate-created isolated copies of registered projects” is contradicted by the unconditional --approve. fm-spawn.sh accepts arbitrary unregistered repositories (lines 2646–2651), so a Pi spawn now executes their project extensions, settings, and packages without establishing registry membership. Decide whether trust should cover every explicitly dispatched repository; otherwise verify registration before granting approval and refuse before endpoint creation.
  • 🚨 bin/fm-spawn.sh:1985 - The raw-Pi refusal still examines only the first non-assignment token. For example, --harness "env PI_OFFLINE=1 pi" is classified as harness env, bypasses this branch, receives neither --approve nor lifecycle verification, and reaches the normal spawned report. Decide whether wrapped raw commands are outside the Pi guarantee; otherwise make canonical --harness pi|pi-signed the only supported Pi worker path.
  • 🚨 bin/fm-spawn.sh:4650 - Launch-cleanup ownership ends immediately after the lifecycle receipt, before the final metadata/backlog commit. If the backlog transition fails or the process is terminated between lines 4650 and 4745, the exit path rolls back the task record and busy state but leaves the autonomous Pi worker running untracked. Keep SPAWN_PI_DELIVERY_PENDING set until the final commit succeeds, clearing it only once the worker has durable ownership.

🔧 Fix applied.
4 issues (3 errors, 1 warning) still open:

  • 🚨 bin/fm-spawn.sh:2589 - The required criterion “Trust is consistently granted for Firstmate-created isolated copies of registered projects” is contradicted: this validates only the source clone, while spawn_worktree_isolated never verifies that the eventual worktree shares its Git common directory. Its own comments acknowledge that an unrelated checkout can pass, so a stale relaunch record or two matching transient path reads can launch there with --approve, executing that unrelated repository’s project extensions. Enforce repository identity at the shared worktree-validation boundary.
  • 🚨 bin/fm-spawn.sh:1916 - The criterion “A worker launch is not successful until the worker is actually processing its instructions” remains bypassable because this is only a lexical Pi detector. For example, --harness 'p=pi; "$p"' skips p=pi as an assignment and never sees a literal Pi executable token; the pane then launches Pi without --approve, lifecycle wiring, or readiness verification and reaches the ordinary spawned report. A guaranteed remedy requires choosing between removing raw worker commands or adding runtime identity verification.
  • 🚨 bin/fm-spawn.sh:3427 - Pi cleanup relinquishes ownership before endpoint closure is proven. Fresh cleanup delegates to rovo_endpoint_cleanup, which masks every backend-kill failure with || true; after a readiness or final backlog-commit failure, metadata and busy state are rolled back even if Pi remains running. Propagate and verify closure, and retain recovery metadata until the endpoint is confirmed stopped.
  • ⚠️ tests/fixtures.sh:153 - The fake backend parses generated .pi-ext.ts source with sed to discover the busy-event command and then fabricates agent-start. This is a newly added source-content-only assertion: dead or commented matching text can pass, while a behavior-preserving TypeScript refactor can fail. Pass explicit fixture parameters or execute the generated extension and assert its observable receipt.

🔧 Fix applied.
2 issues (1 error, 1 warning) still open:

  • 🚨 bin/fm-spawn.sh:3307 - The changed readiness check treats any current-generation Pi agent_start or agent_settled event as proof that the launch brief began. With --approve, a registered project's trusted session_start extension can call pi.sendUserMessage() before Pi processes its positional launch message; that unrelated run produces this receipt, allowing spawn to commit while the launch brief is delayed or never processed. This contradicts “A worker launch is not successful until the worker is actually processing its instructions.” Bind readiness evidence to the exact launch brief or a unique launch token before accepting its following agent-start event.
  • ⚠️ bin/fm-spawn.sh:2365 - The change introduces a second project-registry matcher even though fm-project-mode.sh already owns this parsing. No intent requirement needs parallel parsing, and the two definitions now disagree on duplicates: the established parser accepts the first match while this path requires exactly one. Remove this matcher and expose strict registration validation through the existing registry owner.

🔧 Fix applied.
2 issues (1 error, 1 warning) still open:

  • 🚨 bin/fm-project-mode.sh:84 - --strict validates only the derived mode and yolo values, not the declared registry grammar. For example, - project [no-mistakes +bogus] - description succeeds because the unknown token is ignored; fm-spawn.sh then treats the project as verified and launches Pi with --approve. Reject malformed brackets and annotation tokens outside one valid mode plus optional +yolo before strict validation succeeds.
  • ⚠️ .agents/skills/secondmate-provisioning/SKILL.md:94 - The canonical-only harness parser now rejects every raw launch command, but this required operator skill still says local secondmate routes accept one; bin/fm-spawn.sh lines 255–256 also retain raw-command guidance. A firstmate following the documented procedure will issue a command that now fails before launch. Update both descriptions to the exact verified-adapter contract.

🔧 Fix applied.
1 warning still open:

  • ⚠️ bin/fm-spawn.sh:1938 - The exact-token rejection leaves the public --help contract wrong: Usage lines 4–6 still advertise launch-command for every spawn form. An operator following that help will choose a documented command that now always refuses. Remove |launch-command from those Usage lines.

🔧 Fix applied.
1 error still open:

  • 🚨 bin/fm-spawn.sh:4106 - The R15 fix expanded “bind readiness to a unique per-launch token” into an in-memory prerequisite for every later busy event. Pi reloads explicit -e extensions during /reload and rebuilds them on /new and /fork, resetting launchEstablished=false; subsequent prompts lack the one-time marker, so lines 4106 and 4110 silently discard every busy/idle transition and the supervisor can report idle while work runs. Revert this overreach to the minimal accepted fix: use the marker only for the causally matched launch-readiness receipt, while later agent_start and agent_settled events retain normal busy tracking.

🔧 Fix applied.
1 error still open:

  • 🚨 bin/fm-spawn.sh:4099 - launchPending is one global latch shared by every prompt, while agent_start carries no prompt identity. A trusted project before_agent_start handler can fire-and-forget an unmarked pi.sendUserMessage() while handling the marked launch prompt: the nested unmarked callback sets the latch false, the original marked callback sets it true, and the nested run's agent_start can then consume that true value and emit launch-agent-start. Line 3308 accepts this as readiness although Pi is processing the extension message and the launch brief may never start. This contradicts “A worker launch is not successful until the worker is actually processing its instructions.” Bind readiness directly to a lifecycle event carrying the token-bearing user message, such as Pi's message_start, or another per-run-correlated event instead of bridging independent callbacks through a boolean.

🔧 Fix applied.
1 error still open:

  • 🚨 tests/fake-pi-worker.sh:28 - The shared fake Pi executable still invokes handlers.before_agent_start, but the generated extension now registers readiness through message_start and no longer defines that handler. Every approved invocation therefore throws before emitting readiness; the four real-Herdr suites using this fixture time out and fail. Emit the token-bearing user message_start after agent_start instead.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 7 scenarios driven live against the product
Scenario Result Live Evidence
A fresh registered isolated copy receives launch-local Pi trust without manual intervention or a persisted trust decision ✅ pass live fm-spawn-real-pi-authenticated.log and fm-spawn-real-pi-state.json show the project extension loaded from the isolated Treehouse copy under policy never, while the saved trust store remained emp…
Firstmate reports launch success only after the exact token-bearing instructions begin processing ✅ pass live fm-spawn-real-pi-state.json records event=launch-message-start and a readiness receipt matching the current busy generation before fm-spawn-real-pi-authenticated.log reports spawned.
Missing processing evidence fails the launch instead of producing an unnoticed false success ✅ pass live fm-spawn-real-pi.log records the bounded timeout and contains no successful spawn result when credential-empty Pi never began the launch message.
Unregistered projects and same-named clones outside the registered path are refused before worker launch ✅ pass live fm-spawn-unregistered-refusal.log and fm-spawn-wrong-clone-refusal.log show exit 1 before task metadata publication.
Wrapped or executable worker commands cannot bypass the verified canonical Pi path ✅ pass live fm-spawn-raw-harness-refusal.log shows the wrapped Pi command was rejected with exit 1 and no task metadata.
Malformed and duplicate project-registry entries are rejected by strict validation ⏸️ untested no The prior payload recorded only a non-live focused behavior test and did not establish this result against the live product.
Pi-signed provides the same fresh-copy trust and token-bound readiness behavior ⏸️ untested no No canonical pi-signed executable is installed on PATH. Provide the verified Pi-signed wrapper plus an authenticated model configuration, then rerun the live guard and product spawn.
  • bin/fm-spawn.sh --help plus version/availability probes for Pi 0.85.1, Herdr 0.9.1, Treehouse 2.3.0, Node, and jq
  • bin/fm-test-run.sh tests/fm-pi-trust-readiness.test.sh
  • FM_PI_TRUST_READINESS_LIVE=1 bin/fm-test-run.sh tests/fm-pi-trust-readiness-live-e2e.test.sh
  • Real fm-spawn.sh launch with --harness pi, defaultProjectTrust=never, an authenticated OpenAI Codex model, and an isolated Herdr lab session
  • Real fm-spawn.sh refusal checks for an unregistered project, a same-named wrong clone, and --harness "env PI_OFFLINE=1 pi"
  • bin/fm-test-run.sh tests/fm-task-delivery.test.sh
  • Removed the isolated Herdr session, disposable credential copy, temporary project copies, Treehouse copy, and task temp directories; verified the source worktree remained clean
✅ **Document** - passed

✅ No issues found.

🔧 **Lint** - 1 issue found → auto-fixed ✅
  • ⚠️ linter found issues (exit code 1)

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

@jjtylr jjtylr closed this Sep 18, 2026
@jjtylr jjtylr reopened this Sep 18, 2026
…narrow fixture corrections: deterministic Git identity, registered-project and readiness setup for Pi relaunch, and normalization of Pi’s per-launch busy generation in Herdr metadata comparisons. The trust, relaunch, and real-Herdr suites now pass; repository lint and diff checks also pass
@jjtylr
jjtylr merged commit a63be45 into main Sep 18, 2026
19 checks passed
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