Repository navigation
Wait out provider usage limits, and spending limits for chats, Bots and routines - #592
Conversation
When a provider's rate limit or plan window turns a request away before any reply, the request waits for the reset the provider gave (or backs off), sends one test request, then lets the other waiting replies go one at a time. It keeps the same model. Chats, Bots, routines and helpers all wait; a window of days and billing problems fail at once with the reset time. The owner sets the longest wait in Settings, Limits & spending. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
Each chat has a total limit, each Bot a monthly limit (its own or the default, starting on the owner's chosen day) and each routine run its own limit. Only pay-as-you-go keys count; sign-ins and models on this Mac are $0. The request that crosses a limit finishes its step, then the chat, Bot or run stops with a clear line and an "Allow $X more" action. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
Phones read a chat's or Bot's spending and allow more through
GET/POST /chats/{chatId}/spending and /bots/{botId}/spending
(`spending-limits-v1`, provisional contract revision 40). Allow more
takes the status revision in If-Match, so a repeated tap is a conflict
rather than a second allowance. A phone turn over its chat's limit is
refused with operation_stale and the limit's own line.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
Chats and Bot chats show a quiet line from 80% of the limit and, once it is reached, a card with "Allow $X more" that sends the status revision, so a tap another device already answered re-reads instead of adding twice. Hidden when the Mac does not offer spending-limits-v1. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
…abel Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
…ng limits Adds the usage limits and spending limits guide, the revision 40 section of the Remote API doc, the plan with the owner's decisions, and the README, product, settings, phone, activity mark, iOS changelog and plan index entries. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
…for a rate-limited reply The chat's spending notice now sits in the chat content column, like the approval card, instead of spanning the whole pane. A new end-to-end test has the test model server answer 429 with retry-after: the reply waits, shows the waiting row, and Retry now sends it again with the same model. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
JUnit 4 rejects a test method that returns a value, and one body ended in assertThrows, which returns the exception, so the class failed to initialize. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
Hermes review failedHermes could not produce a code-review verdict for this head SHA. Engine: Safe summary: Local logs: |
There was a problem hiding this comment.
Important
Spending caps have enforcement gaps, inherited usage waits can exceed the configured maximum, and the iOS checks need fixes before merging.
Reviewed changes Reviewed provider retry coordination, spending enforcement and persistence, desktop UI, Remote contracts, and both native clients at 6c7c123.
- Usage-limit waits: Adds reset parsing, backoff, persistent provider/model holds, coordinated test requests, cancellation, Retry now, and give-up notifications across chats, Bots and helpers.
- Spending enforcement: Adds chat totals, monthly Bot caps and per-routine budgets, API-key cost accounting, admission checks, and additional allowances.
- Desktop controls: Adds Limits & spending settings, Bot monthly overrides, spending notices, and waiting activity states.
- Remote and mobile: Adds provisional revision 40 spending routes with compare-and-set allowances, compatible send refusals, and iOS/Android notices.
- Documentation and coverage: Adds the feature guide, plan, shared fixtures, focused behavioral tests, and a rate-limit Electron scenario.
Validation passed: usage-limit tests (28), spending tests (18), Remote protocol/router tests (136), the focused Bot spending test, and the focused Android spending tests. test:ios-release failed its two source-inventory checks; a minimal Swift/XCTest typecheck independently reproduced the async-autoclosure error below. Runtime probes reproduced the accounting, restart-budget and inherited-wait failures. Full iOS and Electron execution was not performed on this Linux runner.
gpt-6.1-sol | 𝕏
A fast tool turn could send the next request before the previous response's cost was recorded, so a Bot or routine run could pass its spending limit by more than one step. afterResponse now awaits the record, which never throws. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
very-hermes-bot
left a comment
There was a problem hiding this comment.
Inline review — 1 finding(s) anchored to the diff. See the pinned summary comment for the overview.
- A request that joins a held limit (another chat's, or one saved by an earlier run) stops waiting when the limit clears after its longest wait; changing the setting applies to waits already running, and Don't wait sends them. - Compact reset durations such as OpenAI's 6m0s parse in full. - A routine run's spend is saved, so a run resumed after a restart keeps its balance. - iOS: await outside XCTUnwrap; list the new Swift files in the shipping target inventories. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
ℹ️ No new issues found in this update. Approval remains withheld while the other findings from the previous review are unresolved.
Reviewed changes Reviewed 0df2e4e against the prior reviewed head, 6c7c123, with the full PR diff as context.
- Awaited Bot response accounting through credential classification and ledger recording before the next request can be admitted, preserving nonfatal accounting errors.
- Extended spending enforcement coverage with delayed asynchronous recording, verifying that the crossing step finishes but no subsequent provider request runs.
Validation passed: test:bot-runtime (273 tests), test:spending (18 tests), and npx tsc --noEmit. The accounting-race thread is resolved. Native mobile and Electron suites were not rerun for this desktop-only delta.
gpt-6.1-sol | 𝕏
|
Hermes [P2] (unawaited Bot spend record): fixed in 0df2e4e. Generated by Claude Code |
There was a problem hiding this comment.
Important
Turning waiting off during an active usage-limit wait can start an unbounded resend loop against the rate-limited provider.
Reviewed changes Reviewed 4bfee02 against the previously reviewed head, 0df2e4e, with the full PR diff as context.
- Applied inherited-wait limits during gate acquisition and propagated longest-wait setting changes to active waiters.
- Persisted routine-run spending balances across restarts and extended reload coverage.
- Corrected compact reset durations such as
6m0sand1h2m3.5s, with classification tests. - Fixed iOS test integration by awaiting responses before
XCTUnwrapand registering both new Swift files in the shipping inventories. - Updated documentation and project memory for live wait-policy changes and persisted routine balances.
Validation passed: test:usage-limits (29 tests), test:spending (18 tests), test:ios-release (20 Ruby tests and 30 Node tests), and npx tsc --noEmit. A runtime probe reproduced the resend loop, stopping it deliberately after five rejected calls. Native iOS and Electron execution were not performed on this Linux runner.
gpt-6.1-sol | 𝕏
The Bot chat showed the reached notice but kept its composer ready, so a send failed with a toast. It now says why in the composer, as a workspace chat does, until Allow more. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
|
Hermes [P2] (Bot chat composer stays ready at the limit): fixed in 8c83983 (not yet pushed). The composer is not ready while the Bot's status is reached and shows the same line as the notice; a new Bot chat pane test sends nothing until Allow more, then sends. The Linux x64, Linux arm64 and CI required failures on 6c7c123 were jobs cancelled by the next push ( Generated by Claude Code |
A request sent because waiting was turned off during its wait joined the still-held limit again on a rejection and resent at once, in a loop. The send ticket now says waiting is off, so the rejection fails as it would with waiting off. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
Important
An open Bot chat can remain unable to send after its monthly spending limit resets.
Reviewed changes Reviewed 8c83983 and the arriving 2756db3 update against the prior reviewed head, 4bfee02, using the full PR diff as context.
- Added Bot composer enforcement that blocks sending at the spending cap, displays the limit explanation, and re-enables sending after Allow more, with component coverage and updated documentation.
- Fixed disabled-wait rejection handling so turning waiting off during an active wait sends once and surfaces a continuing rate-limit rejection instead of resending indefinitely.
Validation passed: Bot chat component tests (66), spending tests (18), usage-limit tests (29), and npx tsc --noEmit. A separate probe using the real component and spending service reproduced the monthly-rollover lockout and confirmed that a status refresh unblocks sending. Native mobile and Electron suites were not rerun for this desktop-only delta.
gpt-6.1-sol | 𝕏
The reached status was only re-read on mount or a change event, and the month ending sends neither, so the composer stayed blocked. The status is now read again once its period has ended, checked at least each minute so a Mac that slept through the boundary catches up. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed d4cdb39 against the prior reviewed head, 2756db3, with the full PR diff as context.
- Added monthly status refresh to the shared desktop spending hook so an open Bot chat becomes usable when its spending month resets, including a boundary crossed while suspended.
- Extended Bot chat coverage to verify sending after rollover without Allow more or reopening the chat, and updated the usage guide.
Validation passed: Bot chat component tests (67), spending tests (18), and npx tsc --noEmit. An independent hook test against the real spending service also passed simulated suspension catch-up and timer cleanup. Native mobile and Electron suites were not rerun for this desktop-only delta.
gpt-6.1-sol | 𝕏
|
Desktop tests (renderer-other) failed on 2756db3 (job). This PR didn't cause it. The job now runs on the self-hosted Mac runner ( No fix exists yet. Proposed patch, which works with both OpenSSL and LibreSSL: write the extensions the request already carries into a small extfile and sign with The other option is to put Homebrew OpenSSL 3 first on the runner's Generated by Claude Code |
child-agent-runtime imported the Electron-bound usage-limit and spending singletons at load, so plain Node tests that reach it (the Pi upgrade evaluation) failed to import electron. llm-client now binds them through setLimits, as it already does for health metrics. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
|
Desktop tests (core-git) failed on 2756db3: Generated by Claude Code |
There was a problem hiding this comment.
Important
The new initialization call breaks two existing host tests because their registry doubles do not implement setLimits.
Reviewed changes Reviewed ec09567 against the prior reviewed head, d4cdb39, with the full PR diff as context.
- Moved helper-limit binding into Electron-main
llm-client.ts, preserving the desktop usage-limit and spending services throughSubagentRuntimeRegistry.setLimits. - Removed Electron-bound singleton imports from the shared child runtime so plain Node replay and subagent tests can load it independently.
Validation passed: replay and subagent suites (113 tests), usage-limit tests (29), spending tests (18), and npx tsc --noEmit. After building the normal native-lock and compaction-worker prerequisites, the Bot-pause and cache-warming suites passed 30 of 32 tests; both remaining failures are covered by the inline finding. Native mobile and Electron suites were not rerun for this main-process-only delta.
gpt-6.1-sol | 𝕏
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
…age-limit and spending branch package.json test:serial keeps both test:follow-through and the usage-limit and spending suites. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed the a21e36d merge against the prior reviewed head, 7d15b41, with the complete PR diff as context.
- Merged coding follow-through and CI routing from
main, preserving spending admission for unattended follow-up turns and both follow-through and spending cleanup when deleting a chat. - Preserved test-chain coverage from both merge parents, including
test:follow-through,test:usage-limitsandtest:spending.
Validation passed: usage-limit tests (29), spending tests (18), follow-through tests (76), CI-policy tests (69), chat application-service tests (11), and npx tsc --noEmit. All prior Pullfrog threads remain resolved. Native mobile and Electron suites were not rerun locally; hosted CI on this exact head is still queued or running, so this review does not establish merge readiness.
gpt-6.1-sol | 𝕏
|
The failing Hermes Review Bot status on a21e36d isn't caused by this PR's code. The review engine timed out after 1,920 s before it produced a verdict (failure phase I can't re-run the bot from here. It needs a fresh run on its host. Pullfrog's review of the same head found no new issues. Hosted CI on a21e36d is green so far, and the Electron E2E, desktop build and runtime-subagents jobs are still queued. Generated by Claude Code |
…ote revision 43 Brings in Bot autonomy (issues, events, learning), automatic model-request retries (#595), the web page extract recap (38), scheduled-task approval cards (39), hand-off notes (40), context pressure (41), Bot issues (42), the Electron security update and hosted Mac CI. Spending limits on phones move from provisional revision 40 to 43 in the host constant, the shared fixture, OpenAPI, the iOS Phase0 test, phone comments and the docs. Conflicts resolve by union: the test:serial chain, agent-activity's limited and retrying phases, the e2e fixture hooks, the Bot profile sections and the router helpers. Routine delivery moved to main's funnel, so the routine ports keep spendingStop and drop deliverResult. A usage limit the wait gave up on, one that outlasts the longest wait, or one a recent give-up refused now carries a marker, and a chat's automatic retries skip it: the reply fails once with the reset time instead of showing "Trying again" five times. With waiting off it is retried like any other failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
Important
The merged Bot watchdog cancels valid provider-limit waits before their reset time, so waiting routines can fail as stalled instead of resuming.
Reviewed changes Reviewed ec2a3d0 against the prior reviewed head, a21e36d, with the complete PR diff as context.
- Merged newer main integrations, including Bot autonomy, automatic model-request retries, delivery-funnel changes, and the combined test chains.
- Added final usage-limit retry suppression, preserving a marker through Pi’s actual message lifecycle so workspace chats do not retry errors after Aiden gives up waiting.
- Reclaimed Remote revision 43 for spending limits across the host, shared fixture, iOS expectation, OpenAPI, and documentation, retaining main’s revisions 38–42.
⚠️ Valid Provider Waits Are Treated As Stalled Runs
The incoming watchdog exempts hand-offs, approvals and questions, but not the provider-limit waits this PR adds. A routine waiting for a valid 30-minute reset under the default six-hour maximum is stopped after roughly ten minutes without transcript progress; an attended Bot wait instead produces a misleading “Still working?” issue.
Technical details
# Integrate provider-limit waits with the Bot stall watchdog
## Affected sites
- `main/services/bot-runtime/bot-session-main.ts:627-640`: the watchdog's waiting predicate checks only pending hand-offs, approvals and questions.
- `main/services/bot-runtime/bot-run-watchdog.ts:42-51`: ten minutes without progress stops a routine or raises an attended-run issue.
- `main/services/usage-limit-stream.ts:219-245`: a held request waits without emitting stream content; `usage-limit-service.ts` broadcasts on `usageLimits:changed`, outside the Bot transcript feed that updates `watchedRuns.at`.
- `main/services/bot-runtime/live-projection.ts:1110-1115`: unchanged activity does not emit progress, and there is no periodic progress heartbeat to protect the wait.
## Evidence
An independent fake-clock probe used the real `UsageLimitGate`, `withUsageLimitWait` and `createBotRunWatchdog`, with a provider rejecting once with “Try again in 30 minutes” and succeeding on the next call. With the current waiting exclusions, checking at ten minutes called Stop and produced `stopReason: aborted` after only one provider call. A positive control exempting the active usage wait made no Stop call and completed successfully with two provider calls at the reset.
This interaction is new to the branch after `ec2a3d0` merged the watchdog from main. The watchdog wiring is outside the base-to-head PR hunks, so the missing integration is reported here rather than anchored to unrelated changed lines.
## Required outcome
- Do not stop or flag a Bot as stalled while it is deliberately waiting for a provider limit within the configured policy.
- Give resumed inference a fresh progress window when the hold clears, rather than immediately treating the elapsed hold as a stall.
- Extend behavioral watchdog/host coverage to a provider wait longer than ten minutes, preserving genuine-stall detection.Validation passed: usage-limit and spending suites, Remote protocol/router/chats, chat activity and Bot chat components, compaction and actual generation-harness suites, Bot extension/routine/recovery tests, CI policy, iOS shipping checks, TypeScript, and focused ESLint. Android validation was blocked locally by the uncached org.gradle.toolchains.foojay-resolver-convention plugin; the online retry returned Tool 'shell' timed out after 120000ms. Native iOS and Electron execution were not performed on this Linux runner, and exact-head hosted CI is still incomplete.
gpt-6.1-sol | 𝕏
A routine waiting for a provider's reset made no transcript progress, so the watchdog stopped it as stalled after 10 minutes, and an attended Bot got a "Still working?" card. A usage-limit wait now counts as progress: the run is neither stopped nor flagged while it waits, and its 10 minutes start again when the limit clears. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
Important
The long-wait cancellation is fixed, but the watchdog exclusion also covers already-sent retries, allowing a hung retry to bypass stall recovery indefinitely.
Reviewed changes Reviewed e7a8289 against the prior reviewed head, ec2a3d0, with the complete PR diff as context.
- Exempted Bot provider-limit waits from the stuck-run watchdog and refreshed the progress window during those waits.
- Extended watchdog coverage and documentation for a 30-minute hold, resumed stall detection, and attended-run behavior.
Validation passed: test:bot-runtime (297 tests), test:usage-limits (29 tests), routine execution/recovery suites (64 tests), TypeScript, and focused ESLint. An independent probe using the real Bot model wrapper and Google adapter reproduced the inline finding; a queued-only exclusion restored stall recovery while a healthy 30-minute wait still completed. Native mobile and Electron suites were not rerun for this desktop-main-only delta; exact-head hosted CI remains incomplete.
gpt-6.1-sol | 𝕏
The watchdog skipped a Bot for as long as the usage-limit gate listed a wait for it, which includes the test request already sent once the limit clears. A test request that hung without content then kept the run alive forever. It now skips a Bot only while one of its requests is held back (UsageLimitGate.isHeld), so a sent request is watched as usual. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed 63c7a00 against the prior reviewed head, e7a8289, with the complete PR diff as context.
- Restricted watchdog exemptions to requests still held in the usage-limit queue, keeping already-dispatched retries subject to normal stall recovery.
- Added queued-to-flight coverage through the real stream wrapper and gate, and clarified the behavior in the routine and usage-limit guides.
Validation passed: test:usage-limits (30 tests), test:bot-runtime (297 tests), routine execution/recovery suites (64 tests), TypeScript, and focused ESLint. An independent four-case probe combining the real gate, stream wrapper, and watchdog confirmed that 30-minute holds remain protected, healthy retries complete, and hung retries trigger routine Stop or one attended-run stall card. All prior Pullfrog threads are resolved. Native mobile and Electron suites were not rerun for this desktop-main-only delta; exact-head hosted CI remains incomplete, so this review does not establish merge readiness.
gpt-6.1-sol | 𝕏
A 503 or 408 now waits only when it reads as an overload: it carries a reset time or rate-limit/overload wording. A plain server error goes to the chat's own retries again, which the retry e2e spec expects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed ed3ae65 against the prior reviewed head, 63c7a00, with the complete PR diff as context.
- Routed bare server failures (
503and408) to automatic retries instead of usage-limit waits, preserving waits for explicit overloads, rate limits, and reset headers. - Extended classification coverage and documentation to distinguish ordinary server failures from provider usage limits.
Validation passed: test:usage-limits (30 tests), compaction and provider-failure suites (123 tests), TypeScript, and focused ESLint. An independent probe through the real stream wrapper and retry coordinator confirmed bounded retry budgets for bare 503/408 errors and preserved waiting behavior for five overload/reset/rate-limit controls. The compaction suite required its normal build:vcc prerequisite before passing. All prior Pullfrog threads remain resolved. Native mobile and Electron suites were not rerun for this core-only delta; exact-head hosted CI remains incomplete, so this review does not establish merge readiness.
gpt-6.1-sol | 𝕏
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
…imit and spending branch; move spending limits to Remote revision 44 #631 took revision 43 on main, so spending-limits-v1 now claims 44 (still provisional) across the host constant, the shared fixture, OpenAPI, the iOS and Android comments and tests, and the docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed the updates since ed3ae65, focusing on the 8d721c8 merge and revision change, with the complete PR diff as context.
- Merged Bot hand-off integration from
main, preserving usage-limit watchdog handling, spending enforcement, and capability-gated Remote audiences. - Reclaimed Remote revision 44 for spending limits across the host, shared fixture, iOS expectation, OpenAPI, and documentation, leaving revision 43 for hand-offs on the Mac.
- Recorded the subscription-meter exclusion as the owner's decision, without changing runtime behavior.
Validation passed: usage-limit tests (30), spending tests (18), Remote protocol/router/chats (226), Remote Bot-session/handoffs and operation-contract tests plus Bot models/watchdog (131), iOS shipping/release-policy checks (20 Ruby and 30 Node), TypeScript, and focused ESLint. The Bot integration suites required their normal build:lease-flock prerequisite before passing. Android validation was blocked by the uncached org.gradle.toolchains.foojay-resolver-convention plugin; the online retry returned Tool 'shell' timed out after 120000ms. Native iOS XCTest and Electron execution were not performed on this Linux runner, and exact-head hosted CI is not yet established, so this review does not establish merge readiness.
gpt-6.1-sol | 𝕏
…g branch Keeps main's wider Bot file-tool protected roots alongside the Bot runtime's usage-limit wait, and appends test:usage-limits and test:spending to main's test:serial chain. Main is still at Remote revision 43, so spending limits keep provisional 44. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed the 5385b7b merge against the prior reviewed head, 8d721c8, using the incremental diff and relevant full-PR context.
- Preserved Bot runtime integration while merging main's expanded file-tool protection, retaining usage-limit waits, spending accounting, and queued-only watchdog exemptions.
- Updated host and notification integration, retaining the cache-warming test double's limit bindings alongside the new workspace-file notifier and preserving the preload notification channels.
- Combined test-chain coverage from both merge parents, keeping main's workspace-file tests and this PR's usage-limit and spending suites.
Validation passed: usage-limit tests (30), spending tests (18), seven affected host/Bot/file-notification suites (83), CI-policy tests (67), TypeScript, and focused ESLint. The file-router cases required the normal build:subagent-file-mutator prerequisite before passing. All prior Pullfrog threads remain resolved. Native mobile and Electron suites were not rerun for this merge-integration delta; exact-head hosted CI remains incomplete, so this review does not establish merge readiness.
gpt-6.1-sol | 𝕏
… and spending branch; move spending limits to Remote revision 45 #639 took revision 44, so spending-limits-v1 now claims 45 (still provisional). Also restores main's revision-40 hand-off note comment that an earlier renumbering had changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed the eef7f39 merge against the previously reviewed head, 5385b7b, using the incremental diff and relevant full-PR context.
- Merged image-placement integration from
main, preserving spending admission, usage-limit handling, and spending notices across the affected chat surfaces. - Reclaimed Remote revision 45 for spending limits across the host, shared fixture, iOS expectation, OpenAPI, and documentation, retaining main's revision 44 for image placement.
- Preserved Bot send-state behavior from
main, keeping Getting ready for slow sends alongside spending-cap enforcement and monthly rollover coverage.
Validation passed: usage-limit tests (30), spending tests (18), Remote protocol/router/chats (227), remaining shared-fixture consumer suites (187), affected transcript/Bot/image suites (121), CI-policy tests (67), iOS shipping/release-policy checks (20 Ruby and 30 Node), TypeScript, and focused ESLint. All prior inline findings remain resolved.
Android validation was blocked by the uncached org.gradle.toolchains.foojay-resolver-convention plugin; the online retry returned Tool 'shell' timed out after 120000ms. Native iOS XCTest and Electron execution were not performed on this Linux runner. Exact-head hosted CI remains incomplete, so this review does not establish merge readiness.
gpt-6.1-sol | 𝕏
…spending branch; move spending limits to Remote revision 46 #626 took revision 45, so spending-limits-v1 now claims 46 (still provisional). The Bot images older-revision check now also drops the newer spending section before it re-parses the fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed the 4e3153d merge against the previously reviewed head, eef7f39, using the incremental diff and relevant full-PR and merge context.
- Reclaimed Remote revision 46 for spending limits across the host, shared fixture, iOS expectation, OpenAPI, and documentation, retaining main's revision 45 for Bot shared images.
- Preserved Bot image and spending integration across the Remote routes and both native chat surfaces, retaining spending notices, refresh behavior, and capability-gated audiences.
- Updated older-revision fixture coverage to remove the newer spending section before parsing a pre-image fixture, and retained usage/spending settings validation alongside main's config-store changes.
Validation passed: usage-limit tests (30), spending tests (18), Remote protocol/router/chats and config-store tests (351), other shared-fixture consumers and local/remote Bot chat tests (266), CI-policy tests (67), iOS shipping/release-policy checks (20 Ruby and 30 Node), TypeScript, and focused ESLint. All prior inline findings remain resolved.
Android validation was blocked by the uncached org.gradle.toolchains.foojay-resolver-convention plugin; the online retry returned Tool 'shell' timed out after 120000ms. Native iOS XCTest and Electron execution were not performed on this Linux runner. Exact-head hosted CI remains incomplete, so this review does not establish merge readiness.
gpt-6.1-sol | 𝕏
…mit and spending branch; move spending limits to Remote revision 47 #629 took revision 46, so spending-limits-v1 now claims 47 (still provisional). The browser recordings older-revision check now also drops the newer spending section before it re-parses the fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed the d03a049 merge against the previously reviewed head, 4e3153d, using the complete incremental diff and relevant full-PR and merge context.
- Reclaimed Remote revision 47 for spending limits across the host, shared fixture, iOS expectation, OpenAPI, and documentation, retaining main's revision 46 for browser recordings.
- Preserved recording and spending integration across Remote routes and desktop/iOS/Android chat surfaces, including independent feature gates and existing spending notices and refresh behavior.
- Updated older-revision fixture coverage to remove spending before parsing a pre-recording fixture, and retained the usage-limit and spending suites alongside main's browser-recording test registration.
Validation passed: usage-limit tests (30), spending tests (18), Remote protocol/router/chats (234), remaining shared-fixture consumers (191), merged transcript/Bot/recording suites (150), CI-policy tests (67), iOS shipping/release-policy checks (20 Ruby and 30 Node), TypeScript, focused ESLint, and Swift syntax parsing. All prior inline findings remain resolved.
Android validation was blocked by the uncached org.gradle.toolchains.foojay-resolver-convention plugin; the dependency-enabled retry returned Tool 'shell' timed out after 120000ms. Native iOS XCTest and Electron execution were not performed on this Linux runner. Exact-head hosted CI remains incomplete, so this review does not establish merge readiness.
gpt-6.1-sol | 𝕏
…ranch Main is still at Remote revision 46, so spending limits keep provisional 47. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Reviewed the 148eb44 merge against the previously reviewed head, d03a049, using the complete incremental diff and relevant full-PR and merge context.
- Merged Bot self-wake integration from
main, preserving routine request attribution, spending admission and accounting, usage-limit waits, and watchdog handling. - Preserved Bot chat limit controls alongside wake-up chips and cancellation, including reached-cap enforcement, Allow more, and monthly rollover behavior.
- Retained Remote revision 47 and test coverage, keeping the desktop-only wake-up entry outside phone transcripts and preserving the usage-limit and spending suites alongside main's new wake-up tests.
Validation passed: usage-limit tests (30), spending tests (18), seven scheduler/Bot/wake-up integration suites (176), Remote Bot-session/protocol tests (140), CI-policy tests (67), TypeScript, and focused ESLint. All prior inline findings remain resolved.
Native mobile and Electron suites were not rerun for this desktop merge-integration delta. Exact-head hosted CI remains incomplete, so this review does not establish merge readiness.
gpt-6.1-sol | 𝕏

Requested by sbt · project thread
What this does
Usage limits. When a provider turns a request away before any reply because of a rate limit, an overload or a plan window, the reply waits instead of failing.
How long it waits:
retry-after, thex-ratelimit-*,ratelimit-*andanthropic-ratelimit-*headers, the Codex window headers, or the error text.When the limit clears:
What people see:
Scope:
userData/usage-limits.json).Automatic retries (#595). The wait sits under the automatic model-request retries.
Spending limits (owner's model A).
Limits:
What counts:
At and near the limit:
Phones: Remote revision 47 (
spending-limits-v1, provisional, re-claim at merge).GET /chats/{id}/spending,GET /bots/{id}/spending, andPOST …/spending/allow-more(withIf-Match).409 operation_stalecarrying the limit's line, so older phones need no change.Not in this PR
Revision note
Written as 40, then moved to 43 (main at 42), 44 (#631 took 43) and 45 (#639 took 44) on 2026-10-28, and on 2026-10-29 to 46 (#626 took 45) and 47 (#629 took 46). The number appears in
AIDEN_REMOTE_SPENDING_LIMITS_CONTRACT_REVISION, in bothcontractRevisionfields offixtures/contract.json, and in the iOSAidenRemotePhase0Tests. If another revision merges first, re-claim the next free one.Tests
New suites:
usage-limit-core,usage-limit-stream,spending-coreandspending-service.handlers/spendingandrenderer/shared/{usage-limits,spending}.AidenSpendingTestsplus client tests, and AndroidAidenSpendingTest.New Electron e2e
usage-limit-wait.spec.ts:retry-after.New
pi-compaction-corecase: a usage-limit give-up from the real wait is not retried, while the same rejection with waiting off is retried. Without the fix the case fails.bot-run-watchdogandusage-limit-streamcases cover the watchdog during a wait and a hung test request.The Bot images and browser recordings older-revision protocol checks now also drop the newer spending section before re-parsing, as the other older-revision checks do.
Passed locally after merging main at b8f42df:
test:usage-limits,test:spending, every suite that reads the shared Remote fixture, and the router suite (344).test:bot-runtime(297) and the watchdog suite.test:bot-issues,test:bot-proactive, the chats, routine, compaction, agent-activity and Bot chat suites, and the e2e specsusage-limit-waitandmodel-call-retry.iOS and Android were not compiled locally; CI covers them.
Docs
docs/usage-limits-and-spending.md, which has an "Automatic retries" section, and plandocs/plans/usage-limits-and-spending-plan.md.docs/aiden-remote-api-v1.md.docs/settings-design-system.md,docs/aiden-on-the-go-remote-access.md,docs/activity-marks.md,docs/bot-routines.md,ios/CHANGELOG.md, the plan index and.memory/.🤖 Generated with Claude Code
https://claude.ai/code/session_01HUyFpdzcwFxDEpoKBof81j