Skip to content

fix(bin): guide completed-scout cleanup and permit stock lab supervision paths - #6965

Merged
kunchenguid merged 4 commits into
kunchenguid:mainfrom
Puh00:fm/completed-scout-cleanup-guidance
Oct 15, 2026
Merged

kunchenguid merged 4 commits into
kunchenguid:mainfrom
Puh00:fm/completed-scout-cleanup-guidance

Conversation

@Puh00

@Puh00 Puh00 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What Changed

  • Direct supervision to clean up completed scouts after completion policies pass, retaining reports, claiming leases, and reporting each cleanup result separately. Embed the scout-completion and captain-hold policies in the prompt.
  • Allow production supervision's canonical root, state, and config overrides for marked lab homes while rejecting relocated paths, unsupported overrides, and symlinked directories or markers.
  • Update supervision documentation and regression coverage for prompt delivery and lab-home guard behavior.

Risk Assessment

✅ Low: The narrow guidance change uses existing completion policies and guarded cleanup, preserves refusal boundaries, and tests the emitted prompt contract without claiming model adherence.

Testing

Targeted regressions and seven live scenarios passed using a real Pi primary and production supervision branch in private namespaces. Sanitized transcripts, outcomes, state, and guard evidence were retained. No rendered UI changed. Pool-slot return and universal model adherence were not tested.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Completed scout is cleaned up after its completion gate passes, retaining its report and findings ✅ pass live Live branch commands and actual results; Endpoint and persisted-state evidence
Scout reporting completion without a report retains its task and endpoint ✅ pass live Branch outcomes; Endpoint and persisted-state evidence
Scout with a partial report remains unfinished and is preserved ✅ pass live Branch outcomes; Endpoint and persisted-state evidence
Unsafe check artifact causes its specific cleanup refusal and preserves protected content ✅ pass live Live branch commands and actual results; Endpoint and persisted-state evidence
Unanswered dataset choice and deliberate external wait remain preserved ✅ pass live Branch outcomes; Endpoint and persisted-state evidence
Marked lab accepts production supervision paths while escaping paths and invalid identities refuse ✅ pass live Guard acceptance and adversarial refusals; Revision and isolation provenance
Supervisor reports successful completed-scout cleanup without inventing a lifecycle refusal ✅ pass live Branch outcomes; Live branch commands and actual results
Evidence: Live branch commands and actual results

Source: Live branch commands and actual results

[
  {
    "role": "assistant",
    "tool": "bash",
    "arguments": {
      "command": "bin/fm-teardown.sh complete",
      "timeout": 30
    }
  },
  {
    "role": "toolResult",
    "content": [
      {
        "text": "fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB_HOME\nteardown complete complete (window fm-lab-scout-RUN:w1:p2, worktree $LAB_HOME/projects/synthetic/unallocated-complete)\nBacklog: complete just finished (config/backlog-backend selects manual editing). Update $LAB_HOME/data/backlog.md - move complete to Done, keep Done to the 10 most recent, then re-scan Queued and dispatch only work whose blockers are gone and date is due.\n"
      }
    ],
    "isError": false
  },
  {
    "role": "assistant",
    "tool": "bash",
    "arguments": {
      "command": "bin/fm-teardown.sh refusal",
      "timeout": 30
    }
  },
  {
    "role": "toolResult",
    "content": [
      {
        "text": "fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB_HOME\nREFUSED: unsafe task PR-check artifact; preserving task state.\n\n\nCommand exited with code 1"
      }
    ],
    "isError": true
  },
  {
    "role": "assistant",
    "tool": "bash",
    "arguments": {
      "command": "bin/fm-send.sh missing 'Completion is not established: write a self-contained report covering all requested observations and inventory any unresolved captain choices before reporting done.'; bin/fm-send.sh partial 'Your report covers only one of three observations. Finish the two remaining measurements and update the self-contained report before reporting completion.'",
      "timeout": 30
    }
  },
  {
    "role": "toolResult",
    "content": [
      {
        "text": "fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB_HOME\nfm-send: doorbell not typed because the agent in fm-lab-scout-RUN:w1:p3 has exited; the steer is durably recorded at $LAB_HOME/state/missing.inbox/001.msg for recovery (stuck-crewmate-recovery), and the watcher will not re-ring a dead pane\nfm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB_HOME\nfm-send: doorbell not typed because the agent in fm-lab-scout-RUN:w1:p4 has exited; the steer is durably recorded at $LAB_HOME/state/partial.inbox/001.msg for recovery (stuck-crewmate-recovery), and the watcher will not re-ring a dead pane\n"
      }
    ],
    "isError": false
  },
  {
    "role": "assistant",
    "tool": "fm_branch_report",
    "arguments": {
      "task": "complete",
      "verdict": "captain",
      "summary": "The completed synthetic investigation found three sample entries, with no implementation or captain decisions remaining; its report was retained and cleanup exited successfully. The cleanup also emitted a lifecycle allowance diagnostic, so successful endpoint closure was not independently confirmed.",
      "wake": "signal: complete.status"
    }
  },
  {
    "role": "toolResult",
    "content": [
      {
        "text": "recorded seq 1 and delivered [captain] into main"
      }
    ],
    "isError": false
  },
  {
    "role": "assistant",
    "tool": "fm_branch_report",
    "arguments": {
      "task": "refusal",
      "verdict": "captain",
      "summary": "The synthetic investigation is complete and found three sample entries, with its report retained. Cleanup refused: \u201cREFUSED: unsafe task PR-check artifact; preserving task state.\u201d",
      "wake": "signal: refusal.status"
    }
  },
  {
    "role": "toolResult",
    "content": [
      {
        "text": "recorded seq 2 and delivered [captain] into main"
      }
    ],
    "isError": false
  },
  {
    "role": "assistant",
    "tool": "fm_branch_report",
    "arguments": {
      "task": "missing",
      "verdict": "captain",
      "summary": "The synthetic investigation cannot be accepted as complete because its report is missing; no cleanup was attempted. A request to supply the report was durably recorded, but delivery reported that the worker had exited and could not be notified.",
      "wake": "signal: missing.status"
    }
  },
  {
    "role": "toolResult",
    "content": [
      {
        "text": "recorded seq 3 and delivered [captain] into main"
      }
    ],
    "isError": false
  },
  {
    "role": "assistant",
    "tool": "fm_branch_report",
    "arguments": {
      "task": "partial",
      "verdict": "captain",
      "summary": "The synthetic investigation remains incomplete: only one of three observations is documented, so no cleanup was attempted. A request to finish both remaining measurements was durably recorded, but delivery reported that the worker had exited and could not be notified.",
      "wake": "signal: partial.status"
    }
  },
  {
    "role": "toolResult",
    "content": [
      {
        "text": "recorded seq 4 and delivered [captain] into main"
      }
    ],
    "isError": false
  },
  {
    "role": "assistant",
    "tool": "fm_branch_report",
    "arguments": {
      "task": "waiting",
      "verdict": "captain",
      "summary": "The synthetic investigation remains deliberately waiting for an external sample and the captain\u2019s choice of dataset A or B. It is not complete; its report and task were preserved without cleanup or an invented answer.",
      "wake": "signal: waiting.status"
    }
  },
  {
    "role": "toolResult",
    "content": [
      {
        "text": "recorded seq 5 and delivered [captain] into main"
      }
    ],
    "isError": false
  },
  {
    "role": "assistant",
    "tool": "bash",
    "arguments": {
      "command": "bin/fm-wake-drain.sh --ack-through 5 --recovery-generation 1783.1791658099.90YV2b; bin/fm-lease.sh release complete; bin/fm-lease.sh release refusal; bin/fm-lease.sh release missing; bin/fm-lease.sh release partial",
      "timeout": 30
    }
  },
  {
    "role": "toolResult",
    "content": [
      {
        "text": "(no output)"
      }
    ],
    "isError": false
  }
]
Evidence: Branch outcomes

Source: Branch outcomes

