feat(provider): show each seat's configured account while usage windows are on #1235
All Vouch review confidence checks passed
Residual risk 0.32 = Change Risk (0.80) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.80 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.080
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #1235"
general
weight: 0.35
mvschwarz
What this does
While
provider.usage_windowsis on,rig provider status(plain and--json) and the provider read model show whichaccount each seat is configured for, where that configuration comes from, and why it isn't linked to an observed
allowance. With the switch off (the default), the read model,
--jsonand plain output are byte-identical to main.Refs slice 01 (OPR.0.7.0.1), mini-requirements 3 and 8.
What existed, and what was missing
-
--jsonbindings[]carried each live Codex seat's registry profile (provider-collect.ts,bindingSource:);codex_auth_seat_registry
- usage rows (
usage[]) stay visible withseats: "unknown".- Plain text never listed a bound seat. It printed only anomaly flags.
- Default-login seats read "seat with no bound account". That covers every Claude seat and any Codex seat with no
registry row. The line is still there, unchanged, but it's untrue for those seats: they run on the daemon's one
CODEX_HOMEor Claude config dir. With the switch on, the new SEATS section is the correct view.- A stale registry row was dropped silently. That's a row for a session that now runs another runtime.
- No configuration source, and nothing explaining why a seat isn't linked to an allowance.
The change
A new additive block,
seatAccounts[], appears only while the switch is on. It comes from one pure function(
provider-seat-accounts.ts) over facts the service already reads.configured, one of:-
registry: a Codex seat with a row inauth-seat-registry.tsv. It carriesprofileRef,recordedAt, andprofileSaved, an existence check on the profile name fromreadCodexAuthMetadata, which lists file names andnever opens a profile. If the profile folder can't be read (any error but "not found"),
profileSavedisnullwith a note saying whether the profile is saved can't be told, and the error code; "not saved" is said only when
the folder was read or is absent. The reader gains an additive
profilesReadfield (absent, read or unreadable),and
profilesstays as before, so the accounts block andsavedProfilesare unchanged.-
default_login: a Codex seat with no row (the login active in the daemon'sCODEX_HOMEwhen the seat launched),or any Claude seat (the daemon's Claude config dir, shared by every Claude seat). A relative or empty
CLAUDE_CONFIG_DIRis named as resolving per seat, the way the launch resolver treats it, not guessed.-
unknown: any other runtime, with the reason. Also a Codex seat with no parsed row when the registry couldn'tbe read (with the error code only) or has malformed rows (with the count): no row is then not evidence of the
default login.
readCodexAuthMetadatagains an additiveregistryfield (absent, read or unreadable, and themalformed-row count) that existing callers ignore.
registryNotes, when a row exists but isn't applied or doesn't match:- a stale row after a runtime change;
- a row whose
runtimecolumn isn'tcodex;- a profile that isn't saved on this host;
- a row whose
rigcolumn names another rig. The profile is still applied, asbindings[]applies it, since theregistry is written keyed by seat alone;
- a row applied to a session name that several seats share (for example two unarchived generations of a same-name
rig): the seat-keyed row can't tell them apart.
allowance: {linked: false, reason}, always, with the exact gap:- a registry profile name and an observed account are different kinds of fact, and nothing supported links them
without reading the profile's contents;
- the usage read reads the login a home holds now, while a seat runs the login active when it launched.
So nothing is joined by spelling, email, equal resets or a shared home.
observed:- Claude: whether the seat's own status line reported windows, from every seat's latest samples (which
ClaudeUsageWindowsnow exposes from the read it already makes, with no query of its own), not from the onesample per window that USAGE shows, with
lastSampledAt, the seat's newest sample time: the samples have no timebound, so "sampled" never reads as "reporting now". And
differsFrom, the seats whose fresh readings on the current row disagreewith it, labelled "possibly a different login … not a verdict". An earlier row's disagreement stays in the usage
history, labelled there. That's the configuration-versus-observed mismatch. Equal resets never link two seats. If
the samples couldn't be read, the seat says so and claims nothing either way. When several seats share the session name, the observation is
{withheld: true, note}: samples are keyed by session name and can't be attributed to one seat.- Codex: "no per-seat observation".
seats: "unknown"and stay visible, including unresolved ones.bindings[]isunchanged.
with notes indented.
- read-only: no setter, switch, auth validation, summing or headroom claim, and no native probe on a read;
- no TUI, cross-host or async refresh;
- no migration, and no change to
startup.ts. The service derives both homes from its own environment, the sameresolution the readers use.
Proof (hermetic)
daemon/test/provider-seat-accounts.test.ts(new, 26 tests).- Pure function, one test per state:
- registry;
- a profile not saved;
- a row whose runtime column isn't
codex;- default login for Codex and Claude;
- absolute, relative and empty
CLAUDE_CONFIG_DIR;- an unknown runtime;
- a stale registry after a runtime change;
- a Claude seat that disagrees with another (labelled both ways);
- samples not available to the read (no claim either way);
-
lastSampledAtis the newest across a seat's windows, in either order;- an unresolved usage row read and left unchanged;
- a registry row naming another rig (applied, noted);
- two Claude seats with the same session name and rig (observations withheld);
- two Codex seats with the same session name and rig: with a registry row, a note on both; without one, none.
- Through the real
ProviderServiceImpl, with seats seeded in a test DB, a fixtureCODEX_HOME(the registry plus amode-000 profile file, which proves only its name is read) and a scratch
HOME:- switch off: no
seatAccounts, and the model is byte-identical to the service without usage windows;- switch on: every seat with its configuration,
bindings[]unchanged, usage rows stillseats: "unknown";- three reads start no native probe, and the fixture homes' file trees (paths, sizes, mtimes) are unchanged.
- On the production path (real migrated SQLite samples,
latestClaudeWindowSamples,ClaudeUsageWindows, theservice; identity answers are fixtures):
- two fresh seats with the same reset: the one whose sample USAGE doesn't show is still sampled, and only a seat
with no sample reads "none yet";
- a three-week-old sample: still sampled, with its own time;
- a profile folder with mode 000 (skipped as root):
profileSaved: null, with the can't-tell note and the code, no"not saved" anywhere in the model, and no accounts or
savedProfiles, as before; an absent folder: "not saved";- a repaired disagreement (an earlier divergent row, then equal current samples under another identity): the history
keeps the old difference, and SEATS shows none;
- a registry with mode 000 (skipped as root): unknown, with EACCES; one malformed row: unknown, with the count,
while a parsed row still applies; no registry: default login;
- an empty
CLAUDE_CONFIG_DIRwith two seats: per seat,home: null, neverHOME/.claude.- A mutation check failed 3 of the 13: always-saved profiles, a dropped
differsFrom, and a service without the block.provider-usage-windows-service.test.ts: the existing "switch on: the rest of the model is unchanged" test nowexpects
usageandseatAccountsas the last two keys.cli/test/provider-usage-windows.test.ts: the SEATS render for registry, default login and unknown, with notes,"differs from" and
--jsonverbatim; a withheld observation's note; the unreadable-registry, empty-config-dir andsamples-not-available wordings; a sampled seat's "last reported windows at <time>" line; a profile whose saved state
is unknown ("whether the profile is saved: unknown", never "not saved"); and no SEATS section without the key.
clean; targeted set passes: daemon 84/84, CLI 34/34.
fails its tests (sampled seats: 4; current differences, with both current-row conditions removed: 1; registry reads: 2; empty config dir: 2). Build and lint clean; targeted
set passes: daemon 94/94 (adding the registry reader's tests), CLI 35/35; all 24 daemon provider and reactive-tap
files pass, 286/286. Then
lastSampledAt: dropping it fails 5 tests, and taking the first time instead of the newestfails 1. Build and lint clean; targeted set: daemon 96/96, CLI 36/36.
restoring the CLI's old check fails its render test. Build and lint clean; targeted set: daemon 98/98, CLI 37/37;
all 24 daemon provider and reactive-tap files, 290/290.
6d5f6c54(before the rebase): build and lint clean. Head against that main on the same box:- daemon 15220 passed (main 15207, +13 new), CLI 4369 (main 4367, +2 new), UI 941 (unchanged);
- 9 failures on both, identical: environment-only tests on this box (relay
git clean×2, a scenario seed refusedunder an ambient tmux, seat-launch Node probe ×3, terminal-pipe UTF-8, and the stub verified-send pair, which
differs only in ids and ports). No failure is new.
ea5dd85b): build and lint (typecheck against the new main) clean; targeted setpasses: daemon 81/81 (seat-accounts, the usage-windows service, Codex usage windows, Claude usage and its reader),
CLI 33/33 (provider usage windows and provider).
Not in this change
🤖 Generated with Claude Code
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
New Features
Provider status now shows configured account details for each seat, identifying registry profiles, default logins, or unknown sources.
Seat details include configuration notes, available usage observations, and explanations when allowances cannot be linked to configured accounts.
Compatibility
* JSON output and existing usage details remain unchanged. Seat details appear only when seat-account information is available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->