fix: attribute Cursor-hosted hooks correctly#139
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughCursor is added as a supported host across runtime detection, hook attribution, session parsing, dashboard display, and regression tests. Hook events can derive Cursor metadata from environment variables and transcript paths while preserving Claude Code precedence. ChangesCursor attribution
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Hook as hook.main
participant Runtime as runtime.resolve_hook_host
participant State as Session state
participant Log as Hook log
Hook->>Runtime: Resolve declared host and payload
Runtime-->>Hook: Return effective host
Hook->>State: Set host and Cursor cwd
Hook->>Log: Record attribution and metadata
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_cursor_support.py`:
- Around line 145-153: Extend
test_explicit_non_claude_host_is_not_reclassified_as_cursor to cover the
explicit "codex" host, either by adding a separate assertion or parameterizing
the existing test. Preserve the CURSOR_TRANSCRIPT_PATH setup and verify
runtime.resolve_hook_host returns "codex" unchanged under Cursor signals.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 442bf1b7-7a3e-4f16-b81a-70f1217c1593
📒 Files selected for processing (2)
plugin/dashboard/components/common/host-badge.tsxtests/test_cursor_support.py
🚧 Files skipped from review as they are similar to previous changes (1)
- plugin/dashboard/components/common/host-badge.tsx
Review follow-upApplied the accepted non-behavioral feedback in
A clean-context GPT-5.6 Terra High simplification review found no safe core refactor; the existing detection order, path containment, hook-level payload normalization, and typed dashboard contracts are the leanest low-regression shape. Validation: |

What's broken / annoying
Cursor loads the Claude Code plugin directly, so claude-smart currently receives a hook command that says
claude-codeeven when Cursor launched it. New local session rows and hook telemetry are therefore mislabeled, and project-scoped learnings can fall back to a plugin-version project ID when Cursor omitscwd.What's changing
claude-codehook tocursoronly when positive Cursor signals are present and Claude Code's own entrypoint is absent.cwdfromCURSOR_PROJECT_DIRbefore resolving project identity.cursoras a supported local host in session JSONL and dashboard parsing.Generated via Cursor.How the product behaves afterwards
cursor.cwdcould create a junk project scope.CURSOR_PROJECT_DIRsupplies the missing working directory.Real Claude Code remains Claude Code when
CLAUDE_CODE_ENTRYPOINTis present. Explicit Codex and OpenCode hooks are never reclassified. Host metadata stays local and is still removed before interactions are published to Reflexio; the shared learning namespace is unchanged. Existing records are not rewritten, and shared skills remain host-free because they can aggregate multiple sessions.Verification
693 passed, 1 skippedin the full Python suite.cwdrecovery, layered detection, explicit-host protection, and Claude Code precedence.rgb(214, 213, 210)/rgb(38, 37, 30); OpenCodergb(19, 16, 16)/ white.A sanitized browser screenshot is attached in the PR conversation.
Summary by CodeRabbit
New Features
Bug Fixes
Tests