Skip to content

fix(cursor): pin session id and continue external tool results as userMessageAction (lands #1990) - #2017

Merged
lidge-jun merged 4 commits into
devfrom
codex/land-1990
Aug 18, 2026
Merged

fix(cursor): pin session id and continue external tool results as userMessageAction (lands #1990)#2017
lidge-jun merged 4 commits into
devfrom
codex/land-1990

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

Lands contributor PR #1990 (laerad777) on current dev: the cursor live transport pins one stable session id per logical conversation (was randomUUID() per request, so server-side thread reuse never engaged), and external tool results continue as userMessageAction. The one test conflict against #1997's assistant-role assertions is composed (both assertions kept).

Verification

  • cursor live-transport + adapter + blob + hardening + transport-retry suites: 147/0
  • tsc --noEmit clean

Checklist

  • Original PR's regression tests included
  • Typecheck green
  • No GUI change (no screenshot required)

Summary by CodeRabbit

  • Bug Fixes

    • Improved Cursor conversation continuity across retries and transport reconnects.
    • Preserved tool-result history when external models continue a conversation.
    • Improved cleanup and execution context handling for live sessions.
    • Normalized blank session identifiers to prevent connection issues.
  • Tests

    • Added coverage for session continuity, external tool-result continuations, and live transport behavior.

mose and others added 4 commits August 18, 2026 12:59
Reuse the resolved conversationId as Connect x-session-id so
transport rebuilds for the same client thread keep one session
identity. Fall back to a random UUID only when no session identity
exists. Native-exec/background shells use a separate per-transport
owner (see follow-up commit).
…ction

Drive external-model tool-result hops as userMessageAction so
history-blob tool results stay visible without ResumeAction. Native
models keep resumeAction. Live Connect probes informed this encoding
choice; unit tests only lock the action case.
Independent review: do not claim the 429 diagnosis from unit tests, keep
native-exec/background shells on a per-transport owner so overlapping
turns cannot reap each other, and lock sessionId forwarding in adapter
plus Connect header tests.
# Conflicts:
#	tests/cursor-blob.test.ts
@lidge-jun
lidge-jun merged commit 394b59b into dev Aug 18, 2026
3 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d992269c-de69-4c01-ac79-6b0cd6b9bca2

📥 Commits

Reviewing files that changed from the base of the PR and between 891c828 and c6b8d7e.

📒 Files selected for processing (8)
  • src/adapters/cursor.ts
  • src/adapters/cursor/live-transport.ts
  • src/adapters/cursor/protobuf-request.ts
  • src/adapters/cursor/transport.ts
  • tests/cursor-adapter.test.ts
  • tests/cursor-blob.test.ts
  • tests/cursor-hardening.test.ts
  • tests/cursor-live-transport.test.ts

📝 Walkthrough

Walkthrough

Cursor now preserves conversation IDs across transport rebuilds, separates Connect session IDs from shell ownership IDs, and sends explicit continuation text for external-model tool-result replays. Tests cover session propagation, header transmission, ownership isolation, and continuation history.

Changes

Cursor session continuity

Layer / File(s) Summary
Session identity and shell ownership
src/adapters/cursor.ts, src/adapters/cursor/transport.ts, src/adapters/cursor/live-transport.ts, tests/cursor-adapter.test.ts, tests/cursor-hardening.test.ts, tests/cursor-live-transport.test.ts
Cursor turn retries pass the conversation ID as sessionId. Transports preserve trimmed injected IDs and use a separate shellOwnerId for native execution contexts and shell cleanup. Tests verify transport IDs, Connect headers, isolated helper sessions, and blank-ID normalization.
External-model tool-result continuations
src/adapters/cursor/protobuf-request.ts, tests/cursor-blob.test.ts
External models use userMessageAction with the configured continuation text after tool results. Native models retain resumeAction. Token estimation uses the selected action text, and replay tests verify tool-result history retention.

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

Sequence Diagram(s)

sequenceDiagram
  participant CursorTurn
  participant CursorTransportFactory
  participant LiveCursorTransport
  participant NativeExecution
  CursorTurn->>CursorTransportFactory: pass conversation ID as sessionId
  CursorTransportFactory->>LiveCursorTransport: create transport with sessionId
  LiveCursorTransport->>NativeExecution: use shellOwnerId for execution context
  LiveCursorTransport->>NativeExecution: clean up shells by shellOwnerId
Loading
sequenceDiagram
  participant CursorRequest
  participant ProtobufRequest
  participant ExternalModel
  CursorRequest->>ProtobufRequest: provide tool-result history
  ProtobufRequest->>ProtobufRequest: select continuation text
  ProtobufRequest->>ExternalModel: send userMessageAction with continuation text
Loading

Possibly related PRs

Suggested reviewers: ingwannu, wibias

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/land-1990

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant