Skip to content

fix: add explicit-home retry hints and preserve handled steers - #13

Merged
ryannmicua merged 3 commits into
mainfrom
fm/fm-script-gotchas
Oct 10, 2026
Merged

ryannmicua merged 3 commits into
mainfrom
fm/fm-script-gotchas

Conversation

@ryannmicua

@ryannmicua ryannmicua commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Intent

I approve of the improvements 1-4 approach as recommended.

Context, item 3: move tool-contract gotchas into the scripts instead of memory. Evidence and reviews: data/env-retro-2026-10-10/report.md, data/fm-improve-xreview-fable/report.md (item 3) and data/fm-improve-xreview-astra/report.md (item 3). Hold reasons with parentheses are already fixed upstream and in the fork, so they are out of scope. The approved approach is to build in firstmate and propose upstream later.

What Changed

  • Print shell-escaped retry commands when fm-send or fm-control refuses a missing FM_HOME, provided the candidate home has a state directory.
  • Archive handled steers byte-for-byte before teardown removes inboxes or secondmate homes, including forced cleanup; reuse identical copies, preserve differing copies, and stop deletion if archiving fails.
  • Document explicit-home requirements and steer archives, and add regression coverage for retry hints and archive preservation.

Risk Assessment

✅ Low: The changes are bounded, preserve explicit-home refusals, and archive handled steers before remote secondmate home deletion without adding unnecessary machinery.

Testing

Send/control regressions passed, and isolated live cleanup proved byte preservation, collision handling, deduplication, and recovery from archive failure. Cleanup regressions exposed a fixture-location restriction; guard refusals prevented remaining live scenarios. CLI evidence was saved and temporary fixtures removed.

  • Live validation: ⚠️ inconclusive - 2 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Sending without FM_HOME refuses delivery and prints an exact quoted retry command ⏸️ untested no The regression passed, but direct live invocation exits at the gate guard before reaching the changed diagnostic. Without FM_HOME, the marked-lab allowance cannot apply. Requires a disposable non-gate…
Controlling a task without FM_HOME refuses execution and prints the retry command ⏸️ untested no The regression passed, but direct live invocation exits at the gate guard before reaching the changed diagnostic. An unset home cannot carry the required lab marker. Requires a disposable non-gate exe…
Cleanup archives handled messages byte-for-byte, preserves collisions, deduplicates identical copies, and excludes unhandled messages ✅ pass live live-archive.log; archived-steer.msg
An obstructed archive destination retains the inbox, then cleanup succeeds after repairing the destination ✅ pass live live-archive.log
Ordinary and forced remote secondmate retirement preserve handled messages in the surviving parent home ⏸️ untested no Tried a marked lab with parent-route relocation; the gate guard prohibits overrides. The focused regression also refused its ordinary retirement fixture because secondmate deletion targets inside the…
Evidence: Live archive and failure-recovery transcript

Source: Live archive and failure-recovery transcript

~/.no-mistakes/worktrees/ff5e17b6f5de/01M4HG8J0V5TEX93CF7T52EKM0/.test-tmp/live-home
complete: archive-task captain-call inventory reviewed
fm-gate-refuse: gate agent lifecycle permitted only against lab home ~/.no-mistakes/worktrees/ff5e17b6f5de/01M4HG8J0V5TEX93CF7T52EKM0/.test-tmp/live-home
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  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 according to the session-start block for this harness; do not use shell &.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
mkdir: cannot create directory ‘~/.no-mistakes/worktrees/ff5e17b6f5de/01M4HG8J0V5TEX93CF7T52EKM0/.test-tmp/live-home/data/archive-task/steers’: File exists
error: could not archive handled steers for archive-task; leaving the inbox in place
OBSERVED: archive failure retained handled inbox and task records
fm-gate-refuse: gate agent lifecycle permitted only against lab home ~/.no-mistakes/worktrees/ff5e17b6f5de/01M4HG8J0V5TEX93CF7T52EKM0/.test-tmp/live-home
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
teardown archive-task complete (window fm-lab-archive:fm-archive-task, worktree ~/.no-mistakes/worktrees/ff5e17b6f5de/01M4HG8J0V5TEX93CF7T52EKM0/.test-tmp/live-home/absent-worker)
Backlog: archive-task just finished (this home keeps no markdown backlog at ~/.no-mistakes/worktrees/ff5e17b6f5de/01M4HG8J0V5TEX93CF7T52EKM0/.test-tmp/live-home/data/backlog.md). Update ~/.no-mistakes/worktrees/ff5e17b6f5de/01M4HG8J0V5TEX93CF7T52EKM0/.test-tmp/live-home/data/backlog.md - move archive-task 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.
OBSERVED: retry archived exact bytes, preserved collision, deduplicated identical copy, excluded unhandled message, removed inbox
Evidence: Actual archived message bytes

Source: Actual archived message bytes

first steer
no trailing newline
Evidence: Live isolation-guard refusals

