Skip to content

Deduplicate managed JavaScript tracing adapters - #41

Merged
Stephen Belanger (Qard) merged 2 commits into
mainfrom
fix/managed-run-capture-isolation
Sep 1, 2026
Merged

Deduplicate managed JavaScript tracing adapters#41
Stephen Belanger (Qard) merged 2 commits into
mainfrom
fix/managed-run-capture-isolation

Conversation

@Qard

Copy link
Copy Markdown
Collaborator

What this changes

A managed OpenCode or Pi process can load both its persistently installed Braintrust adapter and the adapter injected by bt trace run. Before this change, both instances could forward the same native events and create duplicate trace operations.

This PR gives the shared JavaScript daemon client one managed-instance claim keyed by agent source and managed-run ID. OpenCode and Pi use that common claim, so exactly one forwarding adapter remains active inside a managed process while ordinary plugin instances remain unaffected.

For OpenCode, managed runs now inject a dedicated @braintrust/trace-opencode/tracing export. It registers only tracing hooks, leaving the package root responsible for optional Braintrust data tools. Both entrypoints share config loading and tracing registration.

This is intentionally limited to invocation-local adapter injection and duplicate-capture suppression. It does not change translator lifecycle, daemon session identity, transcript import, or persistent setup.

Validation

  • make test
  • cargo test --manifest-path bt-daemon/Cargo.toml --all-features
  • cargo clippy --manifest-path bt-daemon/Cargo.toml --all-targets --all-features -- -D warnings
  • shared JavaScript daemon-client tests
  • OpenCode tests, type/lint/format checks, dual-entrypoint build and package dry-run
  • Pi adapter tests and package validation
  • git diff --check

Real-agent tests remain ignored by the default Rust suite; deterministic adapter tests cover installed-plus-injected deduplication directly.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T16:11:46.224350Z 0c293af PR opened
ℹ️ About Codex in GitHub

Your 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c293afe7a

ℹ️ 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".

Comment thread src/plugins/opencode/content/src/index.ts Outdated
@Qard
Stephen Belanger (Qard) merged commit f038181 into main Sep 1, 2026
20 checks passed
@Qard
Stephen Belanger (Qard) deleted the fix/managed-run-capture-isolation branch September 1, 2026 16:45
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.

2 participants