Skip to content

[Bug]: Cursor adapter large-context turns collapse or rate-limit while direct Cursor remains healthy #1527

Description

@rennzhang

Bug report

Client or integration

Codex App / Cursor provider adapter

Area

Provider adapter / streaming / large-context continuation

Current status

Later reporter evidence supersedes the original framing of this issue.

The problem is not simply that kimi-k3 gives short answers or that claude-fable-5 receives ordinary upstream 429s. Direct controls through Cursor's own client show the same account and models completing large-context workloads normally, while the OpenCodex Cursor adapter path degrades sharply at comparable context sizes.

Composer routes remain out of scope unless separately reproduced.

This issue now tracks the OpenCodex-specific large-context Cursor path.

Observed behavior through OpenCodex

At large context sizes, routed Cursor turns can show one or both of these symptoms:

  • cursor/kimi-k3 completes with only a few output tokens despite a large multi-step task;
  • cursor/claude-fable-5 and/or other Cursor routes hit repeated 429 rate_limit_exceeded / resource-limit failures at context sizes that remain usable through the official Cursor client.

The adapter also consistently logs completed streams as an abort-style teardown:

[ocx:cursor:turn-failed] ... "Cursor request was aborted" ... "committed":true
[ocx:cursor:stream-end] ... "expectedClose":false

That classification occurs even on turns whose committed output is otherwise usable.

Decisive control

The reporter repeated comparable large-context workloads through Cursor's own client with OpenCodex removed from the path.

Those controls produced long multi-step outputs, successful tool loops, and no equivalent rate-limit storm on the same account at similar or larger session sizes.

This rules out the earlier conclusion that the short output is simply normal model behavior.

Strongest current implementation hypothesis

The OpenCodex Cursor adapter appears to replay substantially more conversation state per turn than the official Cursor continuation path.

Observed differences include:

  • official Cursor usage reports substantial cache_read_tokens during long sessions;
  • OpenCodex usage for these routed Cursor turns is estimated and does not expose equivalent cache-reuse evidence;
  • the adapter serializes the conversation/history into rootPromptMessagesJson for each turn;
  • large histories approach the adapter's bounded serialized prompt envelope;
  • repeated full replay may increase upstream processing pressure and can plausibly explain the large-context degradation and rate-limit behavior.

This is the strongest current direction, but it should remain a hypothesis until a side-by-side request/continuation trace proves the exact upstream contract difference.

The constant abort/expectedClose:false teardown is separately actionable even if it is not the cause of the context collapse.

Required investigation

  1. Compare the official Cursor continuation/request shape with OpenCodex for the same large-context thread.
  2. Determine whether OpenCodex can reuse Cursor conversation/context caching or stable continuation state instead of replaying the full history each turn.
  3. Measure serialized prompt bytes and upstream request cost as the context grows.
  4. Determine whether the adapter is reducing an upstream output budget or otherwise changing request semantics at large context.
  5. Correct normal completed-stream teardown so it is not classified as Cursor request was aborted / expectedClose:false.
  6. Keep Composer out of scope unless independent evidence shows the same defect there.

Acceptance criteria

  • A controlled large-context Cursor workload through OpenCodex no longer collapses to a few output tokens solely because the conversation grows.
  • Comparable OpenCodex and direct-Cursor workloads do not show a large unexplained difference in rate-limit/resource pressure caused by avoidable full replay.
  • The continuation/cache behavior is documented and regression-tested.
  • A successfully completed Cursor stream is not classified as an abort during normal teardown.
  • Existing committed output is not lost while fixing teardown classification.
  • Small-context and Composer behavior do not regress.

Original evidence

The original OpenCodex session showed kimi-k3 turns around 79k-95k input collapsing to roughly 4-36 output tokens, while direct Cursor controls at comparable or larger context completed long coding tasks with thousands of output tokens.

The reporter also observed repeated Cursor-adapter 429/resource-limit failures at large context while direct Cursor on the same account remained healthy.

Related

Partial overlap exists with earlier Cursor/tool/provider issues, but this issue owns the large-context continuation/replay and teardown defect rather than generic Cursor provider compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingproviderProvider adapters, OpenAI-compat presets, upstream API quirksprovider-compatibilityProvider compatibility reportsstreamingSSE, WebSocket, terminal stream framestoolstool_calls, MCP, web-search / sidecar tools

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions