Repository navigation
fix(desktop,host-service): show Cursor Composer instead of stale Claude for Cursor sessions - #5882
Conversation
…de for Cursor sessions Cursor's in-IDE Composer fires our global ~/.cursor/hooks.json hooks but never runs through the cursor-agent PATH wrapper, so it posted an empty SUPERSET_AGENT_ID and the terminal-agent store silently inherited the terminal's prior binding — almost always "claude", the seeded default preset. Two Composer windows rendered as two "Claude" badges. The cursor hook script now resolves the identity itself: an unset SUPERSET_AGENT_ID with CURSOR_AGENT/CURSOR_CLI in the env is an unwrapped cursor-agent CLI run; anything else is the IDE Composer, reported as the new identity-only "cursor-composer" agent id. Identity-only ids live in AGENT_IDENTITY_IDS/AGENT_IDENTITY_LABELS beside the startable builtin catalog so Composer never appears as a launchable preset. Claude-Session: https://claude.ai/code/session_01GCN4TfHwbXbKTYFVnNiLFR
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughCursor Composer is added as an agent identity. Cursor hooks now identify ChangesCursor Composer agent identity
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CursorRuntime
participant CursorHookTemplate
participant SupersetHostWebhook
participant DashboardUI
CursorRuntime->>CursorHookTemplate: Provide Cursor environment variables
CursorHookTemplate->>CursorHookTemplate: Derive AGENT_ID
CursorHookTemplate->>SupersetHostWebhook: Post agent.agentId
SupersetHostWebhook->>DashboardUI: Expose terminal agent binding
DashboardUI->>DashboardUI: Resolve identity label and icon
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
…host CLI ParadevAI#5885, Cursor session labels ParadevAI#5882, open-in-IDE v2 ParadevAI#5877, collapsed sidebar DnD ParadevAI#5871, automations FK drop ParadevAI#5878) # Conflicts: # apps/desktop/src/main/lib/agent-setup/notify-hook.test.ts
…host CLI ParadevAI#5885, Cursor session labels ParadevAI#5882, open-in-IDE v2 ParadevAI#5877, collapsed sidebar DnD ParadevAI#5871, automations FK drop ParadevAI#5878) # Conflicts: # apps/desktop/src/main/lib/agent-setup/notify-hook.test.ts
Problem
User report (Discord): two Cursor Composer agent windows open, but the workspace sidebar showed two Claude badges with "Agent working" tooltips.
Root cause chain:
~/.cursor/hooks.jsonwhose hooks fire for every Cursor session — including the in-IDE Composer, not just thecursor-agentCLI.cursor-agentPATH wrapper stampsSUPERSET_AGENT_ID; Composer never runs through it, so its hook events posted an empty agent id.TerminalAgentStore.recordEventinherits the terminal's prioragentIdwhen an event carries none — and sinceclaudeis the seeded first default preset, the binding almost always stayed"claude"while Composer refreshed its status.Cursor's hook payload has no surface/client field (verified against cursor.com/docs/hooks and the shipped app/CLI bundles), so the identity has to be resolved at the hook script.
Fix
cursor-hook.template.shnow resolves the agent id itself: unsetSUPERSET_AGENT_ID+CURSOR_AGENT/CURSOR_CLIin env → unwrappedcursor-agentCLI; otherwise → newcursor-composerid. The hook never posts an empty identity, which also neutralizes the stale-inherit path (the store replaces the identity when the id changes).EXTERNAL_AGENT_IDS/AGENT_IDENTITY_IDS/AGENT_IDENTITY_LABELSinagent-catalog.ts.cursor-composer("Cursor Composer", Cursor icon) is identifiable but deliberately not inBUILTIN_AGENT_IDS, so it never surfaces as a startable preset in MCP/command-watcher enums.AgentIdentity.agentId/TerminalAgentId/ binding schema$typetoAgentIdentityId(type-only; the sqlite column is plain TEXT — no migration).AGENT_IDENTITY_LABELS.CURSOR_HOOK_MARKERto v4 so existing installs pick up the new script.Verification
curlfor all three cases — Composer →cursor-composer, unwrapped CLI (CURSOR_AGENT=1) →cursor-agent, wrapped CLI →cursor-agent.bun run typecheck,bun run lintclean; agent-setup + terminal-agents tests pass (bun 1.3.14, matching.bun-version).https://claude.ai/code/session_01GCN4TfHwbXbKTYFVnNiLFR
Summary by cubic
Fixes incorrect "Claude" badges for Cursor sessions by identifying the in-IDE Composer as "Cursor Composer" and sending a non-empty agent id from the Cursor hook. UI now shows the right label and icon across the sidebar, terminal panes, and notifications.
cursor-hook.template.shto resolveagentId:cursor-agentfor CLI,cursor-composerfor IDE; never posts empty ids.AGENT_IDENTITY_IDSandAGENT_IDENTITY_LABELS(includes "Cursor Composer") while keeping it out ofBUILTIN_AGENT_IDS.AgentIdentityIdin host/renderer (schema.ts, terminal agent types, and@superset/shared/agent-catalog); DB column remains TEXT, no migration.AGENT_IDENTITY_LABELSfor labels/icons in the dashboard sidebar, terminal pane icon, and native notifications; added icon mapping forcursor-composer.Written for commit 82dcb7f. Summary will update on new commits.
Summary by CodeRabbit
New Features
Bug Fixes