Skip to content

fix(desktop,host-service): show Cursor Composer instead of stale Claude for Cursor sessions - #5882

Merged
saddlepaddle merged 1 commit into
mainfrom
fix-ai-model-fallback
Jul 22, 2026
Merged

saddlepaddle merged 1 commit into
mainfrom
fix-ai-model-fallback

Conversation

@saddlepaddle

@saddlepaddle saddlepaddle commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  1. Superset installs a global ~/.cursor/hooks.json whose hooks fire for every Cursor session — including the in-IDE Composer, not just the cursor-agent CLI.
  2. Only the cursor-agent PATH wrapper stamps SUPERSET_AGENT_ID; Composer never runs through it, so its hook events posted an empty agent id.
  3. TerminalAgentStore.recordEvent inherits the terminal's prior agentId when an event carries none — and since claude is 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.sh now resolves the agent id itself: unset SUPERSET_AGENT_ID + CURSOR_AGENT/CURSOR_CLI in env → unwrapped cursor-agent CLI; otherwise → new cursor-composer id. The hook never posts an empty identity, which also neutralizes the stale-inherit path (the store replaces the identity when the id changes).
  • New identity-only agent concept: EXTERNAL_AGENT_IDS / AGENT_IDENTITY_IDS / AGENT_IDENTITY_LABELS in agent-catalog.ts. cursor-composer ("Cursor Composer", Cursor icon) is identifiable but deliberately not in BUILTIN_AGENT_IDS, so it never surfaces as a startable preset in MCP/command-watcher enums.
  • Widened AgentIdentity.agentId / TerminalAgentId / binding schema $type to AgentIdentityId (type-only; the sqlite column is plain TEXT — no migration).
  • Binding display sites (sidebar badge, pane icon, native notifications) resolve labels via AGENT_IDENTITY_LABELS.
  • Bumped CURSOR_HOOK_MARKER to v4 so existing installs pick up the new script.

Verification

  • Simulated the rendered hook script with a stubbed curl for all three cases — Composer → cursor-composer, unwrapped CLI (CURSOR_AGENT=1) → cursor-agent, wrapped CLI → cursor-agent.
  • bun run typecheck, bun run lint clean; 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.

  • Bug Fixes
    • Updated cursor-hook.template.sh to resolve agentId: cursor-agent for CLI, cursor-composer for IDE; never posts empty ids.
    • Added identity-only agents via AGENT_IDENTITY_IDS and AGENT_IDENTITY_LABELS (includes "Cursor Composer") while keeping it out of BUILTIN_AGENT_IDS.
    • Broadened types to AgentIdentityId in host/renderer (schema.ts, terminal agent types, and @superset/shared/agent-catalog); DB column remains TEXT, no migration.
    • UI uses AGENT_IDENTITY_LABELS for labels/icons in the dashboard sidebar, terminal pane icon, and native notifications; added icon mapping for cursor-composer.
    • Bumped hook marker to v4 to force script update; adjusted tests to match.

Written for commit 82dcb7f. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added support for Cursor Composer as a recognized agent, including its display label and preset icon.
    • Running agents and terminal sessions now show consistent labels for built-in and external agents.
    • Cursor hooks now identify the appropriate agent automatically when no agent ID is configured.
  • Bug Fixes

    • Updated Cursor hook markers to the latest version.
    • Improved agent identity handling across sessions and notifications.

…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
@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3c8c06d3-1603-4921-8a8a-c25d4a4e9b7d

📥 Commits

Reviewing files that changed from the base of the PR and between 46313e6 and 82dcb7f.

📒 Files selected for processing (12)
  • apps/desktop/src/main/lib/agent-setup/agent-wrappers-cursor.ts
  • apps/desktop/src/main/lib/agent-setup/agent-wrappers.test.ts
  • apps/desktop/src/main/lib/agent-setup/notify-hook.test.ts
  • apps/desktop/src/main/lib/agent-setup/templates/cursor-hook.template.sh
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/components/DashboardSidebarWorkspaceItem/components/DashboardSidebarWorkspaceDetails/hooks/useDashboardSidebarWorkspaceRunningAgents/useDashboardSidebarWorkspaceRunningAgents.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/TerminalPane/components/TerminalPaneIcon/TerminalPaneIcon.tsx
  • apps/desktop/src/renderer/routes/_authenticated/components/V2NotificationController/lib/notificationContent.ts
  • packages/host-service/src/db/schema.ts
  • packages/host-service/src/terminal-agents/types.ts
  • packages/shared/src/agent-catalog.ts
  • packages/shared/src/agent-identity.ts
  • packages/ui/src/assets/icons/preset-icons/index.ts

📝 Walkthrough

Walkthrough

Cursor Composer is added as an agent identity. Cursor hooks now identify cursor-agent or cursor-composer, while host-service types and desktop labels, notifications, and icons support the expanded identity model.

Changes

Cursor Composer agent identity

Layer / File(s) Summary
Agent identity contract
packages/shared/src/agent-catalog.ts, packages/shared/src/agent-identity.ts, packages/host-service/src/...
Adds AgentIdentityId, labels, optional identity metadata, and updates terminal-agent binding types to accept external identities.
Cursor hook agent identification
apps/desktop/src/main/lib/agent-setup/templates/cursor-hook.template.sh, apps/desktop/src/main/lib/agent-setup/*.test.ts
Derives AGENT_ID from Cursor environment variables, posts it in webhook payloads, and updates hook marker and payload expectations.
Desktop agent presentation
apps/desktop/src/renderer/routes/_authenticated/..., packages/ui/src/assets/icons/preset-icons/index.ts
Uses identity labels in running-agent, terminal, and notification displays and adds the Cursor Composer preset icon.

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
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is conventional, concise, and accurately summarizes the main Cursor Composer label fix.
Description check ✅ Passed It covers the problem, fix, and verification, matching the template's intent despite different section headings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-ai-model-fallback

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.

@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

@saddlepaddle
saddlepaddle merged commit 47f7c44 into main Jul 22, 2026
18 checks passed
Laurence-NZ added a commit to Laurence-NZ/superset-pwsh that referenced this pull request Jul 23, 2026
…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
Laurence-NZ added a commit to Laurence-NZ/superset-pwsh that referenced this pull request Jul 23, 2026
…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

This branch was previously deployed

1 inactive deployment
preview — 82dcb7ff Deployed Jul 22, 2026 by saddlepaddle via Deploy API #6785
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