Repository navigation
feat(bin): lightweight read-only Claude seat quota board - #5555
Closed
max-metaplanet wants to merge 21 commits into
Closed
max-metaplanet wants to merge 21 commits into
max-metaplanet wants to merge 21 commits into
Conversation
…ne (#2) * fix(bin): keep a decision open until its own key is resolved A worker's `done:` line retired every open decision on a ship or scout task. The decision stopped being listed, `fm-send.sh --resolve-key` could no longer find its key to answer it, and `fm-captain-hold.sh`'s completion gate saw an empty set and let the task finish with the captain's question still owed. The contract in every worker brief (bin/fm-brief.sh rule 6) always said the opposite: a decision or blocker stays open until a `resolved` line carrying its exact key lands, and a later `done:` or `working:` line never closes it. The brief was right; the fold was wrong, so the fold changes. _fm_decision_fold_line is the one owner of "is this key open", and every reader already consults it - the whole-file fold fm-send reads, the cursor-backed fold the OPEN DECISIONS surface reads, the per-key history read, and the decision-origin walk. Removing the terminal rule there fixes all of them at once and removes the task-kind plumbing that existed only to serve it. The persisted fold version is bumped so cursors folded under the old reading are rebuilt rather than trusted. fm-send's refusal no longer asserts "already closed or mistyped" - a claim about the record it had not established. It now reports what the lookup found: a key the log really closed names the verb that closed it, and a key no line ever stated says exactly that, and says it does not prove the decision was answered. * test: follow the fold's contract in every downstream reader The completion gate, the crew reading, and the fleet snapshot each had a case asserting that a `done:` or `failed:` line clears an open decision. Each now asserts what the fold actually promises: the decision survives the terminal line and clears only when its own key is closed. The fleet-snapshot case is the Lavish-103 property, and its surviving half is unchanged - report PROSE never opens or reopens a decision. What moved is how a finished scout stops being pending: it needs a real close (an answer, or the durable captain-held transfer fm-captain-hold.sh writes before completion) rather than the `done:` line discarding the record. The clean report-pointer reading is still asserted, now behind that close. * fix(bin): report a transferred decision as transferred, not settled A `captain-held` line closes the status ledger by moving the question to a durable captain-held task; it does not answer it. The refusal lumped that in with a genuine resolution and told the caller the decision was "already closed", which is the same false certainty this refusal was rewritten to stop producing - the answer may still be owed. Wording only. No lookup was added: the search still covers the decision slug and the legacy derived id, and a transferred row is commonly keyed by neither. That gap is real and is left to be filed separately; what changes here is that the message now says what it searched, says the close was a transfer, and points at the transfer line for the task that holds the question. * fix(bin): report only the captain-hold lookups that actually ran The rewritten --resolve-key refusals removed one false claim and left another standing. Every branch asserted that no captain-held task was open, but fm_send_hold_resolved_id returns before any lookup when tasks-axi is not on PATH, so in a home without it - or any PATH-stripped context - the refusal reported an empty ledger it had never read. That is the same substitution of a fact about itself for a fact about the world that "already closed or mistyped" made, one ledger over. The three refusals now take that sentence from fm_send_hold_clause, which says whether the ledger was searched and held neither id open, or could not be read at all and its contents are unknown. No lookup behaviour is added; the code only stops claiming a result it does not have. The readability flag is computed in the caller's own shell, not inside fm_send_hold_resolved_id, because that function runs in a command substitution: a value assigned there dies with the subshell, leaving the clause to report a search that never ran. The first attempt at this fix did exactly that, and the new test is what caught it. The `needs-decision | blocked` branch is removed rather than hardened. No non-racing input reaches it - status_key_closing_verb folds a strict subset of the lines the open-set fold reads, through the same _fm_decision_fold_line - and its one reachable path was a race a retry resolves, where it told the operator they had found a reader defect and sent them chasing a bug that does not exist. The `*)` fallback already carries the rule that an unfound key is never called settled. docs/architecture.md stated the no-close-on-terminal rule without exception, which this change made false: the fleet snapshot still clears a task's published open decisions from its own lifecycle reading rather than from the fold. The two agreed on a terminal log before the fold stopped closing there, so the gap is pre-existing but newly visible. The divergence is now stated rather than contradicted, and filed as snapshot-closes-decisions; bin/fm-fleet-snapshot.sh's clearing behaviour is deliberately unchanged here. status_open_decisions and _fm_status_open_decision_origins drop the kept-but-ignored <kind> parameter, and their three in-repo call sites drop the argument. The task kind also leaves the persisted cursor version, where it discarded an otherwise-valid cursor and forced a full re-fold whenever a task's .meta kind changed, for no difference in the result. An earlier commit message in this branch claimed these reads were already deleted; they were not, and that claim is corrected here rather than quietly made true. Removing them left _fm_status_kind referenced nowhere in the repo, so the function goes too. bin/fm-crew-state.sh is deliberately untouched: its stale contract header is real but belongs to an unlanded sibling branch that owns that file.
…nreadable reads as `unreadable` (#1) * fix(bin): read a crew's run inventory by the repository no-mistakes actually recorded The crew-state reader answered `state: unknown - source: run-step - unreadable runs table` for crews whose branch simply had no validation run, so a readable state read as an unknown worker. Root cause, established from source and reproduced live against no-mistakes v1.72.0: `no-mistakes axi`'s runs table is capped at ten rows by the CLI itself, which declares the cap in its own `count: <shown> of <total> total` line. Firstmate correctly refuses to treat that window as complete and recovers the whole same-branch inventory from the CLI's own state database - but it looked the repository up by the TASK WORKTREE path, and no-mistakes registers a repository under its PRIMARY CHECKOUT path, never under a linked worktree. The lookup matched zero rows for every crew, since every crew works in an isolated worktree, and the reader reported the whole inventory unreadable. The same failed lookup also lost a genuinely running validation whenever the cap hid its row. Neither offered lead was the trigger. The cap is the CLI's own and is declared, not hidden; the ANSI version banner goes to stderr, which every call in this path discards. Fix, entirely in firstmate's own code: resolve the worktree's primary checkout from `git rev-parse --path-format=absolute --git-common-dir` and ask for it after the worktree path, each still an exact `working_path` match requiring exactly one recorded row. Nothing is guessed among candidates, and a repository recorded under neither path still reports the read as unreadable - naming both paths it asked for. A run-step read that fails now reports `state: unreadable` rather than `state: unknown`, and every such detail opens with what could not be read and why. `unreadable` is the one state word that is a claim about the reader rather than about the crew; the script header owns that contract. Five previously indistinguishable read failures now name their own cause. Scope is the run-step reader only - the pane, remote-endpoint and metadata sources still report `unknown`. Consumers match `working`, `paused`, `parked`, `done` and `failed` positively, so `unreadable` is handled exactly as `unknown` was. Five colocated tests, each confirmed to fail against the pre-fix code first: a task worktree whose branch has no run reads absent; a run hidden beyond the CLI cap is recovered; an unreadable inventory reports the read failure and its reason; a repository recorded under neither path still reads unreadable; and a non-canonical task copy path still reaches its recorded repository. * no-mistakes(review): recognize unreadable crew state in fleet snapshot and docs * no-mistakes(review): correct unreadable contract header and undecidable detail wording * no-mistakes(review): state one cause per unreadable detail; correct branch narrative Two wording fixes, plus the corrected reproduction account this branch owed. Fix 1 - the overview-failure emit spliced the ENTIRE selection reason into its own `run ids:` field. `${run_choice##*|}` strips through the last `|`, and the reworded reasons contain none, so a whole sentence carrying its own `run ids:` clause landed where ids belong: one crew line asserting two different causes, with prose sitting inside a run-id list. Reachable whenever the bounded `no-mistakes axi` call exits non-zero after printing part of the table. Now only the candidate ids are spliced, for every selection shape, and an empty id list adds nothing rather than a dangling comma. Fix 2 - `the displayed runs table names runs the state database does not have` fires when BOTH reads succeeded and merely disagree (a run pruned between the `axi` call and the sqlite read), yet it inherited the shared `could not read the complete run inventory for this branch:` opening. That contradicted the contract this branch just wrote: a read that failed says so; a read that succeeded names the thing it could not settle. It now opens with `could not settle ...`; the four genuine read failures keep the read wording. === Corrected reproduction account === The reproduction narrative in 44da25f is wrong and is corrected here rather than left to stand. It opened by attributing `state: unknown - source: run-step - unreadable runs table` to the worktree-path repo lookup. The source disproves that: at base 8c1cdb7 the lookup failure prints `complete same-branch run inventory unreadable; run ids: `, while `unreadable runs table; run ids: ` comes ONLY from the awk structural/invalid_run branches, which a well-formed `count: 10 of 11 total` header with zero same-branch rows never reaches. One input set - a real linked git worktree whose primary checkout is what no-mistakes recorded, a real capped `no-mistakes axi` overview (v1.72.0) carrying its own `count: 10 of 11 total`, and a branch with no run of its own - run through three code generations of fm_nm_select_run: pre-43bf6d3 -> unknown|unreadable runs table; run ids: 43bf6d3 -> unknown|complete same-branch run inventory unreadable; run ids: this change -> absent The first line is byte-identical to the 2026-09-21 17:55 EDT capture, including the empty run ids. 1. The captured STRING was produced by pre-43bf6d3 code. 43bf6d3 landed 2026-09-21 03:49:53 -0700 (06:49 EDT), about eleven hours before the capture, and changed that wording. This change does not fix the code path that printed those exact words. 2. 43bf6d3 changed the wording and LEFT THE VERDICT. The same crews, in the same condition, still read `state: unknown - source: run-step` on post-43bf6d3 code; only the detail text moved. Had the observed home been updated before 17:55, those two crews would still have read unknown, with different words. 3. Two successive causes of one continuing symptom: - Cause 1 (pre-43bf6d3): awk's uninitialized `seen` was string-compared against `expected`, so a legitimately zero-row recovered inventory took the structural-failure branch instead of `absent`. Closed by 43bf6d3's `+0` coercion. - Cause 2 (43bf6d3 onward): the same commit switched the repo lookup from the overview's own `repo:` line to the task worktree path. A task worktree is never the recorded `working_path`, so the recovery that would establish `absent` fails before it starts. Closed by this change. 4. 43bf6d3 closed cause one and opened cause two. Its stated premise that the real CLI overview never carries a `repo: ` identity line is false: live `no-mistakes axi` v1.72.0 prints `repo: <primary checkout>`, verified read-only against a registered repository on 2026-09-21. 5. 43bf6d3's own regression test passed only because its fixture registered the repository at the worktree path - the shape a standalone clone has, not the shape a crew has. The symptom survived the test written to catch it. That gap is what the new linked-worktree tests in this change close. 6. Caveat, kept visible rather than tidied away: the observed home's firstmate revision at 17:55 cannot be read from here, so the pre-43bf6d3 attribution is inference from the capture plus the code - now backed by a byte-match reproduction rather than by resemblance. 7. Conclusion, stated rather than left to be inferred: this change fixes the SYMPTOM THAT WAS REPORTED, not a lookalike, because the verdict persisted across both causes and only the wording changed. Both things are true and both are said here: the fix is needed, and the fix explains what we saw. === Corrected consumer claim === 44da25f also asserted that consumers match `working`, `paused`, `parked`, `done` and `failed` positively, so `unreadable` is handled exactly as `unknown` was. That was false. One consumer matches the unread verdict ITSELF positively: fm-fleet-snapshot.sh's secondmate home summary selected only `.current_state.state == "unknown"` to report `child_current_unavailable`, so every crew reporting the new word silently dropped out of that set and the home summary called itself valid. Review caught it; the selector now accepts BOTH words, the sources that still emit `unknown` keep working, and the script header names that consumer so any future one inherits the obligation. * no-mistakes(review): stop inventory verdicts claiming causes they cannot know Fix 1 - the sqlite reader's shell fallback asserted an inferred cause with four reachable outcomes behind it: `the state-database reader (python3) did not run here`. That branch is taken whenever `fm_nm_bounded` returns non-zero, which covers no bounding tool on PATH and python3 absent (the claim is true), but ALSO the reader being killed by the per-read budget and the reader dying before printing - in both of which it ran. This change's own tests exercise those two: the time-bound test installs a `python3` that sleeps past a 1s budget, and the no-sqlite test drives an unimportable `sqlite3` through the same line. It now reports the outcome the caller actually observed - `the state-database reader (python3) could not be run or did not finish` - which is true for all four. This was the change's own defect class turned on itself: a reader must not advertise a precision it does not have. Folded in, same strings: the shared opening clause is now `could not read this branch's run inventory: ` (44 characters, from 59). bin/fm-bearings-snapshot.sh renders an in-flight ship's `doing:` at 90 characters, so the WHY now survives with 46 characters of cause instead of 31. Bearings itself is unchanged - only these strings. The settle-class opening keeps its own verb for the reasons where every read succeeded. Fix 2 - the overview-failure emit guarded only the trailing side of its id list, so an absent record id rendered `run ids: , 01A, 01B`. Empty is the NORMAL shape for exactly the population this change targets: `axi status` for a crew whose branch has no run of its own prints no `id:` key at all. The list is now built from the non-empty parts on both sides, so each of the four combinations renders cleanly and an empty list renders nothing. Correction to 523d2b4's body: it claimed "an empty id list adds nothing rather than a dangling comma". That was only half true - it held for an empty OVERVIEW id list and not for an empty RECORD id, which is the commoner case. Fix 2 above makes it true on both sides. The neighbouring `run id: ` emit one line up renders the same empty tail, but that shape is base behaviour (`run inventory unavailable; run id: ` at 8c1cdb7), so it is deliberately left alone rather than widening this change. * no-mistakes(document): name the unreadable verdict in stale crew-state doc comments * no-mistakes(ci): The check failed because of a test count this PR left out of date, not because of a code defect. The PR adds a test to tests/fm-fleet-snapshot-view.test.sh ("home summary reports an unreadable child state as current-state-unavailable"). Under stock Bash 3.2.57, all 19 tests in that file passed, but the "Stock macOS Bash snapshot compatibility" step in .github/workflows/ci.yml requires exactly 18 passing tests, so it failed with "expected 18 ... got 19". I changed the expected count in that step and its error message from 18 to 19. I checked it locally: running the file with /bin/bash (GNU bash 3.2.57) gives 19 `ok -` lines and no other output. The Bearings count of 59 was not changed, because this PR does not touch the Bearings test file
* feat(bin): add opt-in local Claude usage threshold warner
A threshold warner, not a viewer: fm-usage-warner.sh runs quota-axi's
existing read-only --json snapshot (never a credential refresh) and
posts a macOS Notification Center banner, edge-triggered with a
de-dupe record, only when a configured window crosses a configured
percentage. Silent and inert when unconfigured; arm refuses without a
threshold or off macOS. Reuses the watcher's existing check-shim
cadence rather than a new schedule or daemon.
* no-mistakes(review): Replace usage-warner timeout knob with fixed 10s read bound
* no-mistakes(review): Cut usage-warner read bound to fit FM_CHECK_TIMEOUT
* no-mistakes(document): Point usage-warner doc at configuration.md schema owner
* no-mistakes(ci): Shard 5 (fm-usage-warner.test.sh) failed because of this PR, and that is now fixed. Shard 7 (fm-contributions.test.sh) failed for a reason outside this PR, so I left it alone. - **Shard 5:** `action_arm` refuses to run on anything but macOS before it checks for thresholds. The arm tests ran on a Linux runner without a Darwin stub. So `test_arm_refuses_without_a_configured_threshold` got "only available on macOS" when it expected "no threshold configured", and the three arm tests after it would have failed the same way. Fix: the test now makes one `uname` stub that prints Darwin (`DARWIN_BIN`) and puts it first on PATH for every `arm` call. The Linux-refusal test keeps its own stub that prints Linux. `bin/fm-usage-warner.sh` is unchanged. Checked: all 19 cases pass on macOS, all 19 pass with a fake `uname` printing Linux on PATH to stand in for the CI runner, and `shellcheck -x` is clean. - **Shard 7:** the failing assertion is `test_reservation_defers_later_url_when_fifteen_seconds_do_not_remain` ("a later PR began without the fifteen-second observation reservation"). It depends on the wall clock and a 20-second budget. This PR changes only usage-warner files (`bin/fm-usage-warner.sh`, its test, and docs) and does not touch `fm-contributions`. This looks like a timing flake on the runner, not something this change caused. The only file changed is `tests/fm-usage-warner.test.sh`, and it is not committed
* no-mistakes(ci): Shard 5 failed because of this PR, and the fix is in `tests/fm-usage-warner.test.sh`. `bin/fm-usage-warner.sh` is unchanged. The failing case was `test_arm_writes_and_binds_the_check_and_disarm_removes_it`, which reported "arm must succeed: could not write .../state/usage-warner.check.sh". The last fix round put a `uname` stub that prints Darwin in front of every `arm` call. But the stat helpers in `bin/fm-pr-lib.sh` (`fm_pr_file_device`, `fm_pr_file_mode`) also check `uname`, so the stub sent them to BSD `/usr/bin/stat -f` on the Linux runner. That call fails, so `shim_write` could never succeed. The symlink-refusal case only passed on Linux by accident, because this stat failure produces the same "could not write" message. Fix: - The Darwin stub is now used only by `test_arm_refuses_without_a_configured_threshold`. That check returns before any stat call, so the case still means something on Linux. - The three cases that go through the real shim write (arm/disarm, symlink refusal, armed shim runs a real check) no longer use the stub. They run only when the host is really Darwin. On other platforms the test prints one `ok - ... macOS-only; skipping on <os>` line, the same way `fm-stat-shadowing.test.sh` handles its Darwin-only cases. `arm` itself refuses to run anywhere but macOS, so those cases have nothing real to test on Linux. Checked: - On macOS, all cases pass. - With a `uname` stub that prints Linux first on PATH (standing in for the CI runner), every case passes or skips as expected and the exit code is 0. - `shellcheck -x` is clean. The change is not committed
…ul rule (#5) * feat(bin): route declared deployment-configuration paths to the careful rule Typed dispatch resolution decided every rule from Jev's reading of the brief, so deployment-configuration work rode on rule wording alone. Measurement of six candidate rewordings found none that beat the current text overall, while the current text still sends vercel.json rewrites, ArgoCD application manifests, CloudFormation templates, Kubernetes and ingress manifests, and deploy scripts to the cheap tier. Add a path fact ahead of the model call. A brief may state the paths it changes or targets on a "Target paths:" line; when one of them matches the resolver's deployment-configuration list, the rule declaring the new "path_force": "deployment-config" field is selected in code with no request to Jev. The rule is found by that declaration rather than by index, so a home whose rules sit in another order routes identically. Approval, rule and profile floors, quota evidence, and the spendPriority argmax run exactly as they do for a model-chosen rule. Paths come only from that explicit line, never from prose, and a brief with no line, no matching path, or a home declaring no path_force keeps the existing Jev call and output unchanged. A forced result reports decided_by: path-forced with the matched path and pattern in place of the model, confidence, and probability lines. * no-mistakes(review): Widen CloudFormation/ArgoCD path facts and document opt-in inertness * no-mistakes(document): Align path-force class summary with resolver fact list * docs: keep the path-force inertness note to one sentence per line * no-mistakes(review): Accept only the documented Target paths line form * no-mistakes(document): Record undocumented Target paths line forms in verification doc
… ones (#4) * feat(bin): switch Claude seats without disturbing running workers Add a way to choose which Claude account (seat) new workers run on, with a one-command manual switch and an optional configurable threshold. A seat is a Claude Code profile directory named by CLAUDE_CONFIG_DIR. Claude Code derives that profile's macOS Keychain service name from a hash of the directory path, so each seat has its own credential store and a worker pointed at a profile that was never logged in stops with "Not logged in" rather than spending the default account. The safety property: a switch changes only what the NEXT worker gets. fm-spawn resolves the seat once per fresh spawn, pre-registers Claude workspace trust in that same profile, and records it as claude_seat= in the task's own record. Every relaunch reads that record instead of re-resolving the setting, so a switch never moves a live or relaunched worker. That is a correctness requirement, not only a billing one: a task's session history lives under its profile directory, so moving it would strand the session. bin/fm-seat.sh is the one command: list, status, probe, add, switch <name>, switch --next, threshold, arm, retire. A switch to a profile with no credentials is refused. `add` creates an empty profile directory and prints the login command; nothing here logs in, copies a credential, or touches the Keychain - the account owner signs a seat in personally. The automatic path reuses the existing condition-to-action watch rather than adding a daemon: condition `threshold-reached`, action `switch --next`. It fires at most once, which is the edge trigger, and is off until a threshold is configured. An unreadable quota is an error, never a crossing. Settings are absent by default, so an unconfigured home behaves exactly as before, and are inherited into secondmate homes. * docs: record the seat probe's Keychain caveat and correct the relaunch wording * fix(bin): keep automatic rotation off the default Claude profile Rotation now covers only named seats under the seats root. The default profile is the account owner's own interactive login: it changes account whenever they sign in somewhere else, and nothing here can tell which account it currently holds, so an automatic switch must never land workers on it. `switch default` stays available as an explicit, manual choice. The seat set is read fresh from the seats root on every step, so nothing assumes which seats exist or that any particular one is present. Also fix a narrow relaunch regression this change surfaced: a task recorded before seats existed carries no claude_seat line, and its launches always took firstmate's own ambient CLAUDE_CONFIG_DIR. Falling through to the bare default would have moved exactly the kind of task the recorded-seat rule exists to leave alone, so a relaunch now keeps that ambient profile. The home's active seat is still never consulted on a relaunch. Docs state plainly that the sign-in prompts in a fresh profile, and the effect of a second login on the default session, are written from documented behaviour rather than an observed sign-in, because verifying them would mean logging in. * fix(bin): keep the reserved default name out of the seat listing A directory literally named "default" under the seats root was listed as a seat but refused by every switch, because that name is reserved for the ambient login. Skip it in the listing, and refuse "add default" with the reason. * no-mistakes(review): Align seat probes, threshold scopes, and non-claude seat recording * no-mistakes(test): Treat rate-limited seat probes as undecided so --force switches * no-mistakes(document): Clarify the seat Keychain approval step in docs * no-mistakes(document): State which seat Keychain probe states are indistinguishable * fix(bin): treat an unreadable Claude credential store as undecided `fm_seat_logged_in` reported "not logged in" whenever every credential source was skipped, including when the Keychain itself could not be read. That conflates "the store says there is no login" with "the store could not be consulted", and the second establishes nothing. Measured read-only against the installed quota-axi on macOS, with no sign-in performed: a profile that was never logged into and a profile that IS signed in but whose one-time Keychain approval has not been granted produce the same report - every source skipped, the keychain unreachable. A signed-in and approved profile instead reports the keychain read as successful. So the unreachable shape cannot tell the first two apart, and treating it as proof of absence refused a correctly signed-in seat with no way through - the state an owner is in moments after logging a seat in, and one that `--force` could not cross because `--force` must never cross a proven-empty verdict. A not-logged-in verdict now requires that every credential source was actually consulted and came back empty. On macOS that is rarely reachable, because an absent Keychain entry reads as unreadable; on a file-backed store, where an empty profile really can be read and found empty, it is reported as before. An undecided read is what `--force` may cross, and crossing it is safe: a forced switch to a genuinely empty seat stops the next worker on its first message with "Not logged in" rather than spending another account. The docs already described this behaviour, so this brings the code up to them and states which probe states can be told apart and which cannot. * no-mistakes(review): Fix harness-switch relaunch seats; keep seats machine-local and propagated * no-mistakes(review): Limit seat-switch propagation to local secondmates via --local-only * no-mistakes(test): Refuse forced switch to a seat with no profile directory * no-mistakes(document): Align seat docs with local-only inheritance and probe verdicts
…ne (#2) * fix(bin): keep a decision open until its own key is resolved A worker's `done:` line retired every open decision on a ship or scout task. The decision stopped being listed, `fm-send.sh --resolve-key` could no longer find its key to answer it, and `fm-captain-hold.sh`'s completion gate saw an empty set and let the task finish with the captain's question still owed. The contract in every worker brief (bin/fm-brief.sh rule 6) always said the opposite: a decision or blocker stays open until a `resolved` line carrying its exact key lands, and a later `done:` or `working:` line never closes it. The brief was right; the fold was wrong, so the fold changes. _fm_decision_fold_line is the one owner of "is this key open", and every reader already consults it - the whole-file fold fm-send reads, the cursor-backed fold the OPEN DECISIONS surface reads, the per-key history read, and the decision-origin walk. Removing the terminal rule there fixes all of them at once and removes the task-kind plumbing that existed only to serve it. The persisted fold version is bumped so cursors folded under the old reading are rebuilt rather than trusted. fm-send's refusal no longer asserts "already closed or mistyped" - a claim about the record it had not established. It now reports what the lookup found: a key the log really closed names the verb that closed it, and a key no line ever stated says exactly that, and says it does not prove the decision was answered. * test: follow the fold's contract in every downstream reader The completion gate, the crew reading, and the fleet snapshot each had a case asserting that a `done:` or `failed:` line clears an open decision. Each now asserts what the fold actually promises: the decision survives the terminal line and clears only when its own key is closed. The fleet-snapshot case is the Lavish-103 property, and its surviving half is unchanged - report PROSE never opens or reopens a decision. What moved is how a finished scout stops being pending: it needs a real close (an answer, or the durable captain-held transfer fm-captain-hold.sh writes before completion) rather than the `done:` line discarding the record. The clean report-pointer reading is still asserted, now behind that close. * fix(bin): report a transferred decision as transferred, not settled A `captain-held` line closes the status ledger by moving the question to a durable captain-held task; it does not answer it. The refusal lumped that in with a genuine resolution and told the caller the decision was "already closed", which is the same false certainty this refusal was rewritten to stop producing - the answer may still be owed. Wording only. No lookup was added: the search still covers the decision slug and the legacy derived id, and a transferred row is commonly keyed by neither. That gap is real and is left to be filed separately; what changes here is that the message now says what it searched, says the close was a transfer, and points at the transfer line for the task that holds the question. * fix(bin): report only the captain-hold lookups that actually ran The rewritten --resolve-key refusals removed one false claim and left another standing. Every branch asserted that no captain-held task was open, but fm_send_hold_resolved_id returns before any lookup when tasks-axi is not on PATH, so in a home without it - or any PATH-stripped context - the refusal reported an empty ledger it had never read. That is the same substitution of a fact about itself for a fact about the world that "already closed or mistyped" made, one ledger over. The three refusals now take that sentence from fm_send_hold_clause, which says whether the ledger was searched and held neither id open, or could not be read at all and its contents are unknown. No lookup behaviour is added; the code only stops claiming a result it does not have. The readability flag is computed in the caller's own shell, not inside fm_send_hold_resolved_id, because that function runs in a command substitution: a value assigned there dies with the subshell, leaving the clause to report a search that never ran. The first attempt at this fix did exactly that, and the new test is what caught it. The `needs-decision | blocked` branch is removed rather than hardened. No non-racing input reaches it - status_key_closing_verb folds a strict subset of the lines the open-set fold reads, through the same _fm_decision_fold_line - and its one reachable path was a race a retry resolves, where it told the operator they had found a reader defect and sent them chasing a bug that does not exist. The `*)` fallback already carries the rule that an unfound key is never called settled. docs/architecture.md stated the no-close-on-terminal rule without exception, which this change made false: the fleet snapshot still clears a task's published open decisions from its own lifecycle reading rather than from the fold. The two agreed on a terminal log before the fold stopped closing there, so the gap is pre-existing but newly visible. The divergence is now stated rather than contradicted, and filed as snapshot-closes-decisions; bin/fm-fleet-snapshot.sh's clearing behaviour is deliberately unchanged here. status_open_decisions and _fm_status_open_decision_origins drop the kept-but-ignored <kind> parameter, and their three in-repo call sites drop the argument. The task kind also leaves the persisted cursor version, where it discarded an otherwise-valid cursor and forced a full re-fold whenever a task's .meta kind changed, for no difference in the result. An earlier commit message in this branch claimed these reads were already deleted; they were not, and that claim is corrected here rather than quietly made true. Removing them left _fm_status_kind referenced nowhere in the repo, so the function goes too. bin/fm-crew-state.sh is deliberately untouched: its stale contract header is real but belongs to an unlanded sibling branch that owns that file.
…nreadable reads as `unreadable` (#1) * fix(bin): read a crew's run inventory by the repository no-mistakes actually recorded The crew-state reader answered `state: unknown - source: run-step - unreadable runs table` for crews whose branch simply had no validation run, so a readable state read as an unknown worker. Root cause, established from source and reproduced live against no-mistakes v1.72.0: `no-mistakes axi`'s runs table is capped at ten rows by the CLI itself, which declares the cap in its own `count: <shown> of <total> total` line. Firstmate correctly refuses to treat that window as complete and recovers the whole same-branch inventory from the CLI's own state database - but it looked the repository up by the TASK WORKTREE path, and no-mistakes registers a repository under its PRIMARY CHECKOUT path, never under a linked worktree. The lookup matched zero rows for every crew, since every crew works in an isolated worktree, and the reader reported the whole inventory unreadable. The same failed lookup also lost a genuinely running validation whenever the cap hid its row. Neither offered lead was the trigger. The cap is the CLI's own and is declared, not hidden; the ANSI version banner goes to stderr, which every call in this path discards. Fix, entirely in firstmate's own code: resolve the worktree's primary checkout from `git rev-parse --path-format=absolute --git-common-dir` and ask for it after the worktree path, each still an exact `working_path` match requiring exactly one recorded row. Nothing is guessed among candidates, and a repository recorded under neither path still reports the read as unreadable - naming both paths it asked for. A run-step read that fails now reports `state: unreadable` rather than `state: unknown`, and every such detail opens with what could not be read and why. `unreadable` is the one state word that is a claim about the reader rather than about the crew; the script header owns that contract. Five previously indistinguishable read failures now name their own cause. Scope is the run-step reader only - the pane, remote-endpoint and metadata sources still report `unknown`. Consumers match `working`, `paused`, `parked`, `done` and `failed` positively, so `unreadable` is handled exactly as `unknown` was. Five colocated tests, each confirmed to fail against the pre-fix code first: a task worktree whose branch has no run reads absent; a run hidden beyond the CLI cap is recovered; an unreadable inventory reports the read failure and its reason; a repository recorded under neither path still reads unreadable; and a non-canonical task copy path still reaches its recorded repository. * no-mistakes(review): recognize unreadable crew state in fleet snapshot and docs * no-mistakes(review): correct unreadable contract header and undecidable detail wording * no-mistakes(review): state one cause per unreadable detail; correct branch narrative Two wording fixes, plus the corrected reproduction account this branch owed. Fix 1 - the overview-failure emit spliced the ENTIRE selection reason into its own `run ids:` field. `${run_choice##*|}` strips through the last `|`, and the reworded reasons contain none, so a whole sentence carrying its own `run ids:` clause landed where ids belong: one crew line asserting two different causes, with prose sitting inside a run-id list. Reachable whenever the bounded `no-mistakes axi` call exits non-zero after printing part of the table. Now only the candidate ids are spliced, for every selection shape, and an empty id list adds nothing rather than a dangling comma. Fix 2 - `the displayed runs table names runs the state database does not have` fires when BOTH reads succeeded and merely disagree (a run pruned between the `axi` call and the sqlite read), yet it inherited the shared `could not read the complete run inventory for this branch:` opening. That contradicted the contract this branch just wrote: a read that failed says so; a read that succeeded names the thing it could not settle. It now opens with `could not settle ...`; the four genuine read failures keep the read wording. === Corrected reproduction account === The reproduction narrative in 44da25f is wrong and is corrected here rather than left to stand. It opened by attributing `state: unknown - source: run-step - unreadable runs table` to the worktree-path repo lookup. The source disproves that: at base 8c1cdb7 the lookup failure prints `complete same-branch run inventory unreadable; run ids: `, while `unreadable runs table; run ids: ` comes ONLY from the awk structural/invalid_run branches, which a well-formed `count: 10 of 11 total` header with zero same-branch rows never reaches. One input set - a real linked git worktree whose primary checkout is what no-mistakes recorded, a real capped `no-mistakes axi` overview (v1.72.0) carrying its own `count: 10 of 11 total`, and a branch with no run of its own - run through three code generations of fm_nm_select_run: pre-43bf6d3 -> unknown|unreadable runs table; run ids: 43bf6d3 -> unknown|complete same-branch run inventory unreadable; run ids: this change -> absent The first line is byte-identical to the 2026-09-21 17:55 EDT capture, including the empty run ids. 1. The captured STRING was produced by pre-43bf6d3 code. 43bf6d3 landed 2026-09-21 03:49:53 -0700 (06:49 EDT), about eleven hours before the capture, and changed that wording. This change does not fix the code path that printed those exact words. 2. 43bf6d3 changed the wording and LEFT THE VERDICT. The same crews, in the same condition, still read `state: unknown - source: run-step` on post-43bf6d3 code; only the detail text moved. Had the observed home been updated before 17:55, those two crews would still have read unknown, with different words. 3. Two successive causes of one continuing symptom: - Cause 1 (pre-43bf6d3): awk's uninitialized `seen` was string-compared against `expected`, so a legitimately zero-row recovered inventory took the structural-failure branch instead of `absent`. Closed by 43bf6d3's `+0` coercion. - Cause 2 (43bf6d3 onward): the same commit switched the repo lookup from the overview's own `repo:` line to the task worktree path. A task worktree is never the recorded `working_path`, so the recovery that would establish `absent` fails before it starts. Closed by this change. 4. 43bf6d3 closed cause one and opened cause two. Its stated premise that the real CLI overview never carries a `repo: ` identity line is false: live `no-mistakes axi` v1.72.0 prints `repo: <primary checkout>`, verified read-only against a registered repository on 2026-09-21. 5. 43bf6d3's own regression test passed only because its fixture registered the repository at the worktree path - the shape a standalone clone has, not the shape a crew has. The symptom survived the test written to catch it. That gap is what the new linked-worktree tests in this change close. 6. Caveat, kept visible rather than tidied away: the observed home's firstmate revision at 17:55 cannot be read from here, so the pre-43bf6d3 attribution is inference from the capture plus the code - now backed by a byte-match reproduction rather than by resemblance. 7. Conclusion, stated rather than left to be inferred: this change fixes the SYMPTOM THAT WAS REPORTED, not a lookalike, because the verdict persisted across both causes and only the wording changed. Both things are true and both are said here: the fix is needed, and the fix explains what we saw. === Corrected consumer claim === 44da25f also asserted that consumers match `working`, `paused`, `parked`, `done` and `failed` positively, so `unreadable` is handled exactly as `unknown` was. That was false. One consumer matches the unread verdict ITSELF positively: fm-fleet-snapshot.sh's secondmate home summary selected only `.current_state.state == "unknown"` to report `child_current_unavailable`, so every crew reporting the new word silently dropped out of that set and the home summary called itself valid. Review caught it; the selector now accepts BOTH words, the sources that still emit `unknown` keep working, and the script header names that consumer so any future one inherits the obligation. * no-mistakes(review): stop inventory verdicts claiming causes they cannot know Fix 1 - the sqlite reader's shell fallback asserted an inferred cause with four reachable outcomes behind it: `the state-database reader (python3) did not run here`. That branch is taken whenever `fm_nm_bounded` returns non-zero, which covers no bounding tool on PATH and python3 absent (the claim is true), but ALSO the reader being killed by the per-read budget and the reader dying before printing - in both of which it ran. This change's own tests exercise those two: the time-bound test installs a `python3` that sleeps past a 1s budget, and the no-sqlite test drives an unimportable `sqlite3` through the same line. It now reports the outcome the caller actually observed - `the state-database reader (python3) could not be run or did not finish` - which is true for all four. This was the change's own defect class turned on itself: a reader must not advertise a precision it does not have. Folded in, same strings: the shared opening clause is now `could not read this branch's run inventory: ` (44 characters, from 59). bin/fm-bearings-snapshot.sh renders an in-flight ship's `doing:` at 90 characters, so the WHY now survives with 46 characters of cause instead of 31. Bearings itself is unchanged - only these strings. The settle-class opening keeps its own verb for the reasons where every read succeeded. Fix 2 - the overview-failure emit guarded only the trailing side of its id list, so an absent record id rendered `run ids: , 01A, 01B`. Empty is the NORMAL shape for exactly the population this change targets: `axi status` for a crew whose branch has no run of its own prints no `id:` key at all. The list is now built from the non-empty parts on both sides, so each of the four combinations renders cleanly and an empty list renders nothing. Correction to 523d2b4's body: it claimed "an empty id list adds nothing rather than a dangling comma". That was only half true - it held for an empty OVERVIEW id list and not for an empty RECORD id, which is the commoner case. Fix 2 above makes it true on both sides. The neighbouring `run id: ` emit one line up renders the same empty tail, but that shape is base behaviour (`run inventory unavailable; run id: ` at 8c1cdb7), so it is deliberately left alone rather than widening this change. * no-mistakes(document): name the unreadable verdict in stale crew-state doc comments * no-mistakes(ci): The check failed because of a test count this PR left out of date, not because of a code defect. The PR adds a test to tests/fm-fleet-snapshot-view.test.sh ("home summary reports an unreadable child state as current-state-unavailable"). Under stock Bash 3.2.57, all 19 tests in that file passed, but the "Stock macOS Bash snapshot compatibility" step in .github/workflows/ci.yml requires exactly 18 passing tests, so it failed with "expected 18 ... got 19". I changed the expected count in that step and its error message from 18 to 19. I checked it locally: running the file with /bin/bash (GNU bash 3.2.57) gives 19 `ok -` lines and no other output. The Bearings count of 59 was not changed, because this PR does not touch the Bearings test file
* feat(bin): add opt-in local Claude usage threshold warner
A threshold warner, not a viewer: fm-usage-warner.sh runs quota-axi's
existing read-only --json snapshot (never a credential refresh) and
posts a macOS Notification Center banner, edge-triggered with a
de-dupe record, only when a configured window crosses a configured
percentage. Silent and inert when unconfigured; arm refuses without a
threshold or off macOS. Reuses the watcher's existing check-shim
cadence rather than a new schedule or daemon.
* no-mistakes(review): Replace usage-warner timeout knob with fixed 10s read bound
* no-mistakes(review): Cut usage-warner read bound to fit FM_CHECK_TIMEOUT
* no-mistakes(document): Point usage-warner doc at configuration.md schema owner
* no-mistakes(ci): Shard 5 (fm-usage-warner.test.sh) failed because of this PR, and that is now fixed. Shard 7 (fm-contributions.test.sh) failed for a reason outside this PR, so I left it alone. - **Shard 5:** `action_arm` refuses to run on anything but macOS before it checks for thresholds. The arm tests ran on a Linux runner without a Darwin stub. So `test_arm_refuses_without_a_configured_threshold` got "only available on macOS" when it expected "no threshold configured", and the three arm tests after it would have failed the same way. Fix: the test now makes one `uname` stub that prints Darwin (`DARWIN_BIN`) and puts it first on PATH for every `arm` call. The Linux-refusal test keeps its own stub that prints Linux. `bin/fm-usage-warner.sh` is unchanged. Checked: all 19 cases pass on macOS, all 19 pass with a fake `uname` printing Linux on PATH to stand in for the CI runner, and `shellcheck -x` is clean. - **Shard 7:** the failing assertion is `test_reservation_defers_later_url_when_fifteen_seconds_do_not_remain` ("a later PR began without the fifteen-second observation reservation"). It depends on the wall clock and a 20-second budget. This PR changes only usage-warner files (`bin/fm-usage-warner.sh`, its test, and docs) and does not touch `fm-contributions`. This looks like a timing flake on the runner, not something this change caused. The only file changed is `tests/fm-usage-warner.test.sh`, and it is not committed
* no-mistakes(ci): Shard 5 failed because of this PR, and the fix is in `tests/fm-usage-warner.test.sh`. `bin/fm-usage-warner.sh` is unchanged. The failing case was `test_arm_writes_and_binds_the_check_and_disarm_removes_it`, which reported "arm must succeed: could not write .../state/usage-warner.check.sh". The last fix round put a `uname` stub that prints Darwin in front of every `arm` call. But the stat helpers in `bin/fm-pr-lib.sh` (`fm_pr_file_device`, `fm_pr_file_mode`) also check `uname`, so the stub sent them to BSD `/usr/bin/stat -f` on the Linux runner. That call fails, so `shim_write` could never succeed. The symlink-refusal case only passed on Linux by accident, because this stat failure produces the same "could not write" message. Fix: - The Darwin stub is now used only by `test_arm_refuses_without_a_configured_threshold`. That check returns before any stat call, so the case still means something on Linux. - The three cases that go through the real shim write (arm/disarm, symlink refusal, armed shim runs a real check) no longer use the stub. They run only when the host is really Darwin. On other platforms the test prints one `ok - ... macOS-only; skipping on <os>` line, the same way `fm-stat-shadowing.test.sh` handles its Darwin-only cases. `arm` itself refuses to run anywhere but macOS, so those cases have nothing real to test on Linux. Checked: - On macOS, all cases pass. - With a `uname` stub that prints Linux first on PATH (standing in for the CI runner), every case passes or skips as expected and the exit code is 0. - `shellcheck -x` is clean. The change is not committed
…ul rule (#5) * feat(bin): route declared deployment-configuration paths to the careful rule Typed dispatch resolution decided every rule from Jev's reading of the brief, so deployment-configuration work rode on rule wording alone. Measurement of six candidate rewordings found none that beat the current text overall, while the current text still sends vercel.json rewrites, ArgoCD application manifests, CloudFormation templates, Kubernetes and ingress manifests, and deploy scripts to the cheap tier. Add a path fact ahead of the model call. A brief may state the paths it changes or targets on a "Target paths:" line; when one of them matches the resolver's deployment-configuration list, the rule declaring the new "path_force": "deployment-config" field is selected in code with no request to Jev. The rule is found by that declaration rather than by index, so a home whose rules sit in another order routes identically. Approval, rule and profile floors, quota evidence, and the spendPriority argmax run exactly as they do for a model-chosen rule. Paths come only from that explicit line, never from prose, and a brief with no line, no matching path, or a home declaring no path_force keeps the existing Jev call and output unchanged. A forced result reports decided_by: path-forced with the matched path and pattern in place of the model, confidence, and probability lines. * no-mistakes(review): Widen CloudFormation/ArgoCD path facts and document opt-in inertness * no-mistakes(document): Align path-force class summary with resolver fact list * docs: keep the path-force inertness note to one sentence per line * no-mistakes(review): Accept only the documented Target paths line form * no-mistakes(document): Record undocumented Target paths line forms in verification doc
… ones (#4) * feat(bin): switch Claude seats without disturbing running workers Add a way to choose which Claude account (seat) new workers run on, with a one-command manual switch and an optional configurable threshold. A seat is a Claude Code profile directory named by CLAUDE_CONFIG_DIR. Claude Code derives that profile's macOS Keychain service name from a hash of the directory path, so each seat has its own credential store and a worker pointed at a profile that was never logged in stops with "Not logged in" rather than spending the default account. The safety property: a switch changes only what the NEXT worker gets. fm-spawn resolves the seat once per fresh spawn, pre-registers Claude workspace trust in that same profile, and records it as claude_seat= in the task's own record. Every relaunch reads that record instead of re-resolving the setting, so a switch never moves a live or relaunched worker. That is a correctness requirement, not only a billing one: a task's session history lives under its profile directory, so moving it would strand the session. bin/fm-seat.sh is the one command: list, status, probe, add, switch <name>, switch --next, threshold, arm, retire. A switch to a profile with no credentials is refused. `add` creates an empty profile directory and prints the login command; nothing here logs in, copies a credential, or touches the Keychain - the account owner signs a seat in personally. The automatic path reuses the existing condition-to-action watch rather than adding a daemon: condition `threshold-reached`, action `switch --next`. It fires at most once, which is the edge trigger, and is off until a threshold is configured. An unreadable quota is an error, never a crossing. Settings are absent by default, so an unconfigured home behaves exactly as before, and are inherited into secondmate homes. * docs: record the seat probe's Keychain caveat and correct the relaunch wording * fix(bin): keep automatic rotation off the default Claude profile Rotation now covers only named seats under the seats root. The default profile is the account owner's own interactive login: it changes account whenever they sign in somewhere else, and nothing here can tell which account it currently holds, so an automatic switch must never land workers on it. `switch default` stays available as an explicit, manual choice. The seat set is read fresh from the seats root on every step, so nothing assumes which seats exist or that any particular one is present. Also fix a narrow relaunch regression this change surfaced: a task recorded before seats existed carries no claude_seat line, and its launches always took firstmate's own ambient CLAUDE_CONFIG_DIR. Falling through to the bare default would have moved exactly the kind of task the recorded-seat rule exists to leave alone, so a relaunch now keeps that ambient profile. The home's active seat is still never consulted on a relaunch. Docs state plainly that the sign-in prompts in a fresh profile, and the effect of a second login on the default session, are written from documented behaviour rather than an observed sign-in, because verifying them would mean logging in. * fix(bin): keep the reserved default name out of the seat listing A directory literally named "default" under the seats root was listed as a seat but refused by every switch, because that name is reserved for the ambient login. Skip it in the listing, and refuse "add default" with the reason. * no-mistakes(review): Align seat probes, threshold scopes, and non-claude seat recording * no-mistakes(test): Treat rate-limited seat probes as undecided so --force switches * no-mistakes(document): Clarify the seat Keychain approval step in docs * no-mistakes(document): State which seat Keychain probe states are indistinguishable * fix(bin): treat an unreadable Claude credential store as undecided `fm_seat_logged_in` reported "not logged in" whenever every credential source was skipped, including when the Keychain itself could not be read. That conflates "the store says there is no login" with "the store could not be consulted", and the second establishes nothing. Measured read-only against the installed quota-axi on macOS, with no sign-in performed: a profile that was never logged into and a profile that IS signed in but whose one-time Keychain approval has not been granted produce the same report - every source skipped, the keychain unreachable. A signed-in and approved profile instead reports the keychain read as successful. So the unreachable shape cannot tell the first two apart, and treating it as proof of absence refused a correctly signed-in seat with no way through - the state an owner is in moments after logging a seat in, and one that `--force` could not cross because `--force` must never cross a proven-empty verdict. A not-logged-in verdict now requires that every credential source was actually consulted and came back empty. On macOS that is rarely reachable, because an absent Keychain entry reads as unreadable; on a file-backed store, where an empty profile really can be read and found empty, it is reported as before. An undecided read is what `--force` may cross, and crossing it is safe: a forced switch to a genuinely empty seat stops the next worker on its first message with "Not logged in" rather than spending another account. The docs already described this behaviour, so this brings the code up to them and states which probe states can be told apart and which cannot. * no-mistakes(review): Fix harness-switch relaunch seats; keep seats machine-local and propagated * no-mistakes(review): Limit seat-switch propagation to local secondmates via --local-only * no-mistakes(test): Refuse forced switch to a seat with no profile directory * no-mistakes(document): Align seat docs with local-only inheritance and probe verdicts
…nd a Claude seat A home can configure two mechanisms that each choose a Claude worker's configuration directory: `config/claude-account` and an active seat. Composed, the account pin's `env` launch consumes the seat's plain assignment rather than being overridden by it, so the pin silently won while workspace trust was pre-registered in the seat's profile - launching the worker against a store holding no trust entry, where it meets a trust dialog it cannot answer. Refuse that combination in `bin/fm-spawn.sh` before any endpoint, worktree, or task record exists, naming both files by path and saying that removing either one resolves it. Also document the seat setup route that carries the owner's shared body, and state this page's platform scope.
… the re-picked versions on current upstream
…orker account pin
…irectories differ
feat(bin): sync fork onto current upstream and refuse conflicting worker account pin with Claude seat
* feat(bin): let one local home decline inherited Claude seats 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. * no-mistakes(review): Treat any claude-seat-local path as a plain decline * no-mistakes(document): Deduplicate claude-seat-local docs between configuration and seats guide
… Herdr (#10) * fix(control): keep a modal composer typable across lifecycle actions Claude's optional vim editor mode makes Escape - which is also its interrupt key - leave the composer's text entry. Everything typed after that is read as editor commands instead of text: `/exit` is consumed as the search, end-of-word, delete-char and insert commands, and only the trailing `t` reaches the composer. On Herdr the Claude payload proof catches the fragment and refuses with `send-failed`, so `fm-control exit` reported that the exit command could not be sent and a wedged worker could not be stopped, interrupted out of the state, or relaunched. The interrupt now restores text entry when its own key took it away, proven from the harness's rendered indicator and only on a still-running agent. Exit types its command once more when a refusal is attributable to the mode: the composer was not taking text when the command was typed and is taking text now, which is what the refused `/exit` does to itself. Nothing is typed to establish that, so a composer with no modal editor - which renders no indicator either way - is never touched by a refusal it did not cause, and a refusal with any other cause is still reported. bin/fm-control-lib.sh gains the per-harness indicator and insert key, bin/fm-backend.sh gains the raw unsubmitted send the restore needs. Verified live in an isolated Herdr lab on herdr 0.9.1 with claude in vim mode: interrupt, exit after that interrupt, relaunch, and exit against a composer an earlier Escape had already left in command mode. * no-mistakes(test): Read whole Herdr capture for Claude slash-command payload proof
…eservation flake (#9) * fix(test): publish the contribution mock clock atomically tests/fm-contributions.test.sh advanced its mock clock with an in-place truncate-then-write: `printf '%s\n' "$(( $(cat "$FORGE/clock") + N ))" > "$FORGE/clock"`. The contribution poll reads that same file for every `date +%s`, and several forge reads run in parallel, so a concurrent reader could open the file inside the truncate window, read an empty string, and evaluate `$(( + N ))` to the bare offset. That collapsed the clock from a real epoch to a single-digit number, so the poll's `DEADLINE - now` check saw roughly 1.79 billion seconds of budget left, cleared the fifteen-second observation reserve, and began a later PR the test requires it to defer. The reservation itself was taken and evaluated correctly; what the poll could not observe was the clock advance the fixture had lost. Advance the clock through one `advance_clock` helper that publishes by rename, so every reader sees a whole value, and refuse a clock that does not read back as an epoch instead of silently producing an offset. Product behavior is unchanged: the budget, the fifteen-second reserve, and the deferral rule are untouched. * no-mistakes(review): Correct advance_clock comment to the writer-vs-writer race
…n extra-usage policy (#11) * feat(seat): automatic Claude seat mode with destination headroom and an extra-usage policy Seat switching had a trigger but no judgement about where it was switching to: next_seat picked the next seat that was merely logged in, never reading its quota, so it could land on a seat that was nearly empty. The watch also fired once and had to be re-armed by hand, and when a seat's plan quota ran out, work rolled silently into paid extra usage with nothing to stop it. Three controls, each off when absent, each counting percent LEFT: claude-seat-threshold trigger: the ACTIVE seat drops to N% left claude-seat-destination-min a DESTINATION must exceed X% left claude-seat-extra-usage `stop`, or `allow <usd>`, when none qualifies A candidate below the minimum is skipped and named with its measured headroom; a candidate whose quota gives no verdict is skipped as unknown rather than guessed at in either direction; if none qualifies, nothing is switched. With no minimum configured the rotation gate stays login-only and no candidate quota is read at all. The extra-usage policy gates NEW claude dispatch through fm-spawn: `stop` holds once the active seat's plan quota is gone, `allow <usd>` holds once the seat's extra_usage spend reaches the cap, and an unreadable quota holds rather than launching on a guess. A relaunch is never held, because that is recovery of work already under way. --ignore-seat-hold pushes one spawn through without changing the setting. State the limit plainly rather than implying a spend guarantee: firstmate chooses which seat new work starts on and whether it starts, but cannot stop a worker already running from drawing extra usage mid-task. `stop` therefore means stop STARTING work, plus a warning the moment a running worker's seat enters extra usage, sent through the usage warner's notification path. The watch is now a registered repeating check rather than the one-shot condition-action primitive: one crossing fires at most once per seat, and the seat it moves to fires again on its own crossing with nothing re-armed. arm and retire both clear any older one-shot registration so an upgrading home ends with one watch. The usage warner counted percent USED while every seat setting counted percent REMAINING, so the two read as contradicting each other. It now counts percent left too, names both figures on every line it prints so a config carried over from the old reading announces itself, and gains a `threshold <window-id> <percent-left>` setter matching fm-seat.sh's in shape and direction, plus a `notify` action that makes it the one owner of this home's notification path. fm-check-shim-lib.sh factors out the check-shim write, trust binding, and rollback that fm-usage-warner.sh already carried, so the seat watch adds a fourth consumer without a fourth copy. * no-mistakes(review): Unstick auto seat watch, bound quota reads, share hold reasons * no-mistakes(test): Word no-headroom wake as future hold, matching status
…'s quota fm-seat-board.sh renders each seat's quota-axi report (account, window percent-left/reset, extra-usage spend, attention lines) as one local page on 127.0.0.1, caching reads to stay under quota-axi's rate limit.
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.
Summary
bin/fm-seat-board.sh, a small read-only local web page showing quota-axi's report for every Claude seat side by side: account email, each window's percent left and reset time, extra-usage spend against its cap, any attention line quota-axi reports (shown as-is), and which seat is active for new workers.serve(default) regenerates the page into a scratch directory at most once a minute and serves it viapython3 -m http.serverbound to 127.0.0.1 only; Ctrl-C stops it.renderprints one generated page to stdout for a one-shot look or testing.bin/fm-seat-lib.sh's ownfm_seat_quota_read, which passes--no-credential-refreshand never--allow-keychain-prompt. The script never switches, arms, or edits any seat setting.docs/claude-seats.mdand a behavior test suite (tests/fm-seat-board.test.sh) driven by a stubbedquota-axi, no network and no real account.Test plan
bash tests/fm-seat-board.test.shpassesshellcheck bin/fm-seat-board.sh tests/fm-seat-board.test.shclean (only informational SC1091 notices, same as the rest of the repo)renderandserveagainst real local seats and confirmed the page content and that Ctrl-C/SIGTERM cleans up the scratch server directory