Source: Live isolation-guard refusals

~/.no-mistakes/worktrees/ff5e17b6f5de/01M4HG8J0V5TEX93CF7T52EKM0/.test-tmp/guard-home
ATTEMPT: fm-send with no FM_HOME
error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
refusal exit=3
ATTEMPT: fm-control with no FM_HOME
error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
refusal exit=3
ATTEMPT: disposable remote parent-route retirement
error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
refusal exit=3
Evidence: Remote retirement fixture restriction

Source: Remote retirement fixture restriction

ok - fm-teardown: handled steers are archived byte-for-byte and retry-safe before the inbox is removed
not ok - remote secondmate retirement failed: REFUSED: unsafe secondmate home removal target ~/.no-mistakes/worktrees/ff5e17b6f5de/01M4HG8J0V5TEX93CF7T52EKM0/.test-tmp/fm-teardown-endpoint-safety.isMNO9/remote-steer-archive/mate is inside the firstmate repo
- Outcome: ⚠️ 2 warnings across 1 run (5m2s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ bin/fm-teardown.sh:3827 - Remote secondmate retirement silently skips archiving. Its handled messages live under TARGET_HOME/state/parent-route, but remove_firstmate_home at bin/fm-teardown.sh:3738 deletes that home before the new archive call. The missing-directory check at bin/fm-teardown.sh:3809 then returns success, losing every handled steer. Archive before deleting the containing home and use a destination that survives retirement. The same preservation promise appears at bin/fm-teardown.sh:95 and docs/configuration.md:81.

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

⚠️ **Test** - 2 warnings
  • ⚠️ Complete live evidence is unavailable under the current isolation rules: missing-home calls stop at the gate guard, relocated remote routes cannot use the lab allowance, and secondmate deletion fixtures inside this repository are refused. Validation needs an authorized disposable environment outside the gate repository and tracked code root.
  • ⚠️ live validation verdict: inconclusive (2 of 5 scenarios were driven live against the product); untested: Sending without FM_HOME refuses delivery and prints an exact quoted retry command, Controlling a task without FM_HOME refuses execution and prints the retry command, Ordinary and forced remote secondmate retirement preserve handled messages in the surviving parent home
  • Live validation: ⚠️ inconclusive - 2 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Sending without FM_HOME refuses delivery and prints an exact quoted retry command ⏸️ untested no The regression passed, but direct live invocation exits at the gate guard before reaching the changed diagnostic. Without FM_HOME, the marked-lab allowance cannot apply. Requires a disposable non-gate…
Controlling a task without FM_HOME refuses execution and prints the retry command ⏸️ untested no The regression passed, but direct live invocation exits at the gate guard before reaching the changed diagnostic. An unset home cannot carry the required lab marker. Requires a disposable non-gate exe…
Cleanup archives handled messages byte-for-byte, preserves collisions, deduplicates identical copies, and excludes unhandled messages ✅ pass live live-archive.log; archived-steer.msg
An obstructed archive destination retains the inbox, then cleanup succeeds after repairing the destination ✅ pass live live-archive.log
Ordinary and forced remote secondmate retirement preserve handled messages in the surviving parent home ⏸️ untested no Tried a marked lab with parent-route relocation; the gate guard prohibits overrides. The focused regression also refused its ordinary retirement fixture because secondmate deletion targets inside the…
  • TMPDIR="$PWD/.test-tmp" bash tests/fm-send-strict.test.sh — passed
  • TMPDIR="$PWD/.test-tmp" bash tests/fm-control.test.sh — passed
  • TMPDIR="$PWD/.test-tmp" bash tests/fm-teardown-endpoint-safety.test.sh — stopped on an unsafe in-repository secondmate fixture
  • Focused archive and remote-retirement regression functions — archive passed; remote fixture refused
  • bash ~/.no-mistakes/evidence/01M4HG8J0V5TEX93CF7T52EKM0/live-archive.sh — real scripts, marked lab home, private tmux socket, archive obstruction and retry
  • bash ~/.no-mistakes/evidence/01M4HG8J0V5TEX93CF7T52EKM0/guard-attempts.sh — confirmed live validation restrictions
  • Removed temporary fixtures and stopped identified fixture tmux servers; git status --short clean
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Not live-validated

These scenarios could not be driven live because gate isolation rules block them; each is covered by the automated regression tests:

  • fm-send without FM_HOME refuses and prints the exact quoted retry command.
  • fm-control without FM_HOME refuses and prints the retry command.
  • Remote secondmate retirement preserves handled steers in the surviving parent home.

Related upstream work

The brief-heading cutoff diagnostic is intentionally not part of this change: upstream kunchenguid#6101 already covers it and will be taken when it lands.

@ryannmicua
ryannmicua merged commit ccd71d6 into main Oct 10, 2026
37 of 38 checks passed
@ryannmicua
ryannmicua deleted the fm/fm-script-gotchas branch October 10, 2026 01:08
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