Skip to content

Native experience overhaul: reliability, streaming fidelity, transport (v0.5.0-next.0)#76

Merged
justin-carper merged 22 commits into
mainfrom
general-improvements
Jul 24, 2026
Merged

Native experience overhaul: reliability, streaming fidelity, transport (v0.5.0-next.0)#76
justin-carper merged 22 commits into
mainfrom
general-improvements

Conversation

@justin-carper

Copy link
Copy Markdown
Collaborator

Summary

Overhaul making Cursor-as-provider in opencode feel, function, and perform as natively as possible. Targets the three pain areas identified: reliability, streaming fidelity, and model/feature parity. Ships as 0.5.0-next.0.

22 commits, +2 net test files. 338/338 unit tests green, typecheck clean, build emits DTS. Live E2E transport matrix 6/6 green (verified against Cursor API, cheapest model).

Reliability

  • Typed error classification (error-classify.ts): name/status/code heuristics → agent-not-found | agent-busy | rate-limit | network | auth | config | unknown (never instanceof — sidecar errors cross a JSON boundary as plain objects). Sidecar now preserves status/code/isRetryable/helpUrl round-trip.
  • Typed send recovery: agent-busy → single local.force resend; rate-limit/network → bounded backoff (same agent); auth/config → fail fast. Replaces prior retry-on-any-error.
  • Self-heal gating: fresh-agent+full-replay only for the classified replayable set; auth/config rethrow.
  • Stream watchdog (OPENCODE_CURSOR_STALL_MS, default 60s): pre-first-event stall → cancel + force-resend once; mid-stream stall → cancel wedged run + terminal error (no orphan runs).
  • Idempotency keys on all send sites → safe retries via server-side dedupe.

Transport (native HTTP)

  • Bun node:http2 breaks Cursor's connect-RPC streaming (upstream oven-sh/bun#31499, NOT_PLANNED, still failing). No released Bun fix.
  • New transport resolution: http1 (Bun default, via Cursor.configure({local:{useHttp1ForAgent:true}})), http2-direct (Node default), sidecar (fallback). Configurable via transport option or OPENCODE_CURSOR_TRANSPORT. Legacy OPENCODE_CURSOR_SIDECAR=0 routes to http1 under Bun (was routing to broken http2-direct).
  • Node sidecar is now fallback, not required — simpler default path, live-verified TTFT parity (http1 0.93× sidecar).

Streaming fidelity

  • Tool-input streaming: partial-tool-calltool-input-start/-delta/-end (opportunistic, SDK-dependent; edit stays diff-buffered). Live plan streaming for createPlan. Kill-switch OPENCODE_CURSOR_TOOL_INPUT_STREAM=0.
  • Thinking duration + compaction count surfaced on finish providerMetadata.cursor.
  • semSearch native adapter.
  • Silent-replay usage aggregation: multi-message replay turns' token usage folded into the visible turn's finish (fixes undercount).

Model / feature parity

  • SDK-authoritative model variants: prefer Cursor.models.list() variants (displayName/isDefault) over generated ones; deterministic slug with collision counter.
  • autoReview option (classifier tool-gating; best-effort, not a security boundary).
  • cursor_delegate multi-root workspaces (additionalCwds).

Hygiene

  • Deps: @cursor/sdk ^1.0.24, @opencode-ai/plugin+sdk ^1.18.4. Node floor >=22.13 (SDK requirement — package.json previously claimed 22.0 while the SDK needed 22.13).

Test plan

  • npm test → 338/338 (29 files)
  • npm run typecheck → clean
  • npm run build → ESM + DTS emitted
  • E2E=1 npm run test:e2e → transport matrix 6/6 (tool-parity, resume, long-stream >64KB, recovery) against live Cursor API

@justin-carper
justin-carper merged commit 48ebcda into main Jul 24, 2026
6 checks passed
@justin-carper
justin-carper deleted the general-improvements branch July 24, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant