Repository navigation
feat(bin): let a local secondmate home opt out of inherited Claude seats - #6
Closed
max-metaplanet wants to merge 2 commits into
Closed
max-metaplanet wants to merge 2 commits into
max-metaplanet wants to merge 2 commits into
Conversation
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.
Owner
Author
|
Superseded by #8, the same change rebuilt on the synced main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
config/claude-seat-local. Put it in a local secondmate home's ownconfig/and that home keeps its ownclaude-seat,claude-seats-rootandclaude-seat-threshold(even if they are absent).propagate_inheritable_configinbin/fm-config-inherit-lib.shthen records those three items asskippedwith 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 statushas 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 helpersbin/fm-config-push.shuses.fm_seat_activeinbin/fm-seat-lib.shnow takes an optional config-dir argument so it can read another home's seat.docs/claude-seats.md,docs/configuration.md,AGENTS.mdand the secondmate-provisioning skill. Added tests intests/fm-seat.test.sh,tests/fm-bootstrap.test.shandtests/fm-secondmate-harness.test.shfor 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.fm-seat.sh switch workpushes claude-seat and seats-root to every local secondmate home, and status says none declinetouch config/claude-seat-localkeeps its own personal seat, seats root and threshold through a primary switch, while the other homes take team2fm-seat.sh statuson the primary lists the declining home with the seat it is actually onEvidence: 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
Evidence: Sandbox driver script
Source: Sandbox driver script
Evidence: fm-seat test log
Source: fm-seat test log
Evidence: fm-secondmate-harness test log
Source: fm-secondmate-harness test log
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
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, anerrorstatus 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 isremote_host. A secondmate reached over SSH, includingssh otheruser@localhostor 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 infm-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_optoutnow returns true for any existing path, including a dangling symlink, via[ -e ] || [ -L ]. The error, warning and rc=1 branch is gone frompropagate_inheritable_config. The '(unreadable…)' status row is removed. With no flag present,seat_optoutdefaults 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.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.fm-seat.sh switch workpushes claude-seat and seats-root to every local secondmate home, and status says none declinetouch config/claude-seat-localkeeps its own personal seat, seats root and threshold through a primary switch, while the other homes take team2fm-seat.sh statuson the primary lists the declining home with the seat it is actually on~/.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 touchedbash 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.