Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): mark Cursor transport error answers as failed #10337

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/10337/headmerged by shivamhwp(GitHub profile, opens in a new tab) View on GitHub

Closes #7830 Cursor CLI can emit a transport failure as assistant text and then return successful end_turn. T3 consequently marks the failed turn as completed. Refs #7830.

Recognize standalone transport diagnostics in T3's Cursor adapter and return a provider request error. This triggers the existing Failed status and error toast while preserving the diagnostic for inspection and manual retry. Ordinary prose, fenced code, cancellation and structured ACP error handling retain their existing behavior.

The upstream fault is in Cursor CLI's ACP implementation. Cursor support acknowledged the error-channel problem and confirmed a related stale-authentication variant. The authentication variant is background evidence and is not handled by this transport-only matcher.

Our standalone reproduction talks directly to cursor-agent acp without T3 or effect-acp. Authenticated CLI 2026.09.02-c22c1a3 completed a normal prompt. Closing only that test process's TCP connections and directing reconnects to a closed local port made Cursor emit Error: RetriableError: [unavailable] connect ECONNREFUSED ... as agent_message_chunk, followed by successful end_turn. Restoring connectivity let the next prompt succeed in the same process and session. This places the workaround at the Cursor adapter boundary; generic effect-acp should continue interpreting assistant content as text.

Repeated through the real T3 web client and server on 92c363ba: the failure displayed Failed and the error toast, with error turn/session states in the disposable database. The recovery turn completed and cleared the session error. No ACP responses were fabricated. This verifies an induced connection refusal, not every transport failure or the exact historical WritableIterable failure.

The matcher deliberately leaves mixed prose with an error tail unchanged. Unrecognized wording can be missed, and a legitimate answer consisting only of an identical diagnostic can be misclassified. Automatic retries are excluded because a failed turn may already have performed work that replaying the prompt could repeat. Reassess this workaround once supported Cursor CLI versions report these failures through structured ACP errors.

Validation: the mock-provider regression fails on the tested base and passes with this change. All 40 focused Cursor tests, server typecheck and targeted lint passed on this head. Detection retains at most one bounded line of the answer.

Model: GPT-6. Harness: Codex.

Note

Mark Cursor transport-error assistant responses as failed in CursorAdapter

  • Cursor sometimes returns a transport diagnostic as a successful assistant text stream instead of an error. The adapter now detects this and rejects the turn with ProviderAdapterRequestError.
  • Adds a CursorTransportFailure tracker in apps/server/src/provider/acp/CursorTransportFailure.ts that classifies newline-delimited streamed chunks, enforces a max line length, and only flags standalone Cursor diagnostics optionally followed by stack frames. Prose, code, and unrelated errors are not classified.
  • makeCursorAdapter initializes one tracker per session, resets it on assistant item starts and non-steering turns, feeds content deltas into it, and drains pending events after the ACP prompt completes to convert a recognized transport diagnostic into a request error.
  • Cancelled turns and prompts with other in-flight prompts are not subject to this check.
  • Behavioral Change: a Cursor assistant response containing only a recognized transport diagnostic now fails the turn instead of emitting turn.completed; the full assistant text is not retained by the tracker.
Macroscope summarized f9ad3d4.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.6 KiB13.6 KiB−6 B (−0.0%)15.1 KiB✅
      CodexThread snapshot wire7.0 KiB7.0 KiB+4 B (+0.1%)7.3 KiB✅
      CodexLive turn WebSocket wire6.6 KiB6.6 KiB−10 B (−0.1%)7.8 KiB✅
      CodexLive turn WebSocket decoded57.1 KiB57.1 KiB0 B (0.0%)66.4 KiB✅
      CodexLive turn messages10100 (0.0%)21✅
      ClaudeTotal thread wire13.6 KiB13.6 KiB−19 B (−0.1%)15.1 KiB✅
      ClaudeThread snapshot wire7.0 KiB7.1 KiB+7 B (+0.1%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.6 KiB6.5 KiB−26 B (−0.4%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded57.9 KiB57.8 KiB−44 B (−0.1%)66.4 KiB✅
      ClaudeLive turn messages109−1 (−10.0%)21✅

      Baseline: 4e969f3 · PR result: f9ad3d4 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 113.9 KiB
      • Claude decoded thread snapshot: 114.6 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at 92c363b

      Macroscope's review found this PR approvable — This is a narrowly scoped Cursor adapter bug fix that converts recognized transport-error assistant responses into request failures while preserving ordinary prose and code responses. The bounded parser and integration tests limit the change’s blast radius.

      No code changes detected at f9ad3d4. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Review Change Stack

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Path: .coderabbit.yaml

      Review profile: CHILL

      Plan: Team

      Run ID: 2797bf6f-e94a-4cc1-bb83-40896f45c3dd

      📥 Commits

      Reviewing files that changed from the base of the PR and between 4e969f3731aaa590889d74274b3b6dced6d86291 and f9ad3d41bc64cd15efd9db81e03b251fa2525b75.

      📒 Files selected for processing (4)
      • apps/server/src/provider/Layers/CursorAdapter.test.ts
      • apps/server/src/provider/Layers/CursorAdapter.ts
      • apps/server/src/provider/acp/CursorTransportFailure.test.ts
      • apps/server/src/provider/acp/CursorTransportFailure.ts

      Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


      📝 Walkthrough

      Walkthrough

      The change detects Cursor transport diagnostics in streamed assistant replies. CursorAdapter now converts qualifying diagnostics into ProviderAdapterRequestError and prevents a completed-turn event. Tests cover streaming, formatting, supported diagnostics, and adapter behavior.

      Changes

      Cursor transport failure handling

      Layer / File(s)Summary
      Transport diagnostic tracking
      apps/server/src/provider/acp/CursorTransportFailure.ts, apps/server/src/provider/acp/CursorTransportFailure.test.ts
      CursorTransportFailure classifies streamed lines, supports partial chunks, recognizes supported Cursor diagnostics, limits line length, and clears failures after new output. Tests cover valid and invalid reply content.
      Cursor adapter error propagation
      apps/server/src/provider/Layers/CursorAdapter.ts, apps/server/src/provider/Layers/CursorAdapter.test.ts
      CursorAdapter tracks assistant content across turns and returns ProviderAdapterRequestError when a completed, non-cancelled turn contains a transport failure. The integration test verifies that no turn.completed event is emitted.

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Merge Risk: ⚪ Minimal · up to f9ad3

      Cursor transport diagnostics returned as assistant text now fail the affected turn instead of appearing as successful output, preserving details for retry. The change is ready to merge with no identified current-head risk.

      Sequence Diagram(s)

      sequenceDiagram
        participant CursorACP
        participant CursorAdapter
        participant TurnCaller
        CursorACP->>CursorAdapter: emit streamed ContentDelta
        CursorAdapter->>CursorAdapter: classify assistant reply
        CursorACP->>CursorAdapter: complete prompt
        CursorAdapter->>TurnCaller: return ProviderAdapterRequestError
      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly and concisely describes the main change: treating Cursor transport-error assistant responses as failed requests.
      Description check✅ PassedThe description clearly explains what changed, why it was needed, scope limitations, behavioral impact, and validation results. The UI Changes section is not needed because this is a server-only chang…
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      • Fix all pre-merge checks with AI
      ✨ Finishing Touches 💡 1
      📝 Generate docstrings 💡
      • Create stacked PR
      • Commit on current branch
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `shivam/cursor-transport-failure`

      Comment `@coderabbitai help` to get the list of available commands.
    5. KaKi87(GitHub profile, opens in a new tab)commented

      Hi,

      I'm afraid I'm still experiencing this issue on version 0.0.40-nightly.20260907.1346 :

      [EDIT] Nevermind, I just realized I've been updating the desktop app but not the remote environment I'm running on, sorry

      Capture d’écran 2026-09-07 à 19 51 16

      Thank you

    6. Hi again,

      So now the errors are indeed shown as errors but T3 Code isn't retrying the retriable requests :

      image

      Thanks

Sign in to join this conversation.