Surface monthly AI usage limit errors across Studio Code surfaces - #4310
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
📊 Performance Test ResultsComparing 77194d8 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
sejas
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Related issues
How AI was used in this PR
Investigated, implemented, and tested with Claude Code, including live simulation of the 429 responses against a local fake proxy. Reviewed by the author.
Proposed Changes
When a user hits their monthly AI usage limit, the Studio Code agent silently stopped replying: the WordPress.com proxy's 429 was classified as a transient error and retried with backoff, and the final failure never reached the UI — the spinner just stopped with no message.
This PR makes hitting the limit fail fast and communicate clearly, consistently across every surface:
studio ui. The error is persisted on the session'sturn_closedentry, so the marker survives reload. Non-cap errors show their actual message instead of nothing.studio uiserver gained a small quota proxy route for this). The CLI shows the same notice inline.Testing Instructions
npm run cli:buildnode -e 'require("http").createServer((q,s)=>{s.writeHead(429,{"Content-Type":"application/json"});s.end(JSON.stringify({type:"error",error:{type:"rate_limit_error",message:"Number of requests has exceeded your monthly limit."}}))}).listen(8931)'WPCOM_AI_PROXY_BASE_URL=http://127.0.0.1:8931:WPCOM_AI_PROXY_BASE_URL=http://127.0.0.1:8931 npm start, open a site → Studio Code, send a message.npm run build:local -w @studio/ui, thenWPCOM_AI_PROXY_BASE_URL=http://127.0.0.1:8931 node --experimental-wasm-jspi apps/cli/dist/cli/main.mjs ui, send a message.WPCOM_AI_PROXY_BASE_URL=http://127.0.0.1:8931 node --experimental-wasm-jspi apps/cli/dist/cli/main.mjs code, send a message.Pre-merge Checklist
🤖 Generated with Claude Code