[
  {
    "seq": 1,
    "epoch": 1791658150,
    "task": "complete",
    "wake": "signal: complete.status",
    "verdict": "captain",
    "summary": "The completed synthetic investigation found three sample entries, with no implementation or captain decisions remaining; its report was retained and cleanup exited successfully. The cleanup also emitted a lifecycle allowance diagnostic, so successful endpoint closure was not independently confirmed.",
    "silent": false,
    "statusEndpoint": 0,
    "statusIdent": "-"
  },
  {
    "seq": 2,
    "epoch": 1791658154,
    "task": "refusal",
    "wake": "signal: refusal.status",
    "verdict": "captain",
    "summary": "The synthetic investigation is complete and found three sample entries, with its report retained. Cleanup refused: \u201cREFUSED: unsafe task PR-check artifact; preserving task state.\u201d",
    "silent": false,
    "statusEndpoint": 19,
    "statusIdent": "strong:2096:975331:2026-10-10 20:48:10.228063930 +0200"
  },
  {
    "seq": 3,
    "epoch": 1791658159,
    "task": "missing",
    "wake": "signal: missing.status",
    "verdict": "captain",
    "summary": "The synthetic investigation cannot be accepted as complete because its report is missing; no cleanup was attempted. A request to supply the report was durably recorded, but delivery reported that the worker had exited and could not be notified.",
    "silent": false,
    "statusEndpoint": 19,
    "statusIdent": "strong:2096:975302:2026-10-10 20:48:10.195203368 +0200"
  },
  {
    "seq": 4,
    "epoch": 1791658165,
    "task": "partial",
    "wake": "signal: partial.status",
    "verdict": "captain",
    "summary": "The synthetic investigation remains incomplete: only one of three observations is documented, so no cleanup was attempted. A request to finish both remaining measurements was durably recorded, but delivery reported that the worker had exited and could not be notified.",
    "silent": false,
    "statusEndpoint": 19,
    "statusIdent": "strong:2096:975322:2026-10-10 20:48:10.211633648 +0200"
  },
  {
    "seq": 5,
    "epoch": 1791658171,
    "task": "waiting",
    "wake": "signal: waiting.status",
    "verdict": "captain",
    "summary": "The synthetic investigation remains deliberately waiting for an external sample and the captain\u2019s choice of dataset A or B. It is not complete; its report and task were preserved without cleanup or an invented answer.",
    "silent": false,
    "statusEndpoint": 84,
    "statusIdent": "strong:2096:975336:2026-10-10 20:48:10.244494211 +0200"
  }
]
Evidence: Endpoint and persisted-state evidence

Source: Endpoint and persisted-state evidence

{
  "state": {
    "complete": {
      "state/complete.meta": null,
      "state/complete.status": null,
      "data/complete/report.md": "# Completed investigation\n\nAll requested observations are complete. Finding: the synthetic sample has three entries. No implementation or captain decisions remain.\n"
    },
    "missing": {
      "state/missing.meta": "project=$LAB_HOME/projects/synthetic\nworktree=$LAB_HOME/projects/synthetic/unallocated-missing\nwindow=fm-lab-scout-RUN:w1:p3\nendpoint_task_id=missing\nherdr_session=fm-lab-scout-RUN\nherdr_workspace_id=w1\nherdr_tab_id=w1:t3\nherdr_pane_id=w1:p3\nbackend=herdr\nharness=pi\nkind=scout\nmode=no-mistakes\nspawn_gen=live-scout-missing\n",
      "state/missing.status": "done: report ready\n",
      "data/missing/report.md": null
    },
    "partial": {
      "state/partial.meta": "project=$LAB_HOME/projects/synthetic\nworktree=$LAB_HOME/projects/synthetic/unallocated-partial\nwindow=fm-lab-scout-RUN:w1:p4\nendpoint_task_id=partial\nherdr_session=fm-lab-scout-RUN\nherdr_workspace_id=w1\nherdr_tab_id=w1:t4\nherdr_pane_id=w1:p4\nbackend=herdr\nharness=pi\nkind=scout\nmode=no-mistakes\nspawn_gen=live-scout-partial\n",
      "state/partial.status": "done: report ready\n",
      "data/partial/report.md": "# Partial investigation\n\nOnly one of three requested observations is complete. Two measurements remain unperformed. This report is partial and the task must continue.\n"
    },
    "refusal": {
      "state/refusal.meta": "project=$LAB_HOME/projects/synthetic\nworktree=$LAB_HOME/projects/synthetic/unallocated-refusal\nwindow=fm-lab-scout-RUN:w1:p5\nendpoint_task_id=refusal\nherdr_session=fm-lab-scout-RUN\nherdr_workspace_id=w1\nherdr_tab_id=w1:t5\nherdr_pane_id=w1:p5\nbackend=herdr\nharness=pi\nkind=scout\nmode=no-mistakes\nspawn_gen=live-scout-refusal\ndecisions_reviewed=1\ndecision_keys=\n",
      "state/refusal.status": "done: report ready\n",
      "data/refusal/report.md": "# Completed investigation\n\nAll requested observations are complete. Finding: the synthetic sample has three entries. No implementation or captain decisions remain.\n"
    },
    "waiting": {
      "state/waiting.meta": "project=$LAB_HOME/projects/synthetic\nworktree=$LAB_HOME/projects/synthetic/unallocated-waiting\nwindow=fm-lab-scout-RUN:w1:p6\nendpoint_task_id=waiting\nherdr_session=fm-lab-scout-RUN\nherdr_workspace_id=w1\nherdr_tab_id=w1:t6\nherdr_pane_id=w1:p6\nbackend=herdr\nharness=pi\nkind=scout\nmode=no-mistakes\nspawn_gen=live-scout-waiting\n",
      "state/waiting.status": "input: captain must choose dataset A or B; deliberately waiting for external sample\n",
      "data/waiting/report.md": "# Waiting investigation\n\nThe captain has not chosen dataset A or B. Preserve that unanswered choice. The investigation is deliberately waiting for an external sample and is not complete.\n"
    }
  },
  "endpoints": {
    "complete": {
      "exit": 1,
      "error": {
        "error": {
          "code": "pane_not_found",
          "message": "pane w1:p2 not found"
        },
        "id": "cli:pane:get"
      },
      "present": false
    },
    "missing": {
      "exit": 0,
      "error": null,
      "present": true
    },
    "partial": {
      "exit": 0,
      "error": null,
      "present": true
    },
    "refusal": {
      "exit": 0,
      "error": null,
      "present": true
    },
    "waiting": {
      "exit": 0,
      "error": null,
      "present": true
    }
  },
  "protected_content": "protected content\n",
  "unsafe_artifact_retained": true
}
Evidence: Guard acceptance and adversarial refusals

Source: Guard acceptance and adversarial refusals

fm-gate-refuse: gate agent lifecycle permitted only against lab home $LAB_HOME
escaped-state: exit=3 error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
alternate-root: exit=3 error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
unsupported-override: exit=3 error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
noncanonical-state: exit=3 error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
symlink-home: exit=3 error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
symlink-state: exit=3 error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
missing-identity: exit=3 error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
invalid-identity: exit=3 error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
symlink-identity: exit=3 error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
Evidence: Validation scope and limitations

Source: Validation scope and limitations

# Live validation of current revision

Tested 9b7cbb41ebee29ae344649136e54ec426fb14298 with a real Pi CLI primary and the unchanged production supervision extension using GPT-6.1 Sol.
The incoming pipeline marker remained present and the managed Git source stayed unchanged.
The branch cleaned the completed scout through ordinary teardown, retained its report and findings, and reported success without the former invented refusal.
An independent endpoint query returned pane_not_found and the task metadata was absent.
The unsafe check artifact caused its specific refusal and remained intact.
Missing and partial reports, an unanswered dataset choice, and a deliberate external wait retained their task metadata and endpoints.
Nine adversarial gate calls refused escaping, unsupported, noncanonical or symlinked paths and absent or invalid identities.
The marked lab accepted production root/state/config overrides.

Targeted fm-gate-refuse and fm-branch-supervision regression scripts passed.
The named non-default Herdr lab was torn down successfully through the helper, including its default-session tripwire.
No source changes were made.

These are synthetic scout records with real Herdr endpoints and actual guarded cleanup, not allocated pool slots or active scout model sessions.
No allocated pool-slot-return or universal model-adherence claim is made.
The branch qualified that it had not independently confirmed endpoint closure; the external driver confirmed closure afterward.
The primary initially attempted an acknowledgement outside an active processing request, received a refusal, then acknowledged all five outcomes successfully when requested.
There was no rendered UI change; evidence is the actual tool transcript, branch outcomes and persisted state.
Evidence: Revision and isolation provenance

Source: Revision and isolation provenance

{
  "revision": "9b7cbb41ebee29ae344649136e54ec426fb14298",
  "managed_git_source": true,
  "incoming_gate_marker": "present",
  "bypass": "inactive",
  "tracked_diff_empty": true,
  "isolation": "private user, PID, mount, proc namespaces; overlay writes inside worktree",
  "primary": "real pi CLI, openai/gpt-6.1-sol, production fm-branch-supervision extension",
  "cleanup_exit": 0,
  "default_tripwire": "helper teardown succeeded"
}
- Outcome: 🔧 2 issues found → auto-fixed (2) → no changes applied ✅ across 4 runs (44m25s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

🔧 **Test** - 2 issues found → auto-fixed (2) → no changes applied ✅
  • ⚠️ bin/fm-gate-refuse-lib.sh:108 - Required successful cleanup remains unproven. The production Pi branch injects FM_ROOT_OVERRIDE, FM_STATE_OVERRIDE, and FM_CONFIG_OVERRIDE, but the marked-lab allowance rejects all nonempty overrides. Actual teardown therefore exits at the gate guard. Provide a supported branch-compatible lab allowance to finish validation; bypassing or changing this guard was outside this phase's authority.
  • ⚠️ live validation verdict: inconclusive (4 of 6 scenarios were driven live against the product); untested: Completed scout with a report and passed completion gate is cleaned up while retaining its findings, An unsafe check artifact triggers its specific cleanup refusal
  • Live validation: ⚠️ inconclusive - 4 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Completed scout with a report and passed completion gate is cleaned up while retaining its findings ⏸️ untested no The real Pi branch acquired the lease and invoked plain fm-teardown.sh, but the gate rejected its injected path overrides. The stock marked-lab environment passes the allowance; the production branch…
A scout claiming completion without a report remains open ✅ pass live Actual Pi supervision outcomes: missing; Retained task state
A partial investigation report preserves unfinished scratch work ✅ pass live Actual Pi supervision outcomes: partial; Retained task state
A cleanup refusal is reported accurately without forcing or bypassing it ✅ pass live Actual branch tool calls and results; Actual Pi supervision outcomes: refusal
An unanswered dataset choice and deliberate external wait remain open ✅ pass live Actual Pi supervision outcomes: waiting; Backlog with unanswered choice retained
An unsafe check artifact triggers its specific cleanup refusal ⏸️ untested no The unsafe artifact fixture was supplied to the real branch, but the gate rejected teardown before the artifact guard could run. The artifact remained intact. A supported branch-compatible lab allowan…
  • bash tests/fm-branch-supervision.test.sh passed.
  • Executed the new emitted-prompt regression against the base and target generators: base failed, target passed.
  • pi auth check --model openai/gpt-6.1-sol --no-refresh --json confirmed readiness.
  • unshare --user --map-root-user --mount --pid --fork --mount-proc --propagation private -- bash .l/run.sh drove an actual Pi primary and unchanged production supervision branch against five disposable scout records.
  • Compared fm_gate_lab_permitted with stock lab variables and production branch overrides: exit 0 versus exit 1.
  • Captured sanitized branch transcripts, outcomes, backlog, and retained task state; confirmed the private server stopped and removed all disposable worktree files.

🔧 No changes applied.
1 warning still open:

  • ⚠️ live validation verdict: inconclusive (0 of 4 scenarios were driven live against the product); untested: Completed scout is cleaned up and its report retained, Missing and partial reports preserve unfinished scouts, Unsafe check artifact causes its specific cleanup refusal, Unanswered choices and deliberate waits remain preserved
  • Live validation: ⚠️ inconclusive - 0 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Completed scout is cleaned up and its report retained ⏸️ untested no The prior live attempt hit the gate refusal. Current inspection confirms the production branch still injects overrides rejected by the marked-lab allowance. Repeating the blocked launch or bypassing t…
Missing and partial reports preserve unfinished scouts ⏸️ untested no Prior evidence records preservation, but no fresh primary was launched because the required branch-compatible lab contract remains unavailable. The recorded decision prohibits repeating known blocked…
Unsafe check artifact causes its specific cleanup refusal ⏸️ untested no The gate refusal precedes the artifact safety check. Reaching that check through the production branch requires the separately authorized lab compatibility change; guard bypasses are forbidden.
Unanswered choices and deliberate waits remain preserved ⏸️ untested no Historical observations were reviewed but not counted as current execution. A fresh integrated run awaits the supported branch-compatible lab setup.
  • git diff fb75c1f94170df7e0751147ea61afabcf5d4e104 85bef3f8126fd78636617be19e493bfb6dba7283
  • Executed test_branch_prompt_routes_completed_scouts_through_guarded_cleanup against the real prompt generator: passed.
  • Reviewed existing guard-context and live-validation evidence against current production branch environment and lab guard.
  • git rev-parse HEAD and git status --short: target revision confirmed; worktree clean.

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

  • ⚠️ bin/fm-branch-prompt.sh:74 - The completed-scout outcome falsely reports a lab-home lifecycle refusal. Actual tool output explicitly permits the operation, teardown succeeds, and the endpoint subsequently returns pane_not_found. This reporting error reproduced in three attempts, including the final run with private temporary storage and historical fixtures removed. Correct per-task cleanup reporting and repeat the live scenario; the underlying cause is not established.
  • 🚨 live validation verdict: no-go (7 of 7 scenarios were driven live against the product); failed: Supervisor reports the completed scout's actual cleanup result accurately
  • Live validation: ❌ no-go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Completed scout is cleaned up while its report and findings remain ✅ pass live Actual supervision calls and results; Real endpoint queries; Persisted reports and task state
Scout without a report remains intact and receives a report request ✅ pass live Recorded branch outcomes; Real endpoint queries; Persisted reports and task state
Scout with partial observations remains intact ✅ pass live Recorded branch outcomes; Real endpoint queries; Persisted reports and task state
Unsafe check artifact triggers its specific refusal and preserves task state ✅ pass live Actual supervision calls and results; Real endpoint queries
Unanswered dataset choice and deliberate external wait remain preserved ✅ pass live Recorded branch outcomes; Persisted reports and task state; test-final-holds.json
Production lab paths work while escaping paths and invalid identities refuse steering ✅ pass live Invalid lab configurations refused; test-final-guard.log
Supervisor reports the completed scout's actual cleanup result accurately ❌ fail live Recorded branch outcomes, completed-scout row; Actual supervision calls and results
  • bash tests/fm-gate-refuse.test.sh
  • bash tests/fm-branch-supervision.test.sh
  • bash .test-evidence/guard-live.sh against the real fm-send entrypoint
  • Three isolated real-Pi attempts; final command: unshare --user --map-root-user --mount --pid --fork --mount-proc --propagation private -- bash .test-evidence/driver-final.sh
  • Independent report, metadata, protected-file, hold-state and real Herdr endpoint assertions
  • Guarded Herdr teardown and default-session tripwire verification
  • Sanitized transcript export, transient fixture removal, and git diff --exit-code

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

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Completed scout is cleaned up after its completion gate passes, retaining its report and findings ✅ pass live Live branch commands and actual results; Endpoint and persisted-state evidence
Scout reporting completion without a report retains its task and endpoint ✅ pass live Branch outcomes; Endpoint and persisted-state evidence
Scout with a partial report remains unfinished and is preserved ✅ pass live Branch outcomes; Endpoint and persisted-state evidence
Unsafe check artifact causes its specific cleanup refusal and preserves protected content ✅ pass live Live branch commands and actual results; Endpoint and persisted-state evidence
Unanswered dataset choice and deliberate external wait remain preserved ✅ pass live Branch outcomes; Endpoint and persisted-state evidence
Marked lab accepts production supervision paths while escaping paths and invalid identities refuse ✅ pass live Guard acceptance and adversarial refusals; Revision and isolation provenance
Supervisor reports successful completed-scout cleanup without inventing a lifecycle refusal ✅ pass live Branch outcomes; Live branch commands and actual results
  • bash tests/fm-gate-refuse.test.sh
  • bash tests/fm-branch-supervision.test.sh
  • LIVE_CASE=current-head unshare --user --map-root-user --mount --pid --fork --mount-proc --propagation private -- bash .test-evidence/driver.sh
  • bash .test-evidence/guard-driver.sh
  • Driver assertions checked actual Herdr endpoints, retained reports, task metadata, protected content, and branch reporting.
  • Named Herdr lab teardown and default-session tripwire succeeded; disposable worktree files were removed.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @Puh00. A completed scout that sits "finished and idle" forever is a real gap, and routing it through the existing fm-teardown.sh gates (report present, captain-call completion gate) is the right shape.

I compared head 85bef3f8 against main fb75c1f9. The no-mistakes attestation matches this head.

CI: I reviewed the diff first (prompt generator, docs, one test; no workflow, secret, or network surface), then approved CI 37989511465 and Require no-mistakes 37989511346.

Contract-class: new-default. The supervision branch is default-on for Pi primaries, and today it only tears down confirmed-landed ships; this gives it a new autonomous action (scout teardown) in both postures, including attended. It also adds the full scout-completion and captain-hold-lifecycle skills (~1,700 words) to the branch's cached prompt. Both are reasonable, but they change what the unconfigured product does, so this goes to Kun as a merge-or-leave call, not an auto-merge.

VISION.md, rule by rule

  • One captain, one interface: aligns (less finished-scout noise).
  • Authority is explicit: cannot tell yet. Teardown still refuses without report + completion gate, but whether the branch obeys the new prose is exactly what is unverified.
  • Scripts own the mechanics: aligns; teardown script stays the gate.
  • A restart is a non-event: n/a.
  • Delegation with a spine: cannot tell; live validation is 0 of 2.
  • The fleet outlives any vendor: aligns.
  • Scope: aligns; token cost of the larger branch prefix noted.

Waiting on you, the author: live validation is missing. If you can, could you drive one real Pi primary with a completed scout (report present, gate passed) and one incomplete scout, and post the branch's outcome for each (teardown run vs refusal reported)? Re-raising through no-mistakes with that evidence works too. Thank you, no rush.

@Puh00

Puh00 commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. We have now exercised one real Pi primary with the production supervision-branch extension on 85bef3f8126fd78636617be19e493bfb6dba7283. All five scenarios passed:

  • Completed scout: ordinary guarded cleanup closed the exact live pane, removed its task record and closed its backlog item; the report was retained byte-for-byte and its findings relayed.
  • Missing report: cleanup was withheld and unfinished state preserved.
  • Partial report: the incomplete comparison was recognized and retained without cleanup.
  • Unresolved input: the decision remained unanswered and the report, pane and unfinished work were preserved.
  • Actual cleanup refusal: an unsafe task-check artifact caused the real cleanup script to refuse; the branch reported the refusal without overriding it or removing protected state.

The test used Pi 1.1.0, GPT-6.1 Sol and real named-session Herdr endpoints. The primary, branch and task processes ran in an isolated process namespace; cleanup verified the existing default session was unchanged. No cleanup function or Herdr response was mocked.

Limits: events were injected through production routing/event-bus interfaces rather than a long-running watcher. Task endpoints were synthetic shell workers, and the completed scout's scratch path was already absent, so allocated pool-slot return was not exercised. These are bounded observations of one model, not a guarantee of universal instruction adherence. Renewed full no-mistakes validation will incorporate the live evidence and replace the earlier prompt-only testing statement.

Could a maintainer rerun the cancelled Behavior portable serial 2 job? The detailed result is cancelled, with “The operation was canceled” after 30 minutes; no assertion failure was reported in the inspected log. Our account lacks upstream workflow-rerun permission. A passing replacement result is still required; these live tests do not waive CI.

Cancelled job: https://github.com/kunchenguid/firstmate/actions/runs/37989511465/job/114052348567

@Puh00 Puh00 changed the title fix(bin): guide supervision through completed scout cleanup fix(bin): guide completed-scout cleanup and permit stock lab supervision paths Oct 10, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @Puh00. This is exactly the live evidence I asked for, and it's thorough. Re-raising through no-mistakes worked too: the attestation matches head 9b7cbb41, and live validation is now 7 of 7 go.

I read the new delta since 85bef3f8:

  • Branch prompt: two lines that make each cleanup's outcome come from its own tool call, and stop an allowance diagnostic from being reported as a refusal. Fine.
  • fm-gate-refuse-lib.sh lab allowance: I read this one closely because it's a gate guard. A marked lab now also accepts FM_ROOT_OVERRIDE/FM_STATE_OVERRIDE/FM_CONFIG_OVERRIDE, but only when each one exactly equals the canonical code root or the lab's own state/config. Every other override still refuses, and it adds new refusals for a non-canonical home, symlinked stock dirs, or a symlinked marker. So no override can point the lab at a real fleet. I don't see a security risk.

There's no workflow or secret surface, so I've approved this head's fork runs: CI 38077543980, Require no-mistakes 38077543930 and 38077566284.

Contract-class: new-default (unchanged). The default-on Pi supervision branch gains completed-scout teardown in both postures, plus a larger cached prompt. VISION.md: the live evidence settles the two cannot-tells. Authority: aligns (teardown still refuses without report and completion gate, and the branch reports refusals without overriding them). Delegation with a spine: aligns. Every other rule aligns as before; restart: n/a.

Next step: waiting on CI. Nothing more is needed from you. Once CI and no-mistakes are green and it's mergeable, this goes to Kun as a merge-or-leave decision, not an auto-merge.

@Puh00

Puh00 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

@kunchenguid Thanks for reviewing the updated guard and confirming the 7/7 live validation.

The remaining CI check, Behavior portable serial 2, has timed out again on 9b7cbb41. GitHub's annotation explicitly says: “The job has exceeded the maximum execution time of 30m0s.” The inspected log contains no failed test assertion or nonzero test-end record, but the shard did not finish, so we are not treating it as a pass. The other 19 checks succeeded.

Current job: https://github.com/kunchenguid/firstmate/actions/runs/38077543980/job/114326906691
Earlier cancelled job: https://github.com/kunchenguid/firstmate/actions/runs/37989511465/job/114052348567

Could you investigate the repeated timeout and advise how to obtain a completed result for this shard? Our account cannot rerun upstream workflows, and an unchanged rerun may hit the same limit. We have not changed workflow settings or waived the check.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @Puh00 for the follow-up on the repeated serial-2 timeout.

I re-read head 9b7cbb41 against main (now past the Forgejo merge). Verdict unchanged from the 2026-10-10 stamp:

Contract-class: new-default. The default-on Pi supervision branch gains completed-scout teardown in both postures, plus a larger cached prompt. Live validation remains 7/7 go; VISION rules still align (authority + spine settled by your live evidence).

CI: Behavior portable serial 2 timed out again at 30m with no assertion failure in the inspected log — same shard-timeout pattern main has hit. I've re-run that job (38077543980 / job 114326906691). Every other check is green.

Next step: waiting on CI only. Nothing more is needed from you. Once serial 2 (and the aggregate) are green and it stays mergeable, this goes to Kun as a merge-or-leave decision — not an auto-merge — because of the new-default class. The timeout itself is an infrastructure flake we keep hitting on that shard; an unchanged re-run is the right next step, and if it times out again I'll note that for Kun rather than ask you to change the PR.

@Puh00

Puh00 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

@kunchenguid Thanks for rerunning serial 2. Attempt 3 on the unchanged 9b7cbb41 has now timed out as well. GitHub again reports “The job has exceeded the maximum execution time of 30m0s.” The latest job ran from 06:36:20 to 07:06:37 UTC on October 12 and concluded cancelled.

https://github.com/kunchenguid/firstmate/actions/runs/38077543980/job/114688772317

The other 19 checks remain successful, and the 7/7 live-validation result is unchanged. As you suggested in your last reply, could you note this repeated timeout for Kun and advise the next step? We have not changed the PR or workflow settings to work around it, and we are not counting the cancelled check as passing.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @Puh00 — noted attempt 3 on serial 2 also hit the 30m timeout with no assertion failure (38077543980 / job 114688772317).

Verdict unchanged: contract-class: new-default (default-on Pi supervision branch gains completed-scout teardown + larger cached prompt). Live validation remains 7/7 go. VISION rules still align (authority + spine settled by your live evidence). Attestation MATCH at 9b7cbb41.

CI: 19 checks green; Behavior portable serial 2 cancelled three times on the unchanged head (infrastructure flake on that shard). We are not counting the cancelled check as passing, and I am not auto-merging.

Next: this stays with Kun as merge-or-leave (new-default). I will not keep re-running serial 2 in a loop; the repeated timeout is flagged for him alongside the otherwise-green tip. Nothing more needed from you on this PR unless you change the head.

@lmuehleisen

Copy link
Copy Markdown

A downstream dependency for context: #6886, the follow-up to #6734, is blocked on the lab-guard change here.

bin/fm-config-push.sh calls fm-send.sh with FM_ROOT_OVERRIDE and FM_STATE_OVERRIDE set to the canonical code root and <home>/state. In a marked lab home, fm_gate_lab_permitted on current main refuses that send, so the live test step for #6886 cannot run. The same probe is permitted with this branch's guard.

#6886 is parked until this lands and will pick the change up from main.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: tip is still 9b7cbb41ebee — refreshed against main 24f3a6b8 after @lmuehleisen's note that #6886 is blocked on this lab-guard change.

Verdict unchanged: contract-class: new-default. Default-on Pi supervision branch gains completed-scout teardown guidance (both postures) plus larger cached prompt; lab gate permits production's redundant root/state/config overrides on marked lab homes. Live remains 7/7 go. VISION rules still align; attestation MATCH.

CI: 19 checks green; Behavior portable serial 2 still cancelled (same infra flake noted 2026-10-12). Not counted as passing; not auto-merging.

Next: still with Kun for merge-or-leave (new-default). Downstream #6886 can pick the lab-guard up from main once this lands. Nothing more needed from @Puh00 unless the head changes.

@kunchenguid
kunchenguid merged commit 819f1a4 into kunchenguid:main Oct 15, 2026
36 of 38 checks passed
@Puh00
Puh00 deleted the fm/completed-scout-cleanup-guidance branch October 15, 2026 12:04
valerius21 added a commit to valerius21/firstmate that referenced this pull request Oct 15, 2026
* fix: require explicit authority for Firstmate upstream contributions (kunchenguid#7172)

* feat(bin): gate firstmate-upstream publication behind a declared home role

Users who clone firstmate and run it as-is got a surprise: when their
agent hit a firstmate bug, it could drive a pull request at upstream
because nothing distinguished the maintainer's home from an ordinary
user's. Every home now resolves to user/operator unless the gitignored
config/firstmate-role grants a maintainer scope, or a single task
carries the captain's recorded --upstream-consent on the brief, spawn,
and promotion. fm-brief, fm-spawn, and fm-promote apply one fail-closed
gate in bin/fm-role-lib.sh; the role is never inferred from gh identity,
remotes, permissions, or CI, and secondmates honor only receipt-proven
inherited grants so a child cannot grant itself. Session start reports
the resolved role with no network call. Ordinary project delivery and
the clone-and-run setup flow are unchanged.

* no-mistakes(review): Harden firstmate role parsing, normalization, and inheritance

* no-mistakes(review): Detect firstmate by lineage; drop consent fallback; fix claims

* no-mistakes(document): Correct and consolidate Firstmate role documentation

* fix(pi): narrow before_agent_start events before reading prompt (kunchenguid#7248)

* fix: narrow Pi before-agent prompt events

* no-mistakes(review): Restore processing-run abort detection and type Pi test events

* feat: let a home declare authoritative external memory tiers (kunchenguid#6608)

* docs: let a home declare authoritative external memory tiers

AGENTS.md section 6 routed durable knowledge only to firstmate-local files,
so a home whose captain keeps reasoning and facts in external stores had no
tracked rule keeping those stores authoritative over the per-machine data/
cache. Add a generic home-declared Memory layering contract (schema in
docs/configuration.md), make firstmate the capture path for workers whose
harness cannot reach a declared tier, and teach the stow skill to route to
declared tiers first and never prune a tier-owned entry without capturing it.

* no-mistakes(review): Report missing memory-layering declaration and index tier docs

* no-mistakes(document): Narrow memory-tier re-seed step to captain re-declaration

* no-mistakes(ci): Environment: 2026-10-05, host wildrobot, Linux 7.0.0-34. Finding ci-1 (Greptile): a tier-owned fact could be lost when its declared tier was unreachable from the session. - The invariant that was broken: until the declared tier holds a tier-owned fact, that fact must stay in a memory file loaded at startup. - Where it could be broken: the declared-tier guard, which said to archive the entry to the never-loaded cold tier; the routing step for new findings, which only mentioned the receipt; and the budget-eviction and offload eligibility rules. Fix, made only in .agents/skills/stow/SKILL.md: - **New marker.** Added `<!--t:NAME-->` to the existing compact marker list, so its meaning lives in one place. It marks a tier-owned entry that tier NAME does not hold yet. Stow never prunes, ages out, evicts, offloads, consolidates away, or archives an entry carrying it, whatever its tier clock says. A later pass that can reach NAME captures the entry there and removes the marker. - **Declared-tier guard.** "still archive rather than delete" now says to leave the entry in place with its pending-capture marker, and the receipt still names it. - **Routing step 2.** When the tier is unreachable, a new finding is written to the startup-loaded local file its class would otherwise use, or kept where it already lives, with the marker. It is still reported as an exception in the receipt. - **Budget eviction and offload eligibility.** Both now exclude entries pending capture, so the convergence pool is counted correctly. - **Receipt bullet.** Changed "finding or pruned entry" to entries left carrying the pending-capture marker, because those entries are no longer pruned. docs/configuration.md ("protects tier-owned entries from pruning") and AGENTS.md section 6 are still accurate, so I left them unchanged. No new file, queue, script, or digest section. One sentence per line, plain dashes. Verification: tests/fm-stow-cascade.test.sh, tests/fm-documentation-audiences.test.sh, and tests/fm-lint.test.sh all pass

* docs: keep undeclared memory-tier path silent and close stuck tier markers

Drop the stow receipt line reporting a missing Memory layering declaration
(AGENTS.md section 6, the stow skill, docs/configuration.md) so a home with
no declaration behaves exactly as before. Name pending-capture entries in the
exempt floor wording, and say how stow retargets or clears a pending-capture
marker whose tier was renamed or retired.

* fix: keep unsupported contribution URLs unmeasured (kunchenguid#7233)

* fix: keep unsupported contributions unmeasured during polling

* no-mistakes(document): Clarify unsupported contribution polling documentation

* no-mistakes(review): Match literal GitHub hostname and cover unsupported lookalikes

* no-mistakes(review): Separate durable ownership compatibility from GitHub observation eligibility

* no-mistakes(document): Clarify unsupported contribution coverage and ownership compatibility

* fix(bin): keep inherited Git config entries when installing the trailer-strip hooks path (kunchenguid#6341)

* fix(bin): keep inherited Git credential helpers when installing the trailer hooks path

Problem:
Every fleet launch prefixed the worker command with `export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=...`.
That replaced any `GIT_CONFIG_*` entries the pane already carried, so a scoped HTTPS credential setup such as `credential.helper=` followed by `credential.helper=!gh auth git-credential` was silently dropped.
Git then fell back to the system or global helper (for example `osxkeychain` from the system gitconfig on macOS), so a worker meant to use a scoped token pushed with the user's personal credentials.

Reproduction on main:
GIT_CONFIG_COUNT=2 GIT_CONFIG_KEY_0=credential.helper GIT_CONFIG_VALUE_0= GIT_CONFIG_KEY_1=credential.helper GIT_CONFIG_VALUE_1='!gh auth git-credential' sh -c "<emitted launch>; git config --get-all credential.helper" prints none of the inherited entries, only the system helper (`osxkeychain` from Homebrew's system gitconfig on the reporting machine).

Fix:
The launch prefix now appends `core.hooksPath` at index `GIT_CONFIG_COUNT` and increments the count, resolved in the destination shell after any `config/launch-env-allowlist` filtering.
The inherited count is validated as decimal before shell arithmetic, leading zeros are normalized (Git accepts `02`), and a count that cannot be extended within Git's signed int refuses.
A refusal uses `return 1 2>/dev/null || exit 1`, so when the pane sources the launch file the error stays visible and the interactive shell survives instead of the pane dying with the message.

Tests:
`tests/fm-spawn-dispatch-profile.test.sh` gains a behavior test that runs the real emitted launch under sh, bash, and zsh with inherited credential-helper entries and counts `2` and `02`, then asks Git for `credential.helper` and `core.hooksPath`.
The same test checks that an invalid or overflowing count refuses, and that sourcing the launch file from an interactive shell keeps that shell alive with the error visible.
The exact-launch assertions in the dispatch-profile and Kimi suites now extract the emitted prefix through one `fm_test_launch_git_prefix` helper in `tests/lib.sh` instead of two hand-copied strings, whose content the behavior test covers.

Risk:
Top-level `return` outside a sourced file is unspecified by POSIX; verified on macOS sh (bash 3.2 in POSIX mode), bash, and zsh, and every path still ends nonzero before the worker command runs.
The hook wrapper still unsets only `GIT_CONFIG_COUNT` and index 0, which is sufficient because Git ignores indexed entries once the count is unset.
A launch that forwards `GIT_CONFIG_COUNT` without all of its indexed keys now fails in Git instead of being masked by the overwrite.

* no-mistakes(review): Keep inherited Git config in hooks and fish-safe launch

* no-mistakes(document): docs: describe appended hooksPath keeping inherited Git config

* test: run the fish pane launch cases in CI

Install fish in the portable serial lane and run the credential-append
and invalid-count refusal cases under fish. Under CI the spawn test
fails instead of falling back to the static syntax check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: strip the Git config launch prefix before reading the Claude doorbell

The trust suite evaluated the whole launch command to find the final prompt
argument, so it now also sourced the per-spawn git-config env file that the
fake pane never writes. Drop that prefix the same way the dispatch suite does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: share the launch command parser across the spawn suites

The trust suite failed in CI because its copy of the launch parser missed
the Git configuration prefix the dispatch suite's copies already stripped.
Move the prefix and export stripping into tests/lib.sh next to
fm_test_launch_git_prefix so the three parsers cannot drift again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(bin): canonicalize env-file hooks path and tighten launch-config tests

env-file now writes the canonical (pwd -P) spelling of the hooks directory, matching what install records, so a symlinked path no longer makes the hook wrapper miss its own entry and silently skip the repository's hook.
A new strip test passes a symlinked hooks path through env-file and fails without this change.

The launch-env-allowlist test now also asserts the appended core.hooksPath, so a regression that drops the strip-hook entry only on the env -i path is caught.

Without fish installed locally, the launch test now prints an explicit fish skip line and limits its pass message to sh, bash and zsh, instead of claiming every pane shell after only a static token check.

* no-mistakes(review): Drop CI fish install and CI-only fish refusal

* no-mistakes(document): Document GIT_CONFIG_COUNT overflow refusal in configuration docs

* test: prove a refused Git config count never starts the worker

The invalid-count refusal checks only asserted a nonzero status and the helper's own error text.
If the launch line kept going after the refusal, the worker probe's final `git config` also failed under the bad count, so the checks still passed.
The probe now prints a marker on stderr, and every refusal case in sh, bash, zsh and fish asserts the marker never appears.
Dropping the `|| return 1 2>/dev/null || exit 1` guard from the launch line now fails the test.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(bin): name the failing step when a contribution observation is unavailable (kunchenguid#6810)

* fix(bin): name the failing read when a contribution observation is unavailable

An unavailable contribution observation recorded one constant error and
discarded the failing read's exit status and error output on cleanup, so a
network failure, a forge refusal and a structural check failure all looked
the same and left nothing to diagnose once the next good read cleared it.

The record's error and the unavailable line now name the first failing step:
the read's label, exit status, budget seconds left and the first line of its
error output, or the structural check that refused the observation. Budget
refusal stays silent and unmeasured as before.

* no-mistakes(review): Label closing head read's structural failure as its own cause

* no-mistakes(document): Note structural refusals record contribution errors too

* fix(spawn): scope Orca worker launch env to an opt-in tmux session (kunchenguid#6365)

* fix(spawn): give Orca workers an opt-in scoped environment source

Fixes kunchenguid#6339

On the Orca backend, `config/launch-env-allowlist` expands each allowlisted name in the destination pane, and that pane is an Orca terminal whose environment comes from the Orca app and the user's shell startup files.
Allowlisted credentials therefore resolve to the user's personal values or to nothing, with no warning, while the same allowlist scopes tmux workers correctly.

Add an opt-in `config/launch-env-tmux-session` naming one tmux session.
On a fresh Orca spawn, before the worktree or terminal is allocated, fm-spawn reads each allowlisted name from that session's local environment with `tmux -u show-environment -t =<session> <name>`.
The worker launches with the existing `env -i` boundary and operational floor, the snapshotted values in place of destination expansion, and `GIT_CONFIG_NOSYSTEM=1` so a system credential helper cannot answer for the worker.
The source requires an allowlist, so tmux's automatic update-environment names such as `SSH_AUTH_SOCK` are never forwarded unless listed.
A listed name missing from the session, an unreadable session, or a malformed selector refuses before allocation; an explicit `-NAME` record stays a deliberate unset.
Values are shell-quoted only in the existing owner-only staged launch file, never terminal input, and the pane deletes that file as sourcing starts; a deletion failure refuses the worker launch and keeps the interactive shell.
`-u` is required because tmux's non-UTF-8 client output replaces newlines and non-ASCII bytes in values with underscores.

The source is opt-in and nothing changes for homes that do not create the file.
When `config/backend` is orca, the allowlist is nonempty, and no source is configured, fm-spawn now prints a stderr warning that allowlisted names resolve from the Orca terminal, so the mismatch is no longer silent.
It warns rather than refuses because refusing would stop every existing Orca home that uses an allowlist, which the triage asked not to assume.
Other backends, relaunch (already refused on Orca), and secondmate inheritance are unchanged; the selector is not in the inherited configuration list.

The scoped Git credential helper case also needs kunchenguid#6341, which stops fm-spawn's `core.hooksPath` entry from overwriting inherited `GIT_CONFIG_*` entries; this change does not depend on it.

Tests in `tests/fm-spawn-orca-worktree.test.sh`:

- A real-tmux regression on a private socket checks exact multiline UTF-8 values under absent and C locales through sh, Bash, and zsh, refusal of names that exist only server-globally or only inside another value, and exclusion of the automatic `SSH_AUTH_SOCK`.
- Fake-Orca spawns execute the real staged launch file under synthetic personal credentials and cover the configured source, an empty allowlist, refusal before allocation for each invalid setting, file privacy and deletion before the worker runs, and the deletion-failure path.
- The warning appears for a nonempty allowlist without a source and not for an empty allowlist or a configured source.

Risk: the source keeps tmux and the named session as dependencies of Orca spawns, and secret values sit in a 0600 file under a 0700 directory until the pane sources it.
It is not a filesystem sandbox; a worker can still read the user's credential files unless the harness restricts that.
The hardened path was verified with the regressions above, not with a live Orca spawn.

* no-mistakes(review): Harden Orca launch-file cleanup, floor unsets, and stat portability

* no-mistakes(review): Scope Orca abort cleanup to the staged launch file

* docs: scope Orca source to fresh spawns and qualify pane values

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: state that Orca relaunch is refused

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* no-mistakes: apply CI fixes

* no-mistakes(review): Keep Orca launch file while delivered terminal stays open

* no-mistakes(document): Qualify fm-spawn help's destination-pane expansion claim for Orca

* fix(spawn): keep launch-send failures fatal and compare tmux bytes per version

The Orca launch-file cleanup wrapped both launch sends in a condition, which runs outside errexit.
A failed send on tmux and every other non-Orca backend then continued as success, so a post-publication relaunch failure no longer failed closed.
Each send failure now exits again, and Orca source mode removes its staged file first.

The real-tmux regression asserted that invalid UTF-8 bytes survive tmux itself, which holds on tmux 3.6a but not on the CI runner's tmux.
It now asserts that the snapshot reproduces exactly the bytes the installed tmux reports for that name.

* fix(spawn): reclaim an Orca launch file the pane never runs

In Orca source mode the pane unlinks the credential-bearing launch file as it starts sourcing it.
A pane that accepted the source command but never ran it left the file on disk until teardown, because the abort cleanup keeps the file for a delivered, still-open terminal.
After delivery, fm-spawn now waits up to 30 seconds for the pane to consume the file; if it has not, fm-spawn removes it and fails the spawn with a status line naming the unrun command.

The snapshot already reads and writes tmux output as latin1, so bytes that are not valid UTF-8 reach the launch file unchanged.
A deterministic fake-tmux regression now pins that, independent of how the installed tmux stores such values.

The live-terminal test now drives a slow pane and fails unless the spawn waits for it, and the controlled-source test reads the file the fake pane consumed.

* no-mistakes(review): Keep Orca terminal open when launch file is unconsumed

* no-mistakes(review): Refuse Orca worker when launch file already reclaimed

* no-mistakes(review): Make Orca spawn's deadline launch-file reclaim exclusive

* no-mistakes(document): Document Orca launch-file reclaim keeping the terminal open

* fix(spawn): reclaim an interrupted Orca launch file and keep errexit panes open

An HUP, INT or TERM after the source command reached the Orca terminal left
the credential-bearing launch file on disk: bash ran the EXIT trap with status
0 and abort cleanup kept a delivered file for the pane. Source mode now traps
those signals until the pane consumes the file, and abort cleanup reclaims it
with the same non-forced unlink arbitration as the consume deadline, refusing
the worker when the spawn wins and leaving the terminal open.

The delivered source line now keeps a pane shell with errexit set open when
the launch is refused, including when the file was already reclaimed.

* no-mistakes(review): Trap signals as soon as Orca launch file is published

* no-mistakes(document): Record pre-send interrupt coverage in Orca verification notes

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

* fix(bin): treat OpenCode's right-aligned cwd rail as composer furniture, including absolute paths (kunchenguid#7307)

* fix(composer): treat OpenCode >= 1.18 right-aligned cwd:branch as furniture

OpenCode 1.18.31 draws the worker pane's working directory and branch
right-aligned inside the left-bar composer rows above the Build footer,
wrapped over up to three rail-width fragments whose final fragment
continues onto the footer row's right end. The fragments are RGB 128
grey with luminance exactly on the ghost-luma ceiling, so they survive
ghost stripping, and the left-bar classifier read them as unsent typed
text: every idle 1.18.31 pane answered pending, which skipped the
steering doorbell, the watcher's re-ring ladder, and /exit typing.

_fm_composer_leftbar_cwd_start recognises the run structurally and
position-gated: contiguous single-token rows immediately above the
footer row whose gap after the bar exceeds half the row, whose
fragments plus the footer row's gap-separated right-hand tail
concatenate to a path, optionally followed by :<branch>. A path-shaped
string typed at the composer's left edge is still typed text, so a
wrong call can only defer, never inject. Extraction shares the same
rule so extracted composer content stays user-scoped.

* no-mistakes(review): drop dead footer-tail concat, add live short-cwd fixture

* no-mistakes(review): accept only ~/ cwd rail; lone slash stays pending

* no-mistakes(review): require footer row for leftbar cwd furniture walk

* no-mistakes(review): Require topmost cwd fragment to carry ~/ prefix

* no-mistakes(document): Correct cwd furniture recognition doc to topmost-fragment check

* fix(composer): gate cwd rail on region width; correct version story

Review round on the independent PR review: the position gate now measures
the gap against the region's width (the widest trimmed plain row across
first..last), so a short space-prefixed home path typed into an otherwise
empty composer no longer reads empty; the right-half lone-token residual
is pinned explicitly. The cwd:branch furniture is documented as present
since OpenCode 1.18.0 (upstream anomalyco/opencode#36457, merged
2026-07-11), not a 1.18.31 layout change. The 1.18.30 capture comment
notes it omits the directory footer, and a cropped-composer extraction
assertion scopes user content to the typed row above the rail.

* no-mistakes(document): correct OpenCode cwd-furniture version framing and doc typos

* fix(composer): accept an absolute cwd rail outside $HOME as OpenCode furniture

Refs kunchenguid#4632, builds on kunchenguid#5030.

* no-mistakes(review): Harden live abs-cwd check waits and qualify rail comment

* no-mistakes(review): Fix composer-lib relative path in OpenCode harness doc

* no-mistakes(test): Relax live check's DONE wait for wide OpenCode panes

* no-mistakes(document): Separate absolute-cwd verification output block from following prose

---------

Co-authored-by: Konrad Heimel <[email protected]>

* fix(bin): report a worker parked on the exit picker as blocked-on-prompt (kunchenguid#6682)

* fix: name the Claude exit picker on existing stale wakes

A pane parked on that picker still read as healthy quiet after Enter was refused. The existing stale and wedge reports now carry the dialog name, including through away-mode escalation.

Refs kunchenguid#4754

* no-mistakes(review): fix: report exit picker on terminal-status away stales

* no-mistakes(document): docs: describe exit-picker reporting in stale supervision

* no-mistakes(review): fix: drop away stale marker when second-mate picker closes

* fix: keep the exit-picker name off paths main does not already run

A second mate stays exempt from stale capture, and a finished worker in away mode no longer ages into a wedge. The name remains on the stale and wedge wakes a worker already raises.

* no-mistakes(review): name the exit picker on wedge deferral reasons

* no-mistakes(review): limit exit-picker name to plain stale and wedge escalation

* feat: set afk spend cap from live ordinary workers at entry (kunchenguid#7308)

* feat(afk): Spend-Obergrenze beim Eintritt aus der lebenden Worker-Zahl

Ohne ausdrückliches --spend nimmt der Eintritt in den Away-Modus die Zahl der
gerade im Home stehenden gewöhnlichen Worker als Obergrenze, damit der Modus
laufende Parallelität nicht einengt. Der bisherige Default bleibt Untergrenze,
0 bleibt ausgeschlossen, und ein ausdrückliches --spend gewinnt weiterhin.

Die Zählung bekommt mit `live-workers` genau eine Implementierung in
bin/fm-afk-contract.sh. bin/fm-spawn.sh liest sie dort statt mit einer eigenen
Schleife, sodass Eintritt und spätere Sperre nicht auseinanderlaufen können.

* no-mistakes(document): Remove misplaced afk spend-cap plan

---------

Co-authored-by: ladwein <[email protected]>

* fix(bin): guide completed-scout cleanup and permit stock lab supervision paths (kunchenguid#6965)

* fix(bin): guide supervision through completed-scout cleanup

* no-mistakes(document): Document completed-scout cleanup ownership and regression coverage

* no-mistakes(test): Allow confined lab overrides and verify live scout cleanup

* no-mistakes(test): Clarify per-task cleanup reporting and verify live outcomes

* ci: let a fork skip the push run and the macOS job by repository variable (kunchenguid#7260)

* fix(bin): have workers paused on their own background job set until to the job's timeout (kunchenguid#7240)

* fix: recheck a worker paused on its own background job

A worker that declares `paused:` on its own background job and then misses the job's completion stays idle until the long declared-wait recheck, because the first-sight alert spends the declaration's throttle and nothing else names when the job must have ended.
The worker pause instructions now say that `until` for such a job is its start plus its timeout, and the watcher already rechecks once when that time passes.
The recovery playbook now tells the supervisor to verify the condition a declared wait names before reporting the wait as healthy.

Fixes kunchenguid#7239

* test: give the background-job until test headroom over its quiet round

The first absorb round of the until test may take four poll cycles of up to 30 s each on a loaded runner.
With `until` only 15 s ahead, that time could pass during the round and fail the test although the watcher behaves correctly.
Set `until` 120 s ahead so the window covers those four cycles, as CONTRIBUTING asks of fixture windows.

* chore: retrigger CI

* chore: retrigger CI

* no-mistakes(review): Rebuild bg-job until test with passed until, no sleep

* no-mistakes(review): Restore bg-job absorb checks and assert due recheck marker

---------

Co-authored-by: pedromuller-del <[email protected]>

* feat(bin): add a verified Command Code (commandcode) crewmate/scout adapter (kunchenguid#6679)

* feat: add Command Code crewmate and scout adapter

Add `commandcode` as a verified worker runtime for crewmate and scout work
only, so Firstmate can dispatch workers on Command Code models such as
deepseek/deepseek-v4.1-flash.

- Detection: the anchored `command-code` process title identifies the
  adapter in fm-harness.sh and the shared liveness classifier.
- Launch: fm-spawn passes --yolo, --trust, --skip-onboarding, the model, an
  effort only where the model's accepted set is verified, and the typed
  launch brief after --; taste-learning state is kept out of git.
- Busy state: a tracked mod, bin/fm-commandcode-mod.ts, is loaded per
  process with --mod and --mod-option, writing run_start/run_end/session
  end through fm-busy-event.sh; no user or project settings are edited
  (Command Code's --config persists globally, so it is never used).
- Control: one Escape interrupts; the idle double-Escape Rewind picker is a
  recognized hazard that exit refuses and interrupt dismisses; /quit exits.
- Composer: the bright truecolor placeholder is read with an
  identity-scoped ghost ceiling, and the tmux adapter supplies the identity
  for a cursor parked below the footer; Herdr reports it natively as `cmd`.
- Attribution: the fleet commit-msg strip removes the CommandCodeBot
  trailer.
- Docs, harness reference, verification record, portable regressions, and
  the FM_COMMANDCODE_SIGNALS_LIVE live guard.

* no-mistakes(review): Drop flash-fast effort pairs; correct identity-probe cost comments

* no-mistakes(ci): I fixed both Greptile findings the way you asked. Both new regression tests fail on the old code and pass now. The changes are not committed. **ci-1: Command Code on zellij, cmux and orca.** The rule that must hold is that a Command Code worker only runs on a backend that tells Firstmate the pane is Command Code. Without that, its idle placeholder never reads as an empty composer, so steering stalls. `bin/fm-spawn.sh` now refuses `--harness commandcode` unless the backend is tmux or herdr. The error reads: `commandcode is verified on the tmux and herdr backends only; backend=<b> cannot prove its composer empty. Select backend tmux or herdr.` - The check runs after both the harness and the backend are known, so it covers fresh spawns and `--relaunch`. - It runs before any pane, worktree, task record or busy state is created. - New test in `tests/fm-commandcode-harness.test.sh`: tries a scout spawn on each of zellij, cmux and orca (with a fake `orca` that reports ready). It checks for the refusal and that nothing was launched, no task record was written and busy state was not armed. It needs no real backend installed. - Documented in `docs/configuration.md`, the Command Code adapter reference and the `fm-spawn.sh` header. **ci-2: an old process signalling its replacement.** The rule is that the `turn-ended` notification may only be raised under the same generation check as the idle write. The mod used to touch the file itself after the writer returned, which left a gap for a relaunch to slip in. - `bin/fm-busy-event.sh apply` takes a new `--turn-ended` flag. It touches `state/<id>.turn-ended` while still holding the writer lock, after the generation check passes. A stale generation is refused with no touch, and the flag is rejected on any subcommand other than `apply`. - `bin/fm-commandcode-mod.ts` no longer touches files itself. On `run_end` it passes `--turn-ended` unless the turn was interrupted. - New test in `tests/fm-commandcode-harness.test.sh`: a fake writer accepts the idle write and then arms a replacement before the mod continues. It asserts no notification appears. - New test in `tests/fm-busy-state.test.sh`: the notification is raised for the current generation, not for a stale one, and not outside `apply`. **Checks run:** - Passing: `fm-commandcode-harness`, `fm-busy-state`, `fm-busy-adapter-wiring`, `fm-backend`, `fm-documentation-audiences`, and `bash -n` on the changed shell files. - `fm-bootstrap.test.sh` fails one case ("backend=herdr must fail closed on its own missing session CLI"). It fails the same way on an untouched copy of the branch, because herdr is installed at `/usr/bin/herdr` on this machine. - `bin/fm-lint.sh` could not run because ShellCheck 0.11.0 is not on PATH, so the changed shell files have not been linted. **Not changed:** Devin's hook does the same thing outside this PR: it runs `apply ... && touch` in `bin/fm-devin-config.sh`. That predates this PR and is not in the changed area, so I left it alone

* no-mistakes(ci): I fixed ci-sc2016. ShellCheck is not installed on this machine, so I could not confirm that the lint warning is gone. **The rule that was broken:** the repo lints with ShellCheck at its default severity, which also fails on info-level notes. Any single-quoted `$` that is meant to stay literal needs a scoped disable comment that says why. Only one place in the changed area needed this: the racing-writer `printf` in `tests/fm-commandcode-harness.test.sh`. Its format string writes `"$2" "$3"` on purpose, so the generated fake writer reads its own arguments when it runs. **The fix:** I added one line just above that `printf`: `# shellcheck disable=SC2016 # positional params expand in the generated writer.` The repo already does this the same way, for example in `tests/fm-afk-launch.test.sh` and `tests/fm-ask-user-authority.test.sh`. Nothing else changed, so the test behaves exactly as before. **Checks run:** - `bash -n tests/fm-commandcode-harness.test.sh` passes. - `bash tests/fm-commandcode-harness.test.sh` passes all six cases, including the busy-mod case with the racing writer. **Not run:** `bin/fm-lint.sh` stops with "ShellCheck not found" because ShellCheck 0.11.0 is not on PATH and there is no copy in the repo. I did not install it, since installs outside the worktree are off limits here. The upstream lint run will be the first ShellCheck pass on this change. The change is not committed

* no-mistakes(review): Hard-code Command Code ghost luma ceiling at 160

* no-mistakes(review): Test commandcode relaunch refusal off tmux/herdr before stop

* no-mistakes(document): Note Command Code fixed ghost luma ceiling in config docs

* fix: put a read cue at the head of a context re-emit (kunchenguid#7298)

Claude spills a hook output over 10,000 characters and shows only the first
2,000 plus a saved-file path. The re-emit prints captain.md and learnings.md
last, so they never reached the session. Print a short cue first that names
the saved file and the memory files, and document the cap.

Refs kunchenguid#6303

* fix(bin): retry transient contribution forge reads once before waking (kunchenguid#7302)

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for kunchenguid#7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete kunchenguid#7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix: retry transient contribution reads once

* fix: classify contribution read errors safely

Address review findings for kunchenguid#7262 by parsing only gh status forms, recognizing real DNS errors, refusing GraphQL not-found retries, clearing per-URL diagnostics, and restoring exit-137 handling.

* fix: recognize bare gh HTTP errors

Complete kunchenguid#7262 review fixes by accepting bodyless gh status lines and keeping all GraphQL errors out of transient network classification.

* no-mistakes(review): Classify gh network errors by Go error tokens

* no-mistakes(document): Note why contribution 404 reads are never retried

* no-mistakes(review): Retry message-less GraphQL HTTP 5xx on closing read

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation (kunchenguid#7338)

* fix(bin): let a backlog captain hold bound the watcher's wedge escalation

A stuck worker whose task was held for the captain through
bin/fm-captain-hold.sh kept wedge-escalating every STALE_ESCALATE_SECS,
because wedge_wait_evidence only read the status line. It now also reads
the open backlog captain call (task_captain_call_open) and defers to the
existing captain-facing long recheck, silent while the away record exists.

* no-mistakes(review): Publish no wait age for backlog captain holds

* no-mistakes(review): Let an elapsed paused-until line fall through to backlog hold

* no-mistakes(document): Document backlog captain hold in wedge wait-evidence contract

---------

Co-authored-by: Kun Chen <[email protected]>
Co-authored-by: Ian Brown <[email protected]>
Co-authored-by: Stephen Haptonstahl <[email protected]>
Co-authored-by: Michal Zuber <[email protected]>
Co-authored-by: Andrew Li <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Steven G Woods <[email protected]>
Co-authored-by: Kostadin Pop-Kochev <[email protected]>
Co-authored-by: Konrad Heimel <[email protected]>
Co-authored-by: Tiago <[email protected]>
Co-authored-by: Sebastian <[email protected]>
Co-authored-by: ladwein <[email protected]>
Co-authored-by: Phu <[email protected]>
Co-authored-by: Pedro Müller <[email protected]>
Co-authored-by: pedromuller-del <[email protected]>
Co-authored-by: pback34 <[email protected]>
Co-authored-by: Tim Kleinschmidt <[email protected]>
Co-authored-by: Liam Sarsfield <[email protected]>
Co-authored-by: yairtech <[email protected]>
Co-authored-by: Valerius Mattfeld <[email protected]>
robkerr1992 added a commit to robkerr1992/firstmate that referenced this pull request Oct 17, 2026
Integrates the completed-scout cleanup prompt (kunchenguid#6965) and the Forgejo forge
support (kunchenguid#4395) that landed on main after this branch was cut, resolving the
two conflicts in favour of both changes:

- bin/fm-branch-prompt.sh step 3 keeps "whose PR the forge reports merged"
  and main's "or a completed scout under the policies below".
- docs/pi-supervision-branch.md keeps main's renamed cleanup section and adds
  the one sentence that teardown success is never the branch's merge evidence.

The gone-worktree merge proof (recorded_pr_is_merged) now reads a recorded
Forgejo pull request through tea exactly as pr_is_merged does, with a test,
so the branch actor is not refused forever on a merged Forgejo PR.