← Back to Pull requests

feat(provider): show each seat's configured account while usage windows are on #1235

Closed
unknown closed this pull request without merging on Oct 13, 2026 18:54 UTC
View on GitHub
unknown unknown commented on Oct 13, 2026 16:06 UTC
Author

What this does

While provider.usage_windows is on, rig provider status (plain and --json) and the provider read model show which
account 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, --json and 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

  • Already there:

  • - --json bindings[] carried each live Codex seat's registry profile (provider-collect.ts, bindingSource:
    codex_auth_seat_registry
    );
    - usage rows (usage[]) stay visible with seats: "unknown".
  • Missing or misleading:

  • - 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_HOME or 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 in auth-seat-registry.tsv. It carries profileRef, recordedAt, and
    profileSaved, an existence check on the profile name from readCodexAuthMetadata, which lists file names and
    never opens a profile. If the profile folder can't be read (any error but "not found"), profileSaved is null
    with 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 profilesRead field (absent, read or unreadable),
    and profiles stays as before, so the accounts block and savedProfiles are unchanged.
    - default_login: a Codex seat with no row (the login active in the daemon's CODEX_HOME when the seat launched),
    or any Claude seat (the daemon's Claude config dir, shared by every Claude seat). A relative or empty
    CLAUDE_CONFIG_DIR is 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't
    be read (with the error code only) or has malformed rows (with the count): no row is then not evidence of the
    default login. readCodexAuthMetadata gains an additive registry field (absent, read or unreadable, and the
    malformed-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 runtime column isn't codex;
    - a profile that isn't saved on this host;
    - a row whose rig column names another rig. The profile is still applied, as bindings[] applies it, since the
    registry 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
    ClaudeUsageWindows now exposes from the read it already makes, with no query of its own), not from the one
    sample per window that USAGE shows, with lastSampledAt, the seat's newest sample time: the samples have no time
    bound, so "sampled" never reads as "reporting now". And differsFrom, the seats whose fresh readings on the current row disagree
    with 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".
  • Unchanged: the usage rows keep seats: "unknown" and stay visible, including unresolved ones. bindings[] is

  • unchanged.
  • Plain text: a SEATS section after USAGE, one line per seat (configured account and source, "allowance not linked"),

  • with notes indented.
  • Scope:

  • - 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 same
    resolution 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);
    - lastSampledAt is 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 fixture CODEX_HOME (the registry plus a
    mode-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 still seats: "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, the
    service; 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_DIR with two seats: per seat, home: null, never HOME/.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 now

  • expects usage and seatAccounts as 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 --json verbatim; a withheld observation's note; the unreadable-registry, empty-config-dir and
    samples-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.
  • After review (shared session names, a rig mismatch): removing the fix fails the 3 new daemon tests. Build and lint

  • clean; targeted set passes: daemon 84/84, CLI 34/34.
  • Second review round (sampled seats, current differences, registry reads, an empty config dir): undoing each fix

  • 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 newest
    fails 1. Build and lint clean; targeted set: daemon 96/96, CLI 36/36.
  • Third review round (an unreadable profile folder): restoring the old folder read fails the mode-000 test, and

  • 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.
  • Full gate, run at main 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 refused
    under 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.
  • At the rebased head (on main ea5dd85b): build and lint (typecheck against the new main) clean; targeted set

  • passes: 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

  • the TUI, cross-host aggregation and async refresh (later slice 01 work);

  • any linked allowance: no supported fact links a configured seat to an observed allowance today;

  • native proof (U1-U7 on real accounts): not run.
  • 🤖 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 -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: mvschwarz Review duration: 167m
    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
    0.80
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 80.2% (HIGH) · Higher = larger blast radius
    80.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 31.7% · Safe to merge
    31.7%