Skip to content

Restore Research upgrade prompts for exhausted usage - #1064

Merged
AnthonyRonning merged 2 commits into
masterfrom
codex-quota403-maple
Oct 4, 2026
Merged

AnthonyRonning merged 2 commits into
masterfrom
codex-quota403-maple

Conversation

@AnthonyRonning

@AnthonyRonning AnthonyRonning commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Research displays 403 status code (no body). Please try again. when an exhausted user sends a chat, instead of opening the upgrade prompt. Transport V2 preserves the response, but OpenSecret's flat error body is not readable by the pinned OpenAI client, and Research only recognizes the older serialized error format.

Fixes #1062.

  • Add OpenAI-compatible nested messages and stable codes for usage, free-tier token, model-plan, and context-limit rejections. Preserve existing statuses and flat fields; other error bodies remain unchanged.
  • Classify specific status/code pairs in Research, retain precise legacy handling, and restore the failed draft before showing the existing usage, token, or context dialog. Coded plan denials explain that the model or feature is unavailable, without retry advice or an automatic upsell. Generic 403s remain separate from quota.
  • Cover the API contract, encrypted V2 response and duplicate dispatch behavior, client classification, and the production send-error presentation handler. Routing tests use pinned OpenAI errors and real chat runtime/draft recovery for Free/Pro/Max, token/context, plan denials, failed restoration, stale/offscreen runs, and account teardown.

Validation

  • Fresh linked Local MDE: a Pro user with 20,001 credits used against a 20,000 allowance now sees Monthly Usage Limit Reached, with Upgrade to Max / Buy Extra Credits / Maybe Later. Two original sends and a browser recheck of the review follow-up opened the dialog and restored the draft after dismissal; the bodyless error was absent. Billing and OpenSecret logs confirmed the quota rejection.
  • Additional browser checks on the current PR head staged Free daily exhaustion, Max monthly exhaustion, the Free conversation-token limit, a model context overflow, and a plan change after selecting a paid model. Each showed the expected dialog or neutral plan-denial banner. Renderer clipboard readback confirmed the long context draft was fully restored (normal send trimming applies). Screenshots were captured from the actual Local app; original fixture plan and usage were restored afterward. The existing three-second error-banner timeout is unchanged, while dialogs persist until dismissed.
  • Actual encrypted requests using published SDK 4.0.1 and OpenAI 5.20.0 retained the 403, structured quota details, and readable message.
  • OpenSecret formatting and warning-denied Clippy passed; full tests: 739 passed, 31 ignored (DB/live-provider tests).
  • Research frontend CI script passed formatting, lint, typecheck, and 1,241 tests, with 13 existing lint warnings. The PR web build passed separately using the hosted Dev profile.
  • GitHub checks passed at a3bda814, including Research frontend/web, OpenSecret checks/package, and SDK integration. Unselected packaging and audit lanes were skipped.

Backend-first deployment is recommended. Existing clients remain compatible; releasing Research first preserves today's missing-popup behavior until the backend supplies the new contract. No SDK or dependency changes are required. Native Tauri/Agent Mode, production deployment, checkout/purchases, and document-specific context advice were not exercised. Offscreen/stale/cancelled-run and account-teardown routing is covered by automated tests rather than additional browser screenshots.

@AnthonyRonning AnthonyRonning added the bug Something isn't working label Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Maple development preview: https://9bf30626.maple-ca8.pages.dev

Commit: a3bda814499e703dae367422a3ad4840521bf695

Uses development API, billing, flags and PCR configuration. Cloudflare Access applies.

@AnthonyRonning
AnthonyRonning merged commit 2860c23 into master Oct 4, 2026
25 checks passed

This branch was successfully deployed

1 active deployment
pages-pr-1064 — a3bda814 Deployed Oct 3, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Research: exhausted usage shows bodyless 403 instead of upgrade prompt after Transport V2

1 participant