Repository navigation
Description
Summary
Cursor-routed models fail deterministically with resource_exhausted when Codex advertises a large namespace-based tool catalog. The same Cursor OAuth account and model work when the namespace tools are removed, and both halves of the catalog work independently.
This appears related to, but more specifically reproducible than, #72. PR #73 improved error classification/retry behavior, but the upstream rejection can still be triggered by the aggregate client tool catalog.
Environment
- OpenCodex:
2.7.28 - Codex CLI:
0.144.6(also observed from Codex Desktop) - OS: macOS
- Provider: Cursor OAuth
- Models reproduced:
cursor/grok-4.5andcursor/auto - Cursor quota was not exhausted, and native Cursor usage continued to work
Error
stream disconnected before completion: Cursor rate limit exceeded: Cursor Connect error resource_exhausted: Error
Provider debug shows that Cursor Connect succeeds, returns its first frame, requests multiple blobs, and then terminates with resource_exhausted:
[ocx:cursor:connected]
[ocx:cursor:first-frame]
[ocx:cursor:frame] {"case":"kvServerMessage","kv":"getBlobArgs"}
...
[ocx:cursor:connect-end-stream] {"code":"resource_exhausted"}
Reproduction
- Configure the Cursor OAuth provider.
- Use a Codex installation with multiple apps/plugins, producing a namespace-based tool catalog.
- Select
cursor/grok-4.5orcursor/auto. - Send a trivial prompt in a fresh session.
A fresh ephemeral CLI session also reproduces it:
codex exec \
--ignore-user-config \
-c openai_base_url='"http://127.0.0.1:10100/v1"' \
--skip-git-repo-check \
--ephemeral \
-m cursor/grok-4.5 \
-c model_reasoning_effort='"medium"' \
"Reply only OK"Request measurements
The failing minimal Codex request was zstd-compressed on the wire and measured after local decompression:
- Total request:
505,203bytes - Tool catalog:
443,259bytes - Top-level tools:
24 - Namespace entries:
13 - Inner namespace tools:
340
The largest namespaces included GitHub (89 tools), Linear (59), Google Drive (46), Slack (32), Neon Postgres (29), Figma (27), Vercel (24), and Sites (20).
Isolation results
All tests used the same Cursor OAuth account, model, prompt, and OpenCodex transport:
| Tool catalog | Result |
|---|---|
| Full catalog: 340 inner namespace tools | Fails consistently with resource_exhausted |
| Namespace tools removed; native top-level tools retained | Succeeds |
| First group: 230 inner namespace tools | Succeeds |
| Second group: 110 inner namespace tools | Succeeds |
Minimal direct /v1/responses request without the Codex tool catalog |
Succeeds |
Because both groups succeed independently, this does not look like one individually malformed tool schema. The failure depends on the aggregate catalog.
Suspected area
This may be related to commit 80b510f, which started mirroring Responses client tools into AgentRunRequest.mcp_tools so they become callable by Cursor models. Existing tests appear to validate small tool sets, but not a large namespace catalog.
The exact Cursor boundary is not yet known: it may be serialized byte size, total tool count, blob count, or another internal resource budget. OpenCodex currently classifies the result as a rate limit, although account quota is not the trigger in this reproduction.
Expected behavior
OpenCodex should avoid sending a Cursor tool catalog that the upstream cannot accept. Possible approaches:
- enforce a Cursor-specific serialized tool/count budget;
- defer large namespace catalogs and expose them through
tool_searchonly when needed; - preserve Codex-native tools while limiting optional MCP/app tools;
- surface an actionable tool-catalog-limit error instead of a quota-oriented message.
I can provide additional redacted provider-debug output or test a proposed patch if useful.
Activity
fix(cursor): enforce tool budget to prevent resource_exhausted with l…
fix(cursor): bound serialized tool catalogs (#190)
Ingwannu commentedon Jul 21, 2026
Confirmed: the issue is real. Current
devregistered the full client catalog in Cursor'sMcpToolsprotobuf with no aggregate byte/count bound, and also classifiedresource_exhaustedas an account-style rate limit.I did not merge the closed #192 implementation because its review identified three correctness gaps: estimated rather than serialized byte size, reserved tools escaping the hard count cap, and no reliable promotion path for tools returned by
tool_search.A replacement is now on
devin d048463:McpToolsprotobuf, including names, descriptions, provider identifiers, and schemas;tool_search, and native Codex tools;tool_catalog_too_large, not a quota/rate-limit failure.Regression coverage includes oversized schemas, combined count overflow, tool-search promotion, recovery-note honesty, wire error classification, and request logging. The full repository suite passed (3,296 tests), plus the post-change focused suite. This run did not perform a credential-dependent live Cursor smoke, so please reopen with a redacted provider-debug trace if the upstream still rejects a bounded catalog.
Closing as fixed on
dev.fix(cursor): bound serialized tool catalogs (lidge-jun#190)