Skip to content

feat(bin): let a local secondmate home opt out of inherited Claude seats - #6

Closed
max-metaplanet wants to merge 2 commits into
mainfrom
fm/seat-local-optout
Closed

max-metaplanet wants to merge 2 commits into
mainfrom
fm/seat-local-optout

Conversation

@max-metaplanet

Copy link
Copy Markdown
Owner

Intent

we should fix our gap

The gap: seat switching pushes the active Claude seat into every local secondmate home on this machine with no way for a home to decline.
An operator who wants one local home spending a separate account - billing separation is the concrete case, one home on a personal or a client account while the rest run on the team account - cannot have that today; a switch takes the choice away from them silently.

The fix, with one non-negotiable constraint: the default stays exactly what it is now - a switch reaches every local home and the whole machine moves together.
What is missing is a per-home way to decline, so the fleet-wide default is preserved and only a home that deliberately opts out is left alone.
A home that opts out must be visible in the switch status, because a setting that silently does nothing is the failure mode to avoid.

Also settle, as findings rather than by expanding the change: the local-propagation design assumes two local homes on one machine share a filesystem and a credential store; establish whether a local secondmate can be deliberately sandboxed under a different OS user or container, and if it can, what that means for the design.

What Changed

  • Added a per-home opt-out flag, config/claude-seat-local. Put it in a local secondmate home's own config/ and that home keeps its own claude-seat, claude-seats-root and claude-seat-threshold (even if they are absent). propagate_inheritable_config in bin/fm-config-inherit-lib.sh then records those three items as skipped with a reason. This happens at every local convergence point: the push after a switch, the session-start sweep, and a secondmate launch. Only the file's presence counts, and any path type does, including a directory or a dangling symlink. The flag is never inherited itself. With the flag nowhere on the machine, propagation works as it did before.
  • bin/fm-seat.sh status has a new section listing each local secondmate home that opts out, with that home's id, the seat it is actually on and its path. When no home opts out, it prints (none - every local home takes this seat). Home discovery reuses the helpers bin/fm-config-push.sh uses. fm_seat_active in bin/fm-seat-lib.sh now takes an optional config-dir argument so it can read another home's seat.
  • Documented the flag in docs/claude-seats.md, docs/configuration.md, AGENTS.md and the secondmate-provisioning skill. Added tests in tests/fm-seat.test.sh, tests/fm-bootstrap.test.sh and tests/fm-secondmate-harness.test.sh for the skip at each convergence point, the default behavior staying unchanged, and the status listing.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change is a small presence-flag check on the destination home inside the one shared propagation loop, and default behaviour is unchanged when no flag is present. The fix round implements exactly the two-state behaviour the user asked for, and behavioural tests cover the file, directory and dangling-symlink flags.

Testing

I ran the real seat switch and status CLI against an isolated set of homes. I stubbed only the credential probe (quota-axi) and the tmux/herdr nudge path; nothing else was faked. Six scenarios were driven live: the default where no home declines, one home declining with its own seat/root/threshold, status visibility, the declining home running its own switch, adversarial flag types, and removing the flag. All six behaved as intended. I then ran the three targeted test files that cover the switch push, the session-start sweep and secondmate launch. Every decline-related test passed. Because those were automated tests with fakes, the sweep and launch scenarios are recorded as untested live. One bootstrap test failed: it expects an older crew-dispatch error message. This change doesn't touch any dispatch code, so that failure predates it. The 'not every secondmate home was updated' warning in the transcript is not caused by the opt-out. It appears because the gate environment (NO_MISTAKES_GATE) refuses the config reread nudge. There is no UI surface, so there are no screenshots; the evidence is a CLI transcript.

  • Live validation: ✅ go - 6 of 8 scenarios driven live against the product
Scenario Result Live Evidence
Default unchanged: with no claude-seat-local anywhere, fm-seat.sh switch work pushes claude-seat and seats-root to every local secondmate home, and status says none decline ✅ pass live seat-optout-transcript.txt section S1 (and S6 after the flags are removed)
A home with touch config/claude-seat-local keeps its own personal seat, seats root and threshold through a primary switch, while the other homes take team2 ✅ pass live seat-optout-transcript.txt S2: 'claude-seat: skipped - home declines inherited seat settings (config/claude-seat-local)' for sm-client; sm-client keeps personal/personal-seats/40; fleet1 and fleet2 mo…
The decline is visible: fm-seat.sh status on the primary lists the declining home with the seat it is actually on ✅ pass live seat-optout-transcript.txt S3: 'client\tpersonal\t…/sm-client' under 'local secondmate homes declining inherited seats:'
A declining home can still run its own switch, and that switch doesn't reach back into the primary ✅ pass live seat-optout-transcript.txt S4: sm-client switches personal -> client; primary claude-seat stays team2
Adversarial: a flag containing 'off', a directory flag, and a dangling-symlink flag on homes with no seat of their own all still decline; none of them gets the primary's value, and each is listed in s… ✅ pass live seat-optout-transcript.txt S5: all three homes show all 3 items skipped, fleet1 and fleet2 files stay absent, and status lists client, fleet1 and fleet2. The trailing warning comes from the reread nud…
Removing the flag restores fleet-wide convergence for that home on the next switch ✅ pass live seat-optout-transcript.txt S6: every home is pushed 'work', and status shows none declining
The session-start secondmate sweep (fm-bootstrap) honours a home's decline and converges every other home ⏸️ untested no The earlier run only checked this with the automated tests/fm-bootstrap.test.sh test, which uses fakes, so no live result was recorded. A live check would mean starting a real firstmate session that b…
Secondmate launch honours a home's decline while other homes still inherit ⏸️ untested no The earlier run only checked this with the automated tests/fm-secondmate-harness.test.sh test, which uses a fake backend, so no live result was recorded. A live check needs a bin/fm-herdr-lab.sh lab s…
Evidence: CLI transcript of switch/status across declining and non-declining local homes

Source: CLI transcript of switch/status across declining and non-declining local homes

=== S1 default: no opt-out anywhere, switch reaches every home ===
$ FM_HOME=/tmp/fm-seat-optout.d2SnET/primary fm-seat.sh switch work
switched: default -> work
applies to NEW claude workers only; running workers keep their own seat
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
●  WATCHER DOWN - SUPERVISION IS OFF
●  2 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.
●  watcher supervision needs Stop-owned automatic recovery; inspect the hook registration and startup status before ending the turn.
●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
config-push: /tmp/fm-seat-optout.d2SnET/primary -> live secondmate homes
secondmate fleet1 (/private/tmp/fm-seat-optout.d2SnET/sm-fleet1):
  crew-dispatch.json: unchanged
  crew-harness: unchanged
  backlog-backend: unchanged
  backend: unchanged
  herdr-presentation-spaces: unchanged
  startup-memory-budget: unchanged
  trace-context: unchanged - session-scoped
  launch-env-allowlist: unchanged
  claude-permission-mode: unchanged
  lavish-axi-host: unchanged
  claude-seat: pushed
  claude-seats-root: pushed
  claude-seat-threshold: unchanged
  data/captain-shared.md: unchanged
CONFIG_REREAD: secondmate fleet1: send failed: error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
secondmate fleet2 (/private/tmp/fm-seat-optout.d2SnET/sm-fleet2):
  crew-dispatch.json: unchanged
  crew-harness: unchanged
  backlog-backend: unchanged
  backend: unchanged
  herdr-presentation-spaces: unchanged
  startup-memory-budget: unchanged
  trace-context: unchanged - session-scoped
  launch-env-allowlist: unchanged
  claude-permission-mode: unchanged
  lavish-axi-host: unchanged
  claude-seat: pushed
  claude-seats-root: pushed
  claude-seat-threshold: unchanged
  data/captain-shared.md: unchanged
CONFIG_REREAD: secondmate fleet2: send failed: error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
warning: seat switched here, but not every secondmate home was updated (see above); those homes keep spawning on their previous seat until bin/fm-config-push.sh --local-only succeeds
[exit 0]
    sm-fleet1/config/claude-seat = work
    sm-fleet1/config/claude-seats-root = /tmp/fm-seat-optout.d2SnET/seats
    sm-fleet1/config/claude-seat-threshold = <absent>
    sm-fleet2/config/claude-seat = work
    sm-fleet2/config/claude-seats-root = /tmp/fm-seat-optout.d2SnET/seats
    sm-fleet2/config/claude-seat-threshold = <absent>
local secondmate homes declining inherited seats:
  (none - every local home takes this seat)
[exit 0]

