Skip to content

fix: Cursor IDE compat (platform source + empty stdin)#3049

Open
Steaeavean wants to merge 3 commits into
thedotmack:mainfrom
Steaeavean:fix/cursor-platform-compat
Open

fix: Cursor IDE compat (platform source + empty stdin)#3049
Steaeavean wants to merge 3 commits into
thedotmack:mainfrom
Steaeavean:fix/cursor-platform-compat

Conversation

@Steaeavean

Copy link
Copy Markdown

Two fixes for Cursor + Claude Code dual-IDE setups on macOS.\n\n1. Platform source conflict — update incoming platform_source instead of throwing (observations were dropped with HTTP 500).\n2. Empty stdin (#2188) — default no-op for non-lifecycle hooks; restore diagnostics via CLAUDE_MEM_STRICT_STDIN=1.\n\nTested locally on claude-mem 13.8.1.

Cursor and Claude Code can share a content_session_id; last incoming platform_source wins so observations are not dropped with HTTP 500.
Default empty stdin on non-lifecycle hooks is a no-op (Cursor fires these routinely). Set CLAUDE_MEM_STRICT_STDIN=1 to restore issue thedotmack#2188 CAPTURE_BROKEN diagnostics for WSL/bash debugging.
@greptile-apps

greptile-apps Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates Cursor and Claude Code hook handling for dual-IDE setups. The main changes are:

  • Empty non-lifecycle stdin now exits as a no-op by default.
  • Strict empty-stdin diagnostics can be restored with CLAUDE_MEM_STRICT_STDIN=1.
  • Cursor hook input now carries platform: 'cursor'.
  • Existing sessions now update conflicting platform_source values instead of throwing.

Confidence Score: 3/5

Merge should wait for the session source handling to preserve existing Cursor attribution when incoming requests omit a source.

The change addresses the previous conflict path, but a focused persistence check shows an omitted source can still relabel an existing Cursor session and affect source-scoped behavior.

src/services/sqlite/SessionStore.ts

T-Rex T-Rex Logs

What T-Rex did

  • Reproduced the default source overwrite by running a focused Bun repro against the real SessionStore with an in-memory sqlite database.
  • Inspected the empty-stdin-noop sequence by examining before/after logs to confirm the strict-mode diagnostic and that persisted files exist.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (2): Last reviewed commit: "fix(cursor): stop platform_source confli..." | Re-trigger Greptile

….8.1)

Set explicit platform on Cursor adapter payloads, allow omitted platformSource
in ingestObservation, and rebuild worker bundles so mixed IDE sessions no
longer return 500 Platform source conflict.
Comment on lines 1734 to +1740
} else if (storedPlatformSource !== resolved.platformSource) {
throw new Error(
`Platform source conflict for session ${contentSessionId}: existing=${storedPlatformSource}, received=${resolved.platformSource}`
);
// Cursor and Claude Code can share a content_session_id across IDEs;
// last-writer wins instead of dropping observations with HTTP 500.
this.db.prepare(`
UPDATE sdk_sessions SET platform_source = ?
WHERE content_session_id = ?
`).run(resolved.platformSource, contentSessionId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Default source overwrites
This update treats every conflicting platformSource as authoritative, but current summarize paths still call normalizePlatformSource(req.body.platformSource) / normalizePlatformSource(payload.platformSource), which converts an omitted source to claude. A Cursor session followed by a source-less summarize request now gets relabeled to claude, breaking source-scoped filtering instead of just avoiding the 500.

Artifacts

Repro: focused SessionStore sqlite reproduction script

  • Contains supporting evidence from the run (text/typescript; charset=utf-8).

Repro: command output showing before cursor and after claude database state

  • Keeps the command output available without making the summary code-heavy.

View artifacts

T-Rex Ran code and verified through T-Rex

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