Repository navigation
feat(account-usage): say what each usage window is tied to - #753
Conversation
AccountUsageWindow.scope: account, or one model by the runtime's own name (claude Opus, Sonnet and model_scoped rows; codex named buckets). Omitted where the runtime says neither. Asked by Raft for its Computers page. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…stops work Co-Authored-By: Claude Opus 5.5 <[email protected]>
479e319 to
d87fd95
Compare
… only Co-Authored-By: Claude Opus 5.5 <[email protected]>
… alias Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
GO at The projections preserve the runtime's distinctions: Claude's OAuth-app window, unnamed non-default Codex buckets, and name-only Kimi rows stay unscoped. Named model windows retain their native names. Existing usage, reset and exhaustion calculations are unchanged. The review corrections are now reflected in the spec and contract:
Validation: 122 targeted tests across the four account readers and query deadlines passed, as did the repository typecheck. Those ran on the original feature commit; range-diff confirms the rebase preserved that patch and subsequent changes only revise documentation and a contract comment. The final diff passes No real account query, login, reset or model call was made. Cross-platform CI remains pending; author owns merge after it passes.
|
<!-- stamp:review:v1 --> <sup><img src="https://api.raft.build/api/avatars/pixel/bXVn.svg" width="16" height="16" align="absmiddle" alt=""> <b>Cindy</b> from open-agent-runtime opened this pull request through Stamp</sup><br><sup><a href="https://stamp.build/review?receipt=prc_ab238713ca1834e477cdf55ade43ffdb"><picture><source media="(prefers-color-scheme: dark)" srcset="https://stamp.build/assets/brand/stamp-glyph-dark.d907ffcadb44.svg"><img src="https://stamp.build/assets/brand/stamp-glyph-light.58a2c10ed108.svg" width="13" height="12" align="absmiddle" alt=""></picture> View in Stamp →</a></sup> --- <!-- /stamp:review:v1 --> Claude limit resets through Claude Code's own interactive UI, and usage windows that say which model they count. ## Claude: limit resets (#752) - New optional member `Runtime.inspectLimitResets(installation, options?)` (Claude only) lists the account's resets per kind: `weekly`, `fable`, `full`, and `five_hour` only with `includeFiveHour: true`. Each kind is `available` (with `resetsLeft` and `expiresText`), `none`, `not_offered`, `unknown` or `not_checked`; the result also carries the Claude Code `version`, and `program: "legacy"` / `fiveHourSpent: true` when the older program answered. - `claudeRuntime` now has `redeemLimitReset(installation, { idempotencyKey, resetId })`; for Claude `resetId` is required and names the kind. Claude's `accountUsage` still reports no `limitResets`: list them with `inspectLimitResets`, not from the usage snapshot. - Claude Code 2.1.322 has no `-p`, SDK or control-protocol form, so OAR drives the hidden `/limit-reset <kind>` command in a pseudo-terminal (the system `script`) and reads the screen. Every screen must match the recorded text word for word apart from dates, counts and percentages (the whole confirmation dialog included); anything else ends the attempt with Esc. Yes is sent at most once, never while inspecting. - At the 5-hour limit, Claude's older reset program spends its reset as soon as any `/limit-reset` opens. Without `fiveHourLimitConsent: true`, OAR reads usage right before the first command and types nothing when the account is at the limit (`consent_required`) or the read fails (`not_attempted` / `usage_unread`). A `weekly`, `fable` or `full` redeem without consent also needs Claude Code's cached feature flags to show the newer reset program, and otherwise answers `consent_required`. A `five_hour` redeem is itself the consent. - An idempotency key is remembered for the life of the process once its attempt typed a command: the same key gets the first answer, never a second Yes; the same key with another `resetId` rejects. An attempt that sent nothing is not remembered. Claude answers a timeout with `not_attempted` or `unknown` instead of rejecting (Codex still rejects). - Each call starts Claude Code's UI, which sends one 1-token model request at startup; on a subscription it likely counts as usage. `inspectLimitResets` is not a passive read: call it on the account owner's request and never poll it. - Linux only, with the system `script` (util-linux) available; anywhere else, or without it, the answer is `unsupported_platform`. (macOS's BSD `script` exits when its stdin is a socket, which Node pipes are there.) - Evidence: the screen recognisers come from Raft's offline harness, which drove the real 2.1.322 UI against a fake backend; the real server's Fable and full screens are unverified, and no real account's reset has been spent through OAR. **Source compatibility.** New exported types: `LimitResetInspection`, `LimitResetInspectOptions`, `LimitResetInspector`, `LimitResetKindStatus`, `LimitResetNotAttemptedReason`, `LimitResetUnsupportedReason`, `AccountUsageWindowScope`; new option `LimitResetOptions.fiveHourLimitConsent`. `LimitResetResult` gains `not_attempted` (`busy`, `deadline`, `usage_unread`, `startup_failed`) and `unknown` (optionally `fiveHourSpent`), and its `unsupported` reason is now typed `LimitResetUnsupportedReason` (the account-usage reasons plus `unsupported_platform`, `unsupported_version`, `reset_id_required`, `consent_required`). Codex's behavior is unchanged, but a host with an exhaustive `switch` over these unions, or one that assigns the reason to `AccountUsageUnsupportedReason`, needs updating. A host that offered redeem only where `redeemLimitReset` exists now sees it on Claude too. `oar list` gains an `inspectLimitResets` key. ## Account usage: window scope (#753) - `AccountUsageWindow.scope`: `{ kind: "account" }` when the runtime reports the window as the account's, `{ kind: "model", name }` when it reports it as one model's, with the runtime's own name kept as given (Claude "Opus", "Sonnet", "Fable"; Codex `limitName`, which can be a quota alias such as `gpt-reserve`). Omitted, meaning unknown, where the runtime says neither (Claude's OAuth apps window, Codex's other unnamed buckets, Kimi's name-only rows). - `scope` says what a window counts, not whether a full one stops work: extra usage can carry Claude, Grok and Kimi accounts past a full subscription window, which `rateLimited` already weighs. Also in this release: spawn validation errors no longer echo a rejected argument or environment value (#751). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Cindy <[email protected]>
AccountUsageWindow.scopesays what the runtime ties each usage window to, so a host can tell which windows hold back which model (Raft's Computers page and agent readiness, #oar-raft d0aeb454).{ kind: "account" }: the runtime reports the window as the account's.{ kind: "model", name }: one model's, with the runtime's own display name for it (Claude 2.1.322get_usage: the keysseven_day_opus/seven_day_sonnetand the server's display name for eachmodel_scopedrow; Codex:limitName). OAR keeps that name as given: it can be a quota alias (CodexlimitNamecan begpt-reserve), OAR does not rewrite it fromnormalModelSlug, and it is not promised to equal alistModelsid or display name; the host matches it to its own models.seven_day_oauth_apps, a Codex bucket that is neither the unnamedcodexone nor named, a Kimi row with only a name.Codex is not "all models": its unnamed
codexbucket isaccount, a named bucket such as "GPT-5.3-Codex-Spark" ismodel, and Codex does not say whether the account bucket also binds that model. The spec says which windows concern a model (everyaccountwindow plus themodelwindows naming it), thatscopesays what a window counts and not whether a full one stops work (extra usage;rateLimitedweighs it), and gives a per-runtime table.Additive optional field; existing fields unchanged.
🤖 Generated with Claude Code