=== S2 one home declines (touch config/claude-seat-local) with its own personal seat ===
$ FM_HOME=/tmp/fm-seat-optout.d2SnET/primary fm-seat.sh switch team2
switched: work -> team2
applies to NEW claude workers only; running workers keep their own seat
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
config-push: /tmp/fm-seat-optout.d2SnET/primary -> live secondmate homes
secondmate client (/private/tmp/fm-seat-optout.d2SnET/sm-client):
  crew-dispatch.json: unchanged
  crew-harness: unchanged
  backlog-backend: unchanged
  backend: unchanged
  herdr-presentation-spaces: unchanged
  startup-memory-budget: unchanged
  trace-context: unchanged - session-scoped
  launch-env-allowlist: unchanged
  claude-permission-mode: unchanged
  lavish-axi-host: unchanged
  claude-seat: skipped - home declines inherited seat settings (config/claude-seat-local)
  claude-seats-root: skipped - home declines inherited seat settings (config/claude-seat-local)
  claude-seat-threshold: skipped - home declines inherited seat settings (config/claude-seat-local)
  data/captain-shared.md: unchanged
secondmate fleet1 (/private/tmp/fm-seat-optout.d2SnET/sm-fleet1):
  crew-dispatch.json: unchanged
  crew-harness: unchanged
  backlog-backend: unchanged
  backend: unchanged
  herdr-presentation-spaces: unchanged
  startup-memory-budget: unchanged
  trace-context: unchanged - session-scoped
  launch-env-allowlist: unchanged
  claude-permission-mode: unchanged
  lavish-axi-host: unchanged
  claude-seat: pushed
  claude-seats-root: unchanged
  claude-seat-threshold: unchanged
  data/captain-shared.md: unchanged
CONFIG_REREAD: secondmate fleet1: send failed: error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
secondmate fleet2 (/private/tmp/fm-seat-optout.d2SnET/sm-fleet2):
  crew-dispatch.json: unchanged
  crew-harness: unchanged
  backlog-backend: unchanged
  backend: unchanged
  herdr-presentation-spaces: unchanged
  startup-memory-budget: unchanged
  trace-context: unchanged - session-scoped
  launch-env-allowlist: unchanged
  claude-permission-mode: unchanged
  lavish-axi-host: unchanged
  claude-seat: pushed
  claude-seats-root: unchanged
  claude-seat-threshold: unchanged
  data/captain-shared.md: unchanged
CONFIG_REREAD: secondmate fleet2: send failed: error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
warning: seat switched here, but not every secondmate home was updated (see above); those homes keep spawning on their previous seat until bin/fm-config-push.sh --local-only succeeds
[exit 0]
    sm-fleet1/config/claude-seat = team2
    sm-fleet1/config/claude-seats-root = /tmp/fm-seat-optout.d2SnET/seats
    sm-fleet1/config/claude-seat-threshold = <absent>
    sm-fleet2/config/claude-seat = team2
    sm-fleet2/config/claude-seats-root = /tmp/fm-seat-optout.d2SnET/seats
    sm-fleet2/config/claude-seat-threshold = <absent>
    sm-client/config/claude-seat = personal
    sm-client/config/claude-seats-root = /tmp/fm-seat-optout.d2SnET/personal-seats
    sm-client/config/claude-seat-threshold = 40

=== S3 status shows the declining home and its real seat ===
$ FM_HOME=/tmp/fm-seat-optout.d2SnET/primary fm-seat.sh status
active seat for NEW workers: team2
active profile: /tmp/fm-seat-optout.d2SnET/seats/team2
login state: logged-in
auto-switch threshold: (unset - no automatic switching)
auto-switch watch: not armed

live workers keep the seat they launched with:
  client	(ambient default login)
  fleet1	(ambient default login)
  fleet2	(ambient default login)

local secondmate homes declining inherited seats:
  client	personal	/private/tmp/fm-seat-optout.d2SnET/sm-client
[exit 0]

=== S4 declining home runs its own switch; primary untouched ===
$ FM_HOME=/tmp/fm-seat-optout.d2SnET/sm-client fm-seat.sh switch client
switched: personal -> client
applies to NEW claude workers only; running workers keep their own seat
config-push: no live secondmate homes found
[exit 0]
    sm-client/config/claude-seat = client
    sm-client/config/claude-seats-root = /tmp/fm-seat-optout.d2SnET/personal-seats
    sm-client/config/claude-seat-threshold = 40
    primary claude-seat = team2

=== S5 adversarial: flag contains 'off'; flag is a dir; flag is dangling symlink; no own seat ===
$ FM_HOME=/tmp/fm-seat-optout.d2SnET/primary fm-seat.sh switch default
switched: team2 -> default
applies to NEW claude workers only; running workers keep their own seat
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
config-push: /tmp/fm-seat-optout.d2SnET/primary -> live secondmate homes
secondmate client (/private/tmp/fm-seat-optout.d2SnET/sm-client):
  crew-dispatch.json: unchanged
  crew-harness: unchanged
  backlog-backend: unchanged
  backend: unchanged
  herdr-presentation-spaces: unchanged
  startup-memory-budget: unchanged
  trace-context: unchanged - session-scoped
  launch-env-allowlist: unchanged
  claude-permission-mode: unchanged
  lavish-axi-host: unchanged
  claude-seat: skipped - home declines inherited seat settings (config/claude-seat-local)
  claude-seats-root: skipped - home declines inherited seat settings (config/claude-seat-local)
  claude-seat-threshold: skipped - home declines inherited seat settings (config/claude-seat-local)
  data/captain-shared.md: unchanged
secondmate fleet1 (/private/tmp/fm-seat-optout.d2SnET/sm-fleet1):
  crew-dispatch.json: unchanged
  crew-harness: unchanged
  backlog-backend: unchanged
  backend: unchanged
  herdr-presentation-spaces: unchanged
  startup-memory-budget: unchanged
  trace-context: unchanged - session-scoped
  launch-env-allowlist: unchanged
  claude-permission-mode: unchanged
  lavish-axi-host: unchanged
  claude-seat: skipped - home declines inherited seat settings (config/claude-seat-local)
  claude-seats-root: skipped - home declines inherited seat settings (config/claude-seat-local)
  claude-seat-threshold: skipped - home declines inherited seat settings (config/claude-seat-local)
  data/captain-shared.md: unchanged
CONFIG_REREAD: secondmate fleet1: send failed: error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
secondmate fleet2 (/private/tmp/fm-seat-optout.d2SnET/sm-fleet2):
  crew-dispatch.json: unchanged
  crew-harness: unchanged
  backlog-backend: unchanged
  backend: unchanged
  herdr-presentation-spaces: unchanged
  startup-memory-budget: unchanged
  trace-context: unchanged - session-scoped
  launch-env-allowlist: unchanged
  claude-permission-mode: unchanged
  lavish-axi-host: unchanged
  claude-seat: skipped - home declines inherited seat settings (config/claude-seat-local)
  claude-seats-root: skipped - home declines inherited seat settings (config/claude-seat-local)
  claude-seat-threshold: skipped - home declines inherited seat settings (config/claude-seat-local)
  data/captain-shared.md: unchanged
CONFIG_REREAD: secondmate fleet2: send failed: error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
warning: seat switched here, but not every secondmate home was updated (see above); those homes keep spawning on their previous seat until bin/fm-config-push.sh --local-only succeeds
[exit 0]
    sm-fleet1/config/claude-seat = <absent>
    sm-fleet1/config/claude-seats-root = <absent>
    sm-fleet1/config/claude-seat-threshold = <absent>
    sm-fleet2/config/claude-seat = <absent>
    sm-fleet2/config/claude-seats-root = <absent>
    sm-fleet2/config/claude-seat-threshold = <absent>
    sm-client/config/claude-seat = client
    sm-client/config/claude-seats-root = /tmp/fm-seat-optout.d2SnET/personal-seats
    sm-client/config/claude-seat-threshold = 40
local secondmate homes declining inherited seats:
  client	client	/private/tmp/fm-seat-optout.d2SnET/sm-client
  fleet1	default	/private/tmp/fm-seat-optout.d2SnET/sm-fleet1
  fleet2	default	/private/tmp/fm-seat-optout.d2SnET/sm-fleet2
[exit 0]

=== S6 removing the flag restores fleet-wide default ===
$ FM_HOME=/tmp/fm-seat-optout.d2SnET/primary fm-seat.sh switch work
switched: default -> work
applies to NEW claude workers only; running workers keep their own seat
WARNING: watcher still down (same stale episode; last beat: never, grace 300s) - full banner already printed this episode.
config-push: /tmp/fm-seat-optout.d2SnET/primary -> live secondmate homes
secondmate client (/private/tmp/fm-seat-optout.d2SnET/sm-client):
  crew-dispatch.json: unchanged
  crew-harness: unchanged
  backlog-backend: unchanged
  backend: unchanged
  herdr-presentation-spaces: unchanged
  startup-memory-budget: unchanged
  trace-context: unchanged - session-scoped
  launch-env-allowlist: unchanged
  claude-permission-mode: unchanged
  lavish-axi-host: unchanged
  claude-seat: pushed
  claude-seats-root: pushed
  claude-seat-threshold: pushed - mirrored primary absence
  data/captain-shared.md: unchanged
CONFIG_REREAD: secondmate client: send failed: error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
secondmate fleet1 (/private/tmp/fm-seat-optout.d2SnET/sm-fleet1):
  crew-dispatch.json: unchanged
  crew-harness: unchanged
  backlog-backend: unchanged
  backend: unchanged
  herdr-presentation-spaces: unchanged
  startup-memory-budget: unchanged
  trace-context: unchanged - session-scoped
  launch-env-allowlist: unchanged
  claude-permission-mode: unchanged
  lavish-axi-host: unchanged
  claude-seat: pushed
  claude-seats-root: pushed
  claude-seat-threshold: unchanged
  data/captain-shared.md: unchanged
CONFIG_REREAD: secondmate fleet1: send failed: error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
secondmate fleet2 (/private/tmp/fm-seat-optout.d2SnET/sm-fleet2):
  crew-dispatch.json: unchanged
  crew-harness: unchanged
  backlog-backend: unchanged
  backend: unchanged
  herdr-presentation-spaces: unchanged
  startup-memory-budget: unchanged
  trace-context: unchanged - session-scoped
  launch-env-allowlist: unchanged
  claude-permission-mode: unchanged
  lavish-axi-host: unchanged
  claude-seat: pushed
  claude-seats-root: pushed
  claude-seat-threshold: unchanged
  data/captain-shared.md: unchanged
CONFIG_REREAD: secondmate fleet2: send failed: error: no-mistakes gate agent must not drive the fleet (NO_MISTAKES_GATE set)
warning: seat switched here, but not every secondmate home was updated (see above); those homes keep spawning on their previous seat until bin/fm-config-push.sh --local-only succeeds
[exit 0]
    sm-fleet1/config/claude-seat = work
    sm-fleet1/config/claude-seats-root = /tmp/fm-seat-optout.d2SnET/seats
    sm-fleet1/config/claude-seat-threshold = <absent>
    sm-fleet2/config/claude-seat = work
    sm-fleet2/config/claude-seats-root = /tmp/fm-seat-optout.d2SnET/seats
    sm-fleet2/config/claude-seat-threshold = <absent>
    sm-client/config/claude-seat = work
    sm-client/config/claude-seats-root = /tmp/fm-seat-optout.d2SnET/seats
    sm-client/config/claude-seat-threshold = <absent>
local secondmate homes declining inherited seats:
  (none - every local home takes this seat)
[exit 0]
Evidence: Sandbox driver script

Source: Sandbox driver script

#!/usr/bin/env bash
# Drives the real bin/fm-seat.sh + bin/fm-config-push.sh against a throwaway
# primary home with three local secondmate homes. Only external oracles are
# stubbed: quota-axi (so no real Claude account is probed) and tmux/herdr (so
# reread nudges can never reach the live session).
set -u
WT=~/.no-mistakes/worktrees/61c6dd39b831/01M38EMSZK94XQT0XGEJ7ACAKR
SB=$(mktemp -d /tmp/fm-seat-optout.XXXXXX)
P=$SB/primary; SEATS=$SB/seats; FB=$SB/fakebin
mkdir -p $P/config $P/state $P/data $SEATS/work $SEATS/team2 $FB $SB/personal-seats/client
printf '%s\n' "$SEATS" > $P/config/claude-seats-root
cat > $FB/quota-axi <<'Q'
#!/usr/bin/env bash
printf '{"schemaVersion":5,"providers":[{"provider":"claude","source":"oauth","account":{"email":"[email protected]"},"quotaSemantics":{"status":"known","effectiveAvailability":[{"scope":"all_models","status":"known","effectivePercentRemaining":80,"runway":{"status":"through_reset"}}]}}]}\n'
Q
for b in tmux herdr; do printf '#!/bin/sh\nexit 0\n' > $FB/$b; done
chmod +x $FB/*
mk_sm() { local id=$1 sm=$SB/sm-$1; mkdir -p $sm/config $sm/data $sm/state $sm/bin
  printf '%s\n' $id > $sm/.fm-secondmate-home; printf 'x\n' > $sm/AGENTS.md
  printf 'window=firstmate:fm-%s\nkind=secondmate\nhome=%s\n' $id $sm > $P/state/$id.meta; echo $sm; }
seat() { local h=$1; shift; echo "\$ FM_HOME=$h fm-seat.sh $*"
  TMUX='' FM_HOME=$h FM_CONFIG_OVERRIDE=$h/config FM_STATE_OVERRIDE=$h/state FM_DATA_OVERRIDE=$h/data \
  CLAUDE_CONFIG_DIR= PATH="$FB:$PATH" $WT/bin/fm-seat.sh "$@" 2>&1; echo "[exit $?]"; }
show() { for f in claude-seat claude-seats-root claude-seat-threshold; do
  printf '    %s/config/%s = %s\n' "$(basename $1)" $f "$(cat $1/config/$f 2>/dev/null || echo '<absent>')"; done; }

A=$(mk_sm fleet1); B=$(mk_sm fleet2)
echo "=== S1 default: no opt-out anywhere, switch reaches every home ==="
seat $P switch work; show $A; show $B
seat $P status | sed -n '/declining/,$p'

echo; echo "=== S2 one home declines (touch config/claude-seat-local) with its own personal seat ==="
C=$(mk_sm client); touch $C/config/claude-seat-local
printf 'personal\n' > $C/config/claude-seat; printf '%s\n' $SB/personal-seats > $C/config/claude-seats-root; printf '40\n' > $C/config/claude-seat-threshold
seat $P switch team2; show $A; show $B; show $C

echo; echo "=== S3 status shows the declining home and its real seat ==="
seat $P status

echo; echo "=== S4 declining home runs its own switch; primary untouched ==="
seat $C switch client; show $C; echo "    primary claude-seat = $(cat $P/config/claude-seat)"

echo; echo "=== S5 adversarial: flag contains 'off'; flag is a dir; flag is dangling symlink; no own seat ==="
printf 'off\n' > $C/config/claude-seat-local
rm -f $A/config/claude-seat*; mkdir $A/config/claude-seat-local
rm -f $B/config/claude-seat*; ln -s $SB/nowhere $B/config/claude-seat-local
seat $P switch default; show $A; show $B; show $C
seat $P status | sed -n '/declining/,$p'

echo; echo "=== S6 removing the flag restores fleet-wide default ==="
rm -rf $A/config/claude-seat-local $B/config/claude-seat-local $C/config/claude-seat-local
seat $P switch work; show $A; show $B; show $C
seat $P status | sed -n '/declining/,$p'
rm -rf "$SB"
Evidence: fm-seat test log

Source: fm-seat test log

ok - an unset seat setting is the ambient default and configures no automatic switching
ok - a switch to a logged-in seat records the seat and nothing else
ok - a switch to a profile that is not logged in is refused and changes nothing
ok - --force does not override a seat proven to be logged out
ok - a rate-limited signed-in seat is undecided, and --force switches onto it
ok - an unreadable credential store reads as undecided and --force may cross it
ok - a forced switch refuses a seat whose profile directory does not exist
ok - switching to the default seat clears the setting and restores ambient behaviour
ok - a seat switch reaches running local secondmate homes and reports each one
ok - a failed secondmate push is reported and never undoes the primary switch
ok - a local home that declines keeps its own three seat settings through a switch
ok - one home's decline leaves every other local home taking the switch
ok - status names every local home that declined and the seat it is really on
ok - a decline flag of any type declines and shows in status
ok - seat settings reach local secondmate homes only and never cross to a remote route
ok - a seat switch pushes only local secondmate homes and never waits on a remote route
ok - fm-config-push reaches remote routes by default and skips them only with --local-only
ok - the auto-switch threshold is configurable, validated, clearable, and unset by default
ok - the threshold condition turns true exactly at the configured percent
ok - an unreadable quota never trips an automatic switch
ok - only account-level quota windows count toward the auto-switch threshold
ok - the default seat's probe and threshold read the ambient profile new workers launch with
ok - rotation chooses the next logged-in seat under the root and skips ones with no credentials
ok - rotation never targets the default profile, even when it is the only other logged-in store
ok - rotation never assumes which seats exist and picks up seats added later
ok - rotation refuses rather than pretending to switch when no other seat is usable
ok - adding a seat creates an empty profile directory and prints the owner's login steps
ok - a directory named 'default' is never offered, added, or rotated to
ok - seat names that are not a single safe path component are refused
ok - an unset seat setting leaves the launch and the task record exactly as before
ok - a spawn launches on the active seat and records it in the task's own record
ok - switching seats leaves a running worker's recorded profile unchanged
ok - after a switch new workers get the new seat while existing ones keep theirs
ok - an ambient CLAUDE_CONFIG_DIR still reaches workers and is recorded per task
ok - a configured seat takes precedence over firstmate's own ambient config dir
ok - a non-claude spawn records no Claude seat while a named seat is active
# all fm-seat tests passed
Evidence: fm-secondmate-harness test log

Source: fm-secondmate-harness test log

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 - 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 - B5a spawn: a home's seat decline holds at secondmate launch; every other home still inherits
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 - 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 - 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 - B12c claude-permission-mode inheritance: present values and primary absence converge exactly
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
- Outcome: ⚠️ 2 infos across 1 run (26m39s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 infos
  • ⚠️ bin/fm-config-inherit-lib.sh:111 - The change adds a third state, 'verdict 2', for when config/claude-seat-local exists but is not a plain regular file (for example a directory, a symlink, or an lstat error). That state has its own error path in propagate_inheritable_config: a per-item warning, an error status and rc=1, which makes the switch print 'not every secondmate home was updated'. It also gets its own '(unreadable …)' row in fm-seat.sh status (bin/fm-seat.sh:170-171). The intent only asks for a per-home decline that shows up in status. Nothing in it requires a separate malformed-flag state. A narrower form would meet the intent: treat any existing path ([ -e ] or lstat present) as a decline. The home would still be listed in status with the seat it is on, so the decline would not be silent. Recommended remedy: remove the verdict-2 branch and its status row, unless the author wants the stricter refusal on purpose.

🔧 Fix applied.
2 infos still open:

  • ℹ️ bin/fm-config-inherit-lib.sh:102 - Intent-requested finding on sandboxing. A local secondmate cannot be placed under a different OS user or in a container. Local homes launch as backend windows (tmux, herdr, zellij or cmux) under the same OS user, from the same fm-spawn.sh process, and share one filesystem. There is no local sudo, user or container placement. The only isolation route is remote_host. A secondmate reached over SSH, including ssh otheruser@localhost or a container running sshd, is classified as remote. That means it never receives the seat items at all, and it does not appear in the declining-homes status. So the shared-filesystem assumption behind local propagation holds for every home that actually receives seats. A sandboxed home is already outside the design and brings its own seat login. The limit: such a home is invisible in fm-seat.sh status, which is by design because remote routes are excluded.
  • ℹ️ bin/fm-config-inherit-lib.sh:108 - Checked the fix round against the user's instruction. fm_config_inherit_seat_optout now returns true for any existing path, including a dangling symlink, via [ -e ] || [ -L ]. The error, warning and rc=1 branch is gone from propagate_inheritable_config. The '(unreadable…)' status row is removed. With no flag present, seat_optout defaults to 0, so default propagation is unchanged. The test covers both a directory flag and a dangling-symlink flag. For each, it asserts that the seat file is untouched, that the switch no longer prints 'not every secondmate home was updated', and that the home appears in status. It does this through the real CLI, not by inspecting source text.
⚠️ **Test** - 2 infos
  • ℹ️ Sandboxing finding (requested by the intent): a local secondmate can't be run under a different OS user or in a container. Local homes are found as filesystem paths from the primary's state/*.meta, validated with validate_secondmate_home, and written by the same OS user. Anything with remote_host is a remote route and never receives seat settings. Seats rely on the same user's macOS Keychain, with one entry per profile keyed off the profile directory's path. So a home under another OS user or in a container would either be unreachable, or would receive seat files that point at profiles whose Keychain credentials it cannot read. Such a home should be modelled as a remote-style route that keeps its own login, not as an inheriting local home. The new claude-seat-local decline also covers this: a home that shares the filesystem but not the credential store can opt out.
  • ℹ️ tests/fm-bootstrap.test.sh:1253 - Unrelated failure: 'no-key use-profile diagnostic changed from main'. The test expects an older crew-dispatch error message, but the validator now appends a provider-pattern clause. This change doesn't touch any crew-dispatch/dispatch code, so the failure predates it and is outside this change.
  • Live validation: ✅ go - 6 of 8 scenarios driven live against the product
Scenario Result Live Evidence
Default unchanged: with no claude-seat-local anywhere, fm-seat.sh switch work pushes claude-seat and seats-root to every local secondmate home, and status says none decline ✅ pass live seat-optout-transcript.txt section S1 (and S6 after the flags are removed)
A home with touch config/claude-seat-local keeps its own personal seat, seats root and threshold through a primary switch, while the other homes take team2 ✅ pass live seat-optout-transcript.txt S2: 'claude-seat: skipped - home declines inherited seat settings (config/claude-seat-local)' for sm-client; sm-client keeps personal/personal-seats/40; fleet1 and fleet2 mo…
The decline is visible: fm-seat.sh status on the primary lists the declining home with the seat it is actually on ✅ pass live seat-optout-transcript.txt S3: 'client\tpersonal\t…/sm-client' under 'local secondmate homes declining inherited seats:'
A declining home can still run its own switch, and that switch doesn't reach back into the primary ✅ pass live seat-optout-transcript.txt S4: sm-client switches personal -> client; primary claude-seat stays team2
Adversarial: a flag containing 'off', a directory flag, and a dangling-symlink flag on homes with no seat of their own all still decline; none of them gets the primary's value, and each is listed in s… ✅ pass live seat-optout-transcript.txt S5: all three homes show all 3 items skipped, fleet1 and fleet2 files stay absent, and status lists client, fleet1 and fleet2. The trailing warning comes from the reread nud…
Removing the flag restores fleet-wide convergence for that home on the next switch ✅ pass live seat-optout-transcript.txt S6: every home is pushed 'work', and status shows none declining
The session-start secondmate sweep (fm-bootstrap) honours a home's decline and converges every other home ⏸️ untested no The earlier run only checked this with the automated tests/fm-bootstrap.test.sh test, which uses fakes, so no live result was recorded. A live check would mean starting a real firstmate session that b…
Secondmate launch honours a home's decline while other homes still inherit ⏸️ untested no The earlier run only checked this with the automated tests/fm-secondmate-harness.test.sh test, which uses a fake backend, so no live result was recorded. A live check needs a bin/fm-herdr-lab.sh lab s…
  • ~/.no-mistakes/evidence/01M38EMSZK94XQT0XGEJ7ACAKR/drive-seat-optout.sh: runs the real bin/fm-seat.sh switch/status (which invokes bin/fm-config-push.sh --local-only) against a throwaway primary home and local secondmate homes under /tmp; quota-axi and tmux/herdr are stubbed so no real account or live session is touched
  • bash tests/fm-seat.test.sh (includes the 4 new decline tests)
  • bash tests/fm-bootstrap.test.sh (test_routine_bootstrap_honours_a_homes_seat_decline)
  • bash tests/fm-secondmate-harness.test.sh (test_spawn_honours_a_homes_seat_decline)
  • Read the code paths for secondmate-home discovery and remote routing, plus the Keychain notes in docs/claude-seats.md, to answer the sandboxing question
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

A seat switch pushed the active Claude seat into every local secondmate home
on this machine, and a home had no way to decline. An operator who wants one
home spending a separate account - one home on a personal or client account
while the rest run on the team account - could not have it, and a switch took
that choice away silently.

The fleet-wide default is unchanged. With no flag anywhere, a switch still
reaches every local home and the whole machine moves together; a regression
assertion in each of the three convergence paths proves it.

A home declines for itself by placing the presence flag config/claude-seat-local
in its OWN config/. bin/fm-config-inherit-lib.sh reads it in the destination
home once, before any item is considered, so all three machine-local seat items
- claude-seat, claude-seats-root, claude-seat-threshold - are skipped for that
home at every local convergence point: the post-switch fm-config-push
--local-only, the session-start secondmate sweep in fm-bootstrap.sh, and every
secondmate launch in fm-spawn.sh. The declining home keeps its own three files
exactly as they are, including absent, and keeps full use of its own switch,
threshold, and arm against itself. The flag is deliberately not inheritable.

The decline is visible, because a setting that silently does nothing is the
failure worth avoiding here: fm-seat.sh status lists every local home that
declined with the seat it is actually on, and a switch names each seat item it
skipped for that home and why. A flag that is not a plain regular file states
no readable intent, so the seat items are refused for that home with an error
rather than resolved by guessing in either direction.

Alternatives considered and ruled out:
- A scoped list on the primary: it puts a home's own billing choice on another
  home, and it drifts as homes are added, renamed, or retired.
- Per-file partial opt-out: no concrete need, and a home on a separate account
  holding the fleet's threshold or seats root is incoherent.
- Inferring the opt-out from a home already holding a different seat: that is
  the silent-behaviour failure again.

Investigated separately, no code change: local propagation assumes two local
homes on one machine share a filesystem and a credential store. That assumption
holds. Firstmate has no supported way to place a local secondmate under a
different OS user or in a container - a local home is a git worktree the primary
reads and writes directly, and its endpoint is created in the primary's own
session, with nothing in bin/ able to change user or enter a container. The
supported way to cross a trust boundary is the remote route, which already
refuses seat settings. No defect found.
@max-metaplanet

Copy link
Copy Markdown
Owner Author

Superseded by #8, the same change rebuilt on the synced main.

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