Repository navigation
fix(cursor): make tracing independent of plugin imports - #167
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4aa872749e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| let persistent = specs == persistent_specs(); | ||
| if persistent { | ||
| for (event, command) in self::specs(PERSISTENT_MARKER, cfg!(windows)) { | ||
| if let Some(entries) = hooks.get_mut(&event).and_then(Value::as_array_mut) { | ||
| entries.retain(|entry| { | ||
| entry.get("command").and_then(Value::as_str) != Some(command.as_str()) | ||
| }); |
There was a problem hiding this comment.
Reconcile capture hooks by marker across upgrades
When a later release changes any generated capture command—for example, by adding an argument or changing the timeout—this migration removes only the old discovery command and the exact current command. The previous braintrust-cursor-capture entry therefore remains while the new one is appended, causing every Cursor event to be captured twice; disabling also leaves the stale entry behind, so a later re-enable restores the duplication. Match and replace/remove persistent entries by their capture marker (including decoding the PowerShell form), rather than enumerating only this one legacy command.
AGENTS.md reference: AGENTS.md:L27-L31
Useful? React with 👍 / 👎.
Remove older capture and discovery commands during enable, update, and disable, including PowerShell entries and retired events. Consolidate setup tests while preserving upgrade and lifecycle coverage.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7beb0bd0c8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| (args.source == "cursor").then(|| cursor_hook_response_for_event(args.event.as_deref())); | ||
| let result = async move { | ||
| if suppress_inherited_hook(&args) { | ||
| if suppress_inherited_hook(&args) || suppress_cursor_plugin_hook(&args) { |
There was a problem hiding this comment.
Apply Cursor suppression in the mounted hook path
When the embedded bt CLI dispatches bt trace hook through run_trace, trace_runtime.rs::run_hook_command calls run_hook_with_route directly, so this new suppression check in run_hook is never reached. Consequently, when both the newly installed user hooks and a Cursor plugin hook are active, both forward the same event; the translator absorbs many identical payloads, but the daemon still journals and processes every duplicate and events outside that deduplication scope can produce repeated operations. Move or repeat the ownership check in the shared path used by run_trace so the production bt command actually suppresses plugin capture.
Useful? React with 👍 / 👎.
Share capture ownership checks across standalone and mounted hook entry points before settings and route resolution. Verify that plugin hooks are suppressed while user hooks still reach the host.
bt trace enable cursorcould report tracing as enabled without capturing any Cursor sessions. It configured the destination and installed a local plugin, but the user hooks only returned no-op responses. Capture therefore depended on Cursor loading the plugin.That dependency breaks when third-party imports are disabled or an older marketplace installation takes precedence over the local plugin. Re-enabling imports can also bring in the Claude tracing plugin: Cursor drops its separate command arguments, runs bare
bt, and treats its exit code 2 as a blocked prompt. Users should be able to trace Cursor without enabling Claude hooks.This change makes
bt trace enable cursorregister capture hooks directly in Cursor's user configuration. User hooks work independently of plugin imports and marketplace versions, so enabling tracing establishes a working capture path. When both user and plugin hooks are active, the user hooks own capture to avoid recording the same event twice. Existing unrelated hooks are preserved.