Skip to content

docs(design): refuse Claude limit resets through its interactive UI - #721

Merged
stamp-build[bot] merged 2 commits into
mainfrom
cindy/decision-claude-limit-resets
Nov 10, 2026
Merged

stamp-build[bot] merged 2 commits into
mainfrom
cindy/decision-claude-limit-resets

Conversation

@stamp-build

@stamp-build stamp-build Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Cindy from open-agent-runtime opened this pull request through Stamp
View in Stamp →


Records the decision from #oar-raft 8fe1f4b2: OAR does not offer Claude limitResets / redeemLimitReset by driving Claude Code's hidden /limit-reset TUI command in a pseudo-terminal. There is no programmatic interface, the dialog's timing and text are version-specific, and a mistake spends a person's reset irreversibly; Codex keeps both because it has a native call and a retry key. The entry names what would reopen it. Upstream request: anthropics/claude-code#108851.

Docs only; links checked.

🤖 Generated with Claude Code

Cindy and others added 2 commits November 10, 2026 12:11
Raft asked whether OAR should drive Claude Code's hidden /limit-reset
command in a pseudo-terminal to match Codex's limitResets and
redeemLimitReset. It has no programmatic interface, its timing and dialog
text are version-specific, and a mistake spends a person's reset
irreversibly, so OAR keeps both members absent for Claude, with what would
reopen it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…to reopen

Second review: the reopen condition now includes the idempotency key the
reasons rely on, the probe's findings are stated as fake-backend
observations, and the evidence links upstream instead of a chat.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@stamp-build
stamp-build Bot merged commit fa9c90c into main Nov 10, 2026
1 check passed
@stamp-build
stamp-build Bot deleted the cindy/decision-claude-limit-resets branch November 10, 2026 17:14
@stamp-build stamp-build Bot mentioned this pull request Nov 10, 2026
stamp-build Bot added a commit that referenced this pull request Nov 10, 2026
<!-- 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_63320bc32e280f94a8c9147d127f6446"><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 -->

Minor release: Grok steers without cancelling and reports the turns it runs on its own; Grok and OpenCode failures say more precisely why a turn failed; Codex is found on Windows when it is not on PATH.

