Summary
When resuming an inactive Cursor session, the hub spawns a new CLI process and calls ACP session/load. For several seconds the new hapi session has no cursorSessionId in metadata, breaking dedup, picker gating, and resume-unavailable checks on the web.
Repro
- Spawn Cursor session, wait for
cursorSessionId.
- Send message, archive.
POST /api/sessions/:id/resume.
- Poll
GET /api/sessions/:newId — metadata.cursorSessionId is null for ~0–6s, then populated with the same ACP thread id.
CLI log shows: cursor --resume <cursorSessionId> --hapi-starting-mode remote --started-by runner.
Root cause
cursorAcpRemoteLauncher calls backend.loadSession() then onSessionFoundWithProtocol(). Metadata is written only after load completes. Zed fixed an analogous race in PR #54431 by registering the session before awaiting session/load.
Proposed fix
- On resume bootstrap, immediately write pending
cursorSessionId (+ cursorSessionProtocol: 'acp') from hub resume token into metadata (via bootstrapExistingSession + pickExistingSessionMetadata, or hub-side merge on spawn).
- Optionally coalesce in-flight resume for same
cursorSessionId (Zed pending_sessions pattern, PR #53999).
Related
Test plan
- CLI test: resume path sets metadata before load resolves (mock backend).
- Live: resume → assert
cursorSessionId present within first GET /api/sessions/:id.
Summary
When resuming an inactive Cursor session, the hub spawns a new CLI process and calls ACP
session/load. For several seconds the new hapi session has nocursorSessionIdin metadata, breaking dedup, picker gating, and resume-unavailable checks on the web.Repro
cursorSessionId.POST /api/sessions/:id/resume.GET /api/sessions/:newId—metadata.cursorSessionIdis null for ~0–6s, then populated with the same ACP thread id.CLI log shows:
cursor --resume <cursorSessionId> --hapi-starting-mode remote --started-by runner.Root cause
cursorAcpRemoteLaunchercallsbackend.loadSession()thenonSessionFoundWithProtocol(). Metadata is written only after load completes. Zed fixed an analogous race in PR #54431 by registering the session before awaitingsession/load.Proposed fix
cursorSessionId(+cursorSessionProtocol: 'acp') from hub resume token into metadata (viabootstrapExistingSession+pickExistingSessionMetadata, or hub-side merge on spawn).cursorSessionId(Zedpending_sessionspattern, PR #53999).Related
Test plan
cursorSessionIdpresent within firstGET /api/sessions/:id.