Skip to content

fix(bin): save Claude second mate transcripts and keep model and effort on relaunch - #21

Merged
demy00 merged 3 commits into
mainfrom
feature/lifemate-chat-saving
Nov 8, 2026
Merged

demy00 merged 3 commits into
mainfrom
feature/lifemate-chat-saving

Conversation

@demy00

@demy00 demy00 commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Intent

Start the fix so the life mate second mate is sturdy across restarts: launch Claude second mates with chat saving on, and keep their model and effort on relaunch.

Context: 2026-11-06, the life mate came back from a relaunch with model=default effort=default instead of what it had, and setting CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1 did not reach the herdr pane. On 2026-11-08 its pane still shows "Transcript saving is off - inherited CLAUDE_CODE_CHILD_SESSION marker - restart with CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1", so a restart loses its conversation.

What Changed

  • bin/fm-spawn.sh now puts CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1 at the start of a Claude second mate's launch command. Transcript saving stays on even when the Herdr pane inherits a CLAUDE_CODE_CHILD_SESSION marker. Other task kinds launch as before.
  • Relaunching a second mate keeps its recorded model and effort when the config/secondmate-harness pin names neither and the harness stays the same. This covers both a manual relaunch (bin/fm-control.sh) and the automatic liveness respawn (bin/fm-spawn.sh). Before this, those values were reset to default. A pin token or an explicit --model/--effort flag still takes precedence.
  • Added tests in tests/fm-control-relaunch.test.sh, tests/fm-secondmate-harness.test.sh and tests/fm-secondmate-liveness.test.sh. Updated the CHANGELOG, the Claude harness-adapter reference and the docs (agent-control.md, configuration.md, verification/runtime-backends.md).

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change is small and well-bounded: an env prefix added only to Claude secondmate launches, plus a same-harness fallback to the recorded model and effort, applied consistently in fm-control relaunch and the fm-spawn secondmate pin resolution that the liveness respawn uses, with behavioral regression tests for each path.

Testing

I ran the 3 affected test files. All passed, including the 3 new tests for chat saving, the relaunch profile and the liveness-respawn profile. A red run against the base fm-spawn.sh showed that the liveness regression test fails without the fix. I also saved the generated Claude secondmate launch command: CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1 sits inline even when CLAUDE_CODE_CHILD_SESSION=1 is inherited. This is a CLI change with no UI, so there are no screenshots. I did not start a real Claude in a real herdr pane, so Claude honoring the override is taken from Claude's own documented behavior. The worktree is clean.

Evidence: Captured Claude secondmate launch command, with CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1 inline

Source: Captured Claude secondmate launch command, with CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1 inline

# all fm-secondmate-harness tests passed
ok - C1b spawn: a Claude secondmate launch forces transcript saving past an inherited child-session marker
--- captured Claude secondmate launch command (CLAUDE_CODE_CHILD_SESSION=1 inherited) ---
export COMPACT_ADVISER_DISABLE=1; export FM_TASK_INBOX='/private/var/folders/y9/b8qt1d396lv9cfh42ft2gt7r0000gn/T/fm-secondmate-harness.rEzigT/spawn-session-persistence/home/state/sm.inbox'; '~/.no-mistakes/worktrees/f2cfe607828c/01M6YC88V6T5WSW81QNSB9BG7P/bin/fm-git-strip-ai-trailers.sh' env-file '/private/var/folders/y9/b8qt1d396lv9cfh42ft2gt7r0000gn/T/fm-secondmate-harness.rEzigT/spawn-session-persistence/home/state/sm.git-hooks' '/tmp/fm-sm+601f81df575af4cb5ba1f3a5b1ea467c6ff44e48e5962d365fdae445d8df1765/git-config.s1794170225.67974.5084.sh' && . '/tmp/fm-sm+601f81df575af4cb5ba1f3a5b1ea467c6ff44e48e5962d365fdae445d8df1765/git-config.s1794170225.67974.5084.sh' || return 1 2>/dev/null || exit 1; FM_ROOT_OVERRIDE= FM_STATE_OVERRIDE= FM_DATA_OVERRIDE= FM_PROJECTS_OVERRIDE= FM_CONFIG_OVERRIDE= FM_PUBLIC_FOLLOWUP_PRIMARY_HOME='/private/var/folders/y9/b8qt1d396lv9cfh42ft2gt7r0000gn/T/fm-secondmate-harness.rEzigT/spawn-session-persistence/home' FM_HOME='/private/var/folders/y9/b8qt1d396lv9cfh42ft2gt7r0000gn/T/fm-secondmate-harness.rEzigT/spawn-session-persistence/sm' FM_TRACE_CONTEXT=off FM_SUPERVISION_MODEL=autoarm env -u CURSOR_AGENT -u CURSOR_INVOKED_AS -u GEMINI_CLI CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1 CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false CLAUDE_CODE_SEND_FEEDBACK=0 claude --dangerously-skip-permissions --add-dir '/private/var/folders/y9/b8qt1d396lv9cfh42ft2gt7r0000gn/T/fm-secondmate-harness.rEzigT/spawn-session-persistence/home/state/sm.inbox' --settings '/private/var/folders/y9/b8qt1d396lv9cfh42ft2gt7r0000gn/T/fm-secondmate-harness.rEzigT/spawn-session-persistence/home/state/sm.claude-settings.json' ': Firstmate operational input waiting: read '\''/private/var/folders/y9/b8qt1d396lv9cfh42ft2gt7r0000gn/T/fm-secondmate-harness.rEzigT/spawn-session-persistence/sm/state/operational-inbox/1794170225-ef1a5b7e9e235fea.msg'\'' and handle its contents as Firstmate operational input.'
Evidence: Red run: liveness respawn regression test fails against the base fm-spawn.sh

Source: Red run: liveness respawn regression test fails against the base fm-spawn.sh

not ok - a pin naming no model must keep the recorded model across the liveness respawn

ok - fm_backend_tmux_agent_state: separates live, dead, missing, ambiguous, and unreadable
ok - fm_backend_tmux_agent_state: rejects malformed targets before probing tmux
ok - fm_backend_herdr_agent_state: preserves missing/no-agent/live/unknown husk behavior
ok - fm_backend_agent_state: routes tmux/Herdr and keeps Zellij unverified
ok - sweep: a confirmed-dead secondmate endpoint is killed and respawned
ok - sweep: a dead secondmate respawns on its recorded backend, not a changed default
not ok - a pin naming no model must keep the recorded model across the liveness respawn
Evidence: fm-secondmate-liveness test log (fixed)

Source: fm-secondmate-liveness test log (fixed)

ok - fm_backend_tmux_agent_state: separates live, dead, missing, ambiguous, and unreadable
ok - fm_backend_tmux_agent_state: rejects malformed targets before probing tmux
ok - fm_backend_herdr_agent_state: preserves missing/no-agent/live/unknown husk behavior
ok - fm_backend_agent_state: routes tmux/Herdr and keeps Zellij unverified
ok - sweep: a confirmed-dead secondmate endpoint is killed and respawned
ok - sweep: a dead secondmate respawns on its recorded backend, not a changed default
ok - sweep: a dead secondmate respawns with its recorded model and effort when the pin names neither
ok - sweep: secondmate recovery resolves its durable account despite a different ambient login
ok - sweep: distinct secondmate relaunches serialize across the task-set lock
ok - sweep: a tmux secondmate whose close fails keeps the existing best-effort kill and guarded spawn
ok - sweep: an already-live secondmate is untouched and distinguishable in verbose diagnostics
ok - sweep: an authoritatively missing Pi secondmate window is relaunched
ok - sweep: an authoritatively missing pi-signed secondmate window is relaunched
ok - sweep: an existing ambiguous Pi process prevents duplicate recovery
ok - sweep: transient target unreadability never licenses recovery
ok - sweep: failed relaunch diagnostics distinguish a confidently missing endpoint
ok - sweep: an unverified harness blocks recovery with a concrete diagnostic
ok - sweep: idempotent by construction - a live secondmate is never re-touched on a later run
ok - sweep: skipped entirely under FM_BOOTSTRAP_DETECT_ONLY=1, exactly like the other mutating sweeps
ok - sweep: a silent no-op with no kind=secondmate meta present (a secondmate home's own natural scoping)
ok - sweep: a mate mid-episode under the shared liveness lock is skipped entirely
ok - relaunch: the spawn timeout bounds the lock wait before touching the endpoint
ok - sweep: an unreadable or unwritable relaunch ledger refuses to kill or spawn
ok - poll probe: remote states map to the same contract as local, one call each
ok - poll probe: unreachable or inconclusive remote reads preserve the route
ok - full probe: a live rex route stays alive through the rex readiness gate
ok - full probe: remote backend drift is reported, never migrated
ok - full probe: rex readiness gaps and unreachable hosts stay explicit
ok - full probe: a record without remote_backend stays a herdr route
# all fm-secondmate-liveness tests passed
bash tests/$t.test.sh  12.64s user 15.03s system 37% cpu 1:14.60 total
Evidence: fm-control-relaunch test log (fixed)

Source: fm-control-relaunch test log (fixed)

ok - fm-spawn --relaunch: tracked opencode wiring is retired as on main
ok - fm-control removes the dialog file after exit and after relaunch
ok - fm-control exit removes the dialog file before it releases the control lock
ok - fm-control relaunch: a same-harness relaunch replaces the agent in the same endpoint and worktree
ok - fm-control relaunch: pending composer text refuses before the exit command is typed
ok - fm-control relaunch: an unreadable composer fails safe before the exit command is typed
ok - fm-control relaunch: a linked spawning home preserves committed and unfinished work in the recorded copy
ok - fm-control relaunch: an armed PR poll survives replacement launch publication
ok - fm-control relaunch: a traced replacement keeps an armed PR poll authenticated
ok - fm-control relaunch: delivery and concurrent task metadata publication serialize
ok - fm-control relaunch: disabling tracing clears metadata and pane context
ok - fm-control relaunch: progress and the Firstmate-worktree worker identity reach the replacement
ok - fm-control relaunch: the progress note's inbox listing is silent on an empty inbox
ok - fm-control relaunch: a ship task refuses without the progress note its replacement needs
ok - fm-control relaunch: switching harness is one ordinary relaunch, and the old wiring goes with the old agent
ok - fm-control relaunch: a refused relaunch onto polytoken keeps the project's own hook layer and the running agent
ok - fm-control relaunch: a refused polytoken profile leaves the running agent untouched
ok - fm-spawn --relaunch: retiring a raw polytoken launch's wiring keeps the project's own layers
ok - fm-control relaunch: a harness switch resets model and effort unless they are named too
ok - fm-control relaunch: a prefixed recorded harness can switch adapters transactionally
ok - fm-control relaunch: a prefixed command requires an explicit replacement harness
ok - fm-control relaunch: a same-harness relaunch keeps the profile axes it was running with
ok - native Ultra relaunch preserves its profile and rejects an unsupported model before stopping
ok - fm-control relaunch: a signed-out worker account pin refuses before the old agent stops
ok - fm-control relaunch: the replacement follows the home's current worker account pin
ok - fm-control relaunch: a declared account list keeps the account the task records
ok - fm-control relaunch: only an explicit --account moves a task to another declared account
ok - fm-control relaunch: undeclared, newline-split, signed-out, unrecorded, retired, and wrong-runner accounts refuse before the old agent stops
ok - fm-control relaunch: mate pins are re-read for Claude and Pi, and unusable pins refuse before stopping the agent
ok - fm-control relaunch: a Pi replacement keeps the home's tool exclusions
ok - fm-control relaunch: exclusion-list refusals happen before the running agent stops
ok - fm-control relaunch: explicit model and effort win over the recorded ones
ok - fm-control relaunch: refuses to relaunch onto an adapter with no verified mechanics
ok - fm-control relaunch: the retired incarnation's global turn-end token is revoked
ok - fm-control relaunch: wiring cleanup failure refuses replacement arming
ok - fm-control-lib: one owner resolves each harness's turn-end registry entry, and refuses a malformed token
ok - fm-control relaunch: a secondmate relaunch re-resolves its durable configured harness pin
ok - fm-control relaunch: a secondmate pin without model or effort tokens keeps the recorded profile
ok - fm-control relaunch: a claude secondmate keeps settings.local.json and retires the state settings file and the Stop pointer
ok - fm-control relaunch: a mate with a per-mate override line lands on that override, not the default pin
ok - fm-control relaunch: a mate with no override line still resolves the default pin
ok - fm-control relaunch: a legacy secondmate pin file still relaunches the mate onto its first line
ok - fm-control relaunch: an unparseable secondmate pin refuses before anything is stopped
ok - fm-control relaunch: invalid configured effort is ignored before stop
ok - fm-control relaunch: an adapter unverified for this task kind refuses before the agent is stopped
ok - fm-control relaunch: explicit secondmate harness resets unnamed profile axes
ok - fm-control relaunch: a ship task keeps its recorded harness instead of re-reading crew config
ok - fm-spawn --relaunch: with no explicit harness it reuses the task's recorded one, never the crew default
ok - fm-spawn --relaunch: a promoted scout with a recorded custom branch relaunches on it instead of being refused
ok - fm-promote/fm-spawn --relaunch: the current ship contract supersedes stale scout delivery text
ok - fm-spawn --relaunch: wiring armed under a prefixed harness name is still retired
ok - fm-spawn --relaunch: switching away from muse retires its session binding
ok - fm-spawn --relaunch: switching away from cursor retires its session binding
ok - fm-control relaunch: an unaccountable local copy refuses before the agent is touched
ok - fm-spawn --relaunch: a recorded worktree that is the primary home refuses
ok - fm-spawn --relaunch: a recorded worktree that is the project primary checkout refuses
ok - fm-spawn --relaunch: inherited Git overrides do not hide the project primary checkout
ok - fm-control relaunch: a worker with nothing to work from is never launched
ok - fm-control relaunch: a refusal before the agent is stopped leaves the durable record untouched
ok - fm-control relaunch: checkpoint inspection failures refuse before stopping
ok - fm-control relaunch: a launch failure after the stop keeps the prior record and reports the real state
ok - fm-control relaunch: unpublished rollback keeps concurrent durable metadata
ok - fm-control relaunch: post-publication failure keeps the new durable record
ok - fm-control relaunch: partial stop reconciles actual agent state
ok - fm-control relaunch: failed journal replacement preserves durable phase
ok - fm-spawn relaunch: prepublication abort removes replacement state
ok - fm-control relaunch: the checkpoint records the exact unlanded work it preserved
ok - fm-control relaunch: a secondmate's child work is accounted for and its charter is left alone
ok - fm-control relaunch: a secondmate home that is not this secondmate's is refused
ok - fm-control relaunch: unreadable child records fail checkpoint
ok - fm-control relaunch: unlistable state fails checkpoint
ok - fm-control relaunch: a vanished watcher scratch file does not fail the child-record checkpoint
ok - fm-control relaunch: two control actions on one task serialize instead of interleaving
ok - fm-spawn relaunch: direct entry participates in lifecycle serialization
ok - fm-promote: promotion participates in lifecycle serialization
ok - fm-spawn --relaunch: refuses to launch a second agent into a live endpoint
ok - fm-spawn --relaunch: symlinked records refuse before inspection
ok - fm-spawn --relaunch: keeps its early meta lock continuous
ok - fm-spawn --relaunch: pending closes refuse before replacement begins
ok - fm-spawn --relaunch: every identity axis comes from the record, and a contradicting flag refuses
ok - fm-spawn --relaunch: an unrecorded task is refused
ok - fm-spawn --relaunch: refuses to start a replacement outside the copy holding its work
ok - tmux: a window absent from its session refuses both verbs rather than being assumed gone
ok - tmux: an unfindable session refuses both verbs, so a live agent is never duplicated
ok - tmux: a dead server on this socket refuses both verbs rather than proving absence
ok - reclaim: an unclassifiable endpoint is still refused, so two agents cannot share one
ok - fm-spawn --relaunch: resumes the bound Pi session only for a Pi registration
ok - reclaim: a herdr pane that outlived its stopped server is adopted, never orphaned beside a new tab
ok - fm-control exit: a herdr pane that outlived its stopped server is already-stopped, not gone
ok - reclaim: a herdr rebind is created in the session the record names, never the ambient one
ok - reclaim: a herdr agent that came back with its server refuses, so one worktree keeps one agent
ok - reclaim: a herdr reclaim rebinds the endpoint and leaves the whole rest of the task alone
ok - reclaim: a herdr secondmate whose endpoint is gone is sent to its own respawn owner
ok - reclaim: a rebind refused from a plain shell reports the real cause, not a fabricated session mismatch
ok - relaunch re-reads the backlog item instead of blindly re-running the transition
ok - relaunch heals an item that drifted out of In flight while the task stayed live
ok - away supervision relaunches existing In-flight and queued items under the saturated fresh-spawn spend cap
bash tests/$t.test.sh  87.05s user 97.52s system 71% cpu 4:18.71 total
Evidence: fm-secondmate-harness test log (fixed)

Source: fm-secondmate-harness test log (fixed)

ok - A1 fm-harness.sh secondmate resolves the fallback chain; crew mode unchanged
ok - fm-harness detects only Cursor Agent CLI's exact invocation marker
ok - C1 fm-harness.sh secondmate-model/secondmate-effort resolve the optional tokens; bare harness stays empty (backward-compat)
ok - D1 fm-harness.sh honors a mate override line for its id and changes nothing else
ok - D2 malformed config/secondmate-harness refuses with its line number on every read verb
ok - D3 a config/secondmate-harness that declares no mate line is never refused
ok - pi-signed identity: authoritative launch selection distinguishes shared wrapper ancestry
ok - harness identity: dash-leading ps command names are basename operands, not options
ok - B1 propagate_inheritable_config: copy, idempotence, convergence, absence-mirror, exclusion, no-op, skip diagnostics
ok - B2 spawn: secondmate runs the secondmate harness; its home inherits declared config
ok - B3 spawn: an absent secondmate-harness falls back to the crew harness (backward-compat)
ok - B4 spawn: no config at all -> own harness and no propagation side effects
ok - B5 spawn: an explicit per-spawn harness arg overrides config/secondmate-harness
ok - B6 spawn: an unverified resolved secondmate harness is refused (guard intact)
skip: cursor executable not resolvable in this environment, so the launch could not be built
ok - B5b spawn: FM_BACKEND wins over inherited config/backend
ok - B5c spawn: explicit --backend wins over FM_BACKEND and inherited config/backend
ok - C2 spawn: a bare harness-only secondmate-harness file launches with no model/effort flag (backward-compat)
ok - C1b spawn: a Claude secondmate launch forces transcript saving past an inherited child-session marker
ok - C3 spawn: config/secondmate-harness's model token threads --model into the launch and meta
ok - C4 spawn: config/secondmate-harness's model+effort tokens thread into the launch and meta
ok - C10 spawn: a legacy secondmate-harness file still launches on its first line (opt-in scope)
ok - C11 spawn: a declared pin file that is malformed refuses the spawn with its line number
ok - C5 spawn: an explicit --model overrides config/secondmate-harness's model token; the file's effort token still applies
ok - C6 spawn: an explicit --effort overrides config/secondmate-harness's effort token; the file's model token still applies
ok - C7 spawn: an explicit --harness starts with clean model/effort defaults
ok - C8 spawn: an explicit --harness still honors explicit model/effort flags
ok - C9 spawn: secondmate launch pins supervision to its own harness
ok - C9 spawn: the harness fallback chain still resolves with no tokens; crew/scout launches are unaffected by this feature
ok - B7 bootstrap sweep pushes, re-converges, and mirrors absence; never inherits secondmate-harness
ok - B8 bootstrap sweep propagates config even when the home's tracked files are already current
ok - B9 bootstrap sweep defers new inherited config until the home ignores it
ok - B10 bootstrap sweep materializes and inherits the startup-memory default while fast-forwarding
ok - B12b backend inheritance: present values and primary absence converge exactly
ok - C2b spawn: config/claude-permission-mode=auto reaches a Claude secondmate launch
ok - claude secondmate launches cover the parent-home steering inbox in auto and bypass modes
ok - B12c approval modes follow primary values and primary absence
ok - B12c presentation inheritance: the primary default converges on, and only an explicit opt-out propagates off
ok - B11 bootstrap sweep surfaces config propagation failures
ok - B11 bootstrap rereads completed config writes after partial propagation
ok - B12 config-push propagates via shared live discovery, reports items, rereads on change only, and does not fast-forward
ok - B13 config-push reports dirty, non-allowing, and invalid homes without failing warnings-only runs
ok - B14 config-push exits nonzero on real propagation errors
ok - B14 config-push rereads completed config writes after partial propagation
ok - B15 config reread is per-home, exact-byte, ordered, and pointer-only
ok - B16 config reread isolation, ABSENT, generation safety, send failure, and retry
ok - B20 config reread publication failures retain exact generations for retry
ok - B21 config reread instruction-write failures retain exact retry generations
ok - B21 config reread preserves exact bytes when temporary adoption also fails
ok - B21 config reread serializes concurrent propagation and delivery
ok - B22 full config reread retry queues drain before new publication
ok - B23 mixed config reread delivery failures still bound sent history
ok - B26 config reread delivery stops after the oldest failed generation
ok - B17 config reread skips unchanged homes and reads destination post-write bytes
ok - B18 bootstrap config reread path works; spawn flexibility remains defaults-only
ok - B19 bootstrap respawns before inherited-config reread
ok - B25 spawn quarantines stale rereads without blocking relaunch
ok - B24 bootstrap detect-only mode remains filesystem read-only
# all fm-secondmate-harness tests passed
bash tests/$t.test.sh  58.81s user 77.53s system 51% cpu 4:26.65 total

Notes

Skills used: firstmate-coding-guidelines

Also tidied: the Herdr Pi relaunch test in tests/fm-control-relaunch.test.sh now stubs pi like its sibling tests, so it no longer fails on a machine without Pi installed.

Reproduction (Claude Code 2.1.319, outside tmux): CLAUDE_CODE_CHILD_SESSION=1 claude prints "Transcript saving is off" and writes no transcript, while CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1 CLAUDE_CODE_CHILD_SESSION=1 claude writes one. The Herdr server inherits CLAUDE_CODE_CHILD_SESSION=1 from the Claude session that started it, and every pane inherits the server environment, so an env var set in fm-spawn's own shell never reaches the pane. The override now sits inline in the launch command. The dated record is in docs/verification/runtime-backends.md.

Regression proof: with bin/fm-spawn.sh and bin/fm-control.sh reverted to the base commit, the new tests fail:

  • tests/fm-control-relaunch.test.sh: "not ok - a pin with no model token should keep the recorded model, got 'default'"
  • tests/fm-secondmate-harness.test.sh: "not ok - Claude secondmate launch must force transcript saving in the launch command itself"
  • tests/fm-secondmate-liveness.test.sh: "not ok - a pin naming no model must keep the recorded model across the liveness respawn" (see the evidence above)

With the fix, all three pass, and tests/fm-spawn-dispatch-profile.test.sh passes unchanged, which shows ship and scout launches are not affected.

Noticed:

  • The Herdr server environment also carries the starting Claude session's CLAUDE_PID, CLAUDE_CODE_SESSION_ID, CLAUDE_CODE_MESSAGING_SOCKET/TOKEN and CLAUDE_EFFORT into every pane. Starting the Herdr server from fm-spawn with those removed would fix the root cause, but that needs Herdr lifecycle work and is out of scope here.

Better idea:

  • Ship and scout Claude launches under Herdr also run with transcript saving off, which breaks Herdr relaunch resume for them too. Applying the same override to every Claude launch would be a one-line follow-up; this PR keeps the requested second mate scope.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed ✅
  • ⚠️ bin/fm-secondmate-liveness-lib.sh:373 - The 'keep model and effort on relaunch' fix only covers fm-control.sh <id> relaunch (bin/fm-control.sh:1048-1062). The other way a secondmate comes back after a restart is the automatic liveness relaunch. When a mate reads as dead or missing (crash, host restart, closed pane), the session-start sweep and the watcher tick call fm-spawn.sh <id> --secondmate --backend <b> with no --model or --effort (bin/fm-secondmate-liveness-lib.sh:373-378). fm-spawn then fills model and effort only from the pin (bin/fm-spawn.sh:3450-3463) and never reads the recorded meta. Concrete case: pin claude, meta model=opus effort=high, the pane dies, the auto-relaunch runs, and the mate comes back with model=default effort=default. That is exactly the 2026-11-06 symptom. The two relaunch paths now also disagree for the same mate. Suggested fix: resolve this at one shared boundary. Either have the liveness respawn pass the recorded model/effort when the pin names neither and the harness is unchanged, or move the 'pin token, else recorded value on the same harness' rule into fm-spawn's secondmate pin resolution so every respawn path gets it. This changes respawn semantics for secondmates, so it needs the author's sign-off.
  • ℹ️ bin/fm-control.sh:1048 - Behavior change: before this change, removing the model or effort token from config/secondmate-harness (for example claude opus high -> claude) and running relaunch reset the mate to the harness defaults. That matched what a fresh spawn does with a bare pin. Now the relaunch keeps the recorded opus/high, and the only way back to defaults is an explicit --model default --effort default. The pin can no longer express 'use the harness default'. Please confirm this is intended and that the operator docs (docs/agent-control.md:83) give enough guidance.

🔧 Fix: Keep recorded secondmate model and effort on liveness respawn
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-secondmate-harness.test.sh - all passed, including the new test_spawn_claude_secondmate_forces_session_persistence, which spawns with CLAUDE_CODE_CHILD_SESSION=1 inherited
  • bash tests/fm-secondmate-liveness.test.sh - all passed, including the new test_sweep_respawn_keeps_the_recorded_model_and_effort
  • bash tests/fm-control-relaunch.test.sh - all passed, including the new test_secondmate_relaunch_without_pin_tokens_keeps_recorded_profile
  • Red check: swapped in the base-commit bin/fm-spawn.sh and re-ran tests/fm-secondmate-liveness.test.sh. It failed with 'a pin naming no model must keep the recorded model across the liveness respawn', so the regression test reproduces the 2026-11-06 symptom. Restored the file afterwards.
  • Ran the session-persistence spawn test alone from a temporary copy of the test file (deleted afterwards) and saved the exact Claude secondmate launch command it captured
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…d effort on relaunch

A Herdr pane inherits its server's environment, so a server first started
from a Claude session hands CLAUDE_CODE_CHILD_SESSION to every pane, and
Claude then turns transcript saving off outside tmux. Claude secondmate
launches now carry CLAUDE_CODE_FORCE_SESSION_PERSISTENCE=1 in the command.

fm-control relaunch let a secondmate pin with no model or effort token
reset both axes to default. A pin without a token now leaves that axis at
its recorded value when the harness stays the same.

Also stub pi in the Herdr Pi relaunch test so it no longer needs a real
Pi install.
@demy00
demy00 merged commit 4123a5e into main Nov 8, 2026
24 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