## Grok: steer by interjection, and Grok's own turns (#716)
- `steer()` on Grok now sends `_x.ai/interject`: the input joins the running turn at its next safe point and the turn is not cancelled. Before, a steer was `session/prompt` with `_meta.sendNow`, which cancelled the running prompt and re-ran its work.
- What changes for a host: `steer()` is `accepted` once Grok answers `{status: "queued"}` (15 s deadline) and can now be rejected `runtime_refused` (Grok's error) or `error` (delivery); with no turn running it is rejected `no_active_turn` and nothing is sent. Its record is a frame `_x.ai/interject`, not a second `session/prompt` answer with its own outcome, and the turn ends once, with the prompt's answer. A steer carries no `outputSchema`; the turn keeps its prompt's.
- An interjection that misses the turn's last safe point is not lost: Grok runs it after the prompt's `turn_ended` as its own turn (`turn_active` without an `inputId`, so it cannot be tied to the steer).
- Turns Grok runs without a prompt from OAR (a finished sub-agent waking its parent, an interjection that missed its turn, and others) are now turns: `turn_active` at their start, `turn_ended` at their end, their usage billed once. A host folding the stream goes back to idle afterwards instead of staying busy. While such a turn runs, `prompt()` is `busy`, held input waits, `steer()` reaches it and `abort()` cancels it.
- OAR names each prompt it sends (`_meta.promptId`); Grok's queue reports now give OAR prompts `input_queued` and `turn_active` with their input id.
- A Grok turn that starts before OAR has recorded the previous prompt's answer is reported right after that prompt's `turn_ended`, so a host waiting on the prompt gets the prompt's end and the session stays busy until Grok's own end.
- An abort clears interjections Grok has not taken yet. Grok reports neither taking nor clearing one, so OAR reports no `input_dropped` for them.
- Evidence: Grok 1.0.77 on Linux against a local provider ([probe](https://github.com/botiverse/oar/blob/main/experiments/grok-interject/README.md)).

## Failure classes
- **Grok (#717):** every HTTP 429 used to be `rate_limited`. A 429 whose provider error type names a quota (`insufficient_quota`) or Grok's own free-allowance code is now `quota` (`credit_balance_exhausted` is `billing`); others stay `rate_limited`, with `status` 429. For other API errors Grok keeps the provider status in `data.http_status`, and it now decides when Grok's own retry type is the generic `api`: 402 `billing`, 400 `invalid_request`, 401 `auth`, 404 `model_unavailable`, 503/529 `overloaded` (all were `provider`), with that `status` on the outcome; Grok's specific retry types (`auth`, `context_length`) still decide. Failures of Grok's own turns carry no status.
- **OpenCode (#711, from Ancienttwo's #710):** a prompt error with one of OpenCode's known `data.errorName` values (`provider.rate-limit`, `provider.free-limit`, `provider.quota` and other budget limits) uses that class before the message text; unknown names keep the text rules.

## Codex on Windows (#719)
- When Codex is not on PATH, OAR now also looks for npm's global shim (`%APPDATA%\npm\codex.cmd`) and then the Codex Desktop CLI under `%LOCALAPPDATA%`, after `OAR_CODEX_BIN` and PATH. There is no version comparison: the first that passes `codex app-server --help` wins, so a Desktop CLI older than the one on PATH is never chosen over it. No native Windows run in this release; the locations follow Raft's own Codex driver.

## Record retention (#714, fixes #713)
- With `retainedBytes`, a rejected control (for example an idle `abort()`) no longer elides the payload of the newest native frame. Retention now protects the newest frame, not the last record, as documented; older frames are still elided once a newer frame arrives.

## Other
- Design decision recorded: OAR does not drive Claude Code's interactive `/limit-reset` to offer Claude limit resets (#721; upstream request anthropics/claude-code#108851).
- Docs: weekly pass (#706 to #709), including `PromptRun` README examples that now compile and the documented `oar run` exit codes; Qwen 0.27.0 verification (#705).
- Test and evidence updates: Pi 1.5.2 clean-install pairing (#715) and RPC version expectations (#718), November 9 native checks (#712), OpenCode error-name evidence (#711). Grok CI still pins 1.0.70, where the #716 vendor jobs passed; the new behavior was also run against 1.0.77 locally.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Cindy <[email protected]>
stamp-build Bot added a commit that referenced this pull request Nov 12, 2026
<!-- 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_fd51f3150c3f13002d46fd50acfc1afc"><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: `inspectLimitResets` lists them and `redeemLimitReset` (with a `resetId` naming a kind) spends one.

This reverses the 2026-11-10 refusal (#721). The project owner decided that if a host offers this at all, the driver belongs in OAR: Raft had already built it inside its daemon, pinned to Claude Code 2.1.322 and Linux, and it broke at every update. Claude Code 2.1.322 still has no `-p`, SDK or control-protocol form (its `get_usage` reads `/api/oauth/usage` without the reset parameters), and the upstream request anthropics/claude-code#108851 has no answer. `decisions.md` records the reversal and when to move to a native form.

The driver is Raft's (`claudeLimitReset.ts`, `claudeLimitResetScreens.ts`, `claudeTerminalScreen.ts`, `claudeLimitResetTerminal.ts`), ported with its 66 unit tests and the screen fixtures recorded from the real 2.1.322 UI against a fake backend. Its safety rules carry over unchanged: the command always names a kind; keys reach a dialog only after it held still 600 ms; one Yes at most, only with 30 s left for the answer, never in an inspection; any unrecognised screen ends the attempt with Esc; at the 5-hour limit nothing is typed without the person's consent (the older program spends on open); idempotency keys are remembered for the life of the process.

Changes from Raft's version:
- No version list. The prompt must show a `Claude Code v<version>` banner, and every screen must match word for word; the banner's version is reported.
- Linux only for now. On macOS the BSD `script` exits at once when its stdin is a socket, which Node pipes are there (found by xxair on macOS 27.0); macOS and Windows are `unsupported_platform` until a follow-up gives it a real pipe.
- OAR reads the 5-hour limit itself through claude's own `accountUsage`, right before the first command.
- `redeemLimitReset` takes `fiveHourLimitConsent` too, so a person at the 5-hour limit can spend a `full` reset knowingly.
- Outcomes in OAR's contract: `not_attempted` (`busy`, `deadline`, `usage_unread`, `startup_failed`), `unknown` (with `fiveHourSpent`), `unsupported` (`unsupported_platform`, `unsupported_version`, `reset_id_required`, `consent_required`, `endpoint_unavailable` for "Unknown command"). The same key with another `resetId` rejects.
- The pseudo-terminal helper lives in `shared/executable/script-terminal.ts`, with its spawn inside `spawnChecked`.
- Review fixes (Otter, two rounds): the confirmation dialog must match as a whole (effect line, count line, optional early-use warning; only dates, count, percentage and known limit names vary); idempotency keys that typed a command are kept for the process lifetime with no cap; a call waiting for the UI slot answers at its own deadline and never starts later; process ownership: the shell under `script` ends the program's session when it exits, a group counts only while a process seen earlier is still in it, nothing is looked up below `script` after it exited, and the Linux environment marker ends what still carries it.

Contract: `Runtime.inspectLimitResets`, `LimitResetInspection`, `LimitResetKindStatus`, new result kinds and reasons in `LimitResetResult`. Codex is unchanged.

Known cost, documented: the interactive UI sends one 1-token model request at startup (seen in the harness; magpie notes it can open a 5-hour window on an idle subscription). OAR does not suppress it.

Not in this PR: the offline harness (fake backend + scenarios in a network namespace) moves into OAR next; no real account's reset has been spent through OAR.

Docs: `docs/spec/account-usage.md#claude-limit-resets`, `docs/runtimes/claude.md#limit-resets`, `docs/design/decisions.md`, capabilities, roadmap, README.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Cindy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants