Skip to content

fix: don't take over the host's global tracing subscriber - #813

Merged
Brooooooklyn merged 1 commit into
mainfrom
claude/project-thread-18ehug
Oct 9, 2026
Merged

Brooooooklyn merged 1 commit into
mainfrom
claude/project-thread-18ehug

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Requested by Brooklyn · project thread

Before: loading the addon always installed a global tracing subscriber with init(). When oxc-node is linked into another Node-API addon that sets up its own tracing (Vite+), it either panicked at load or became the global default and filtered the host's events through OXC_LOG (dropping them when unset).

After: the subscriber is installed only when OXC_LOG is set, and with try_init(), so an existing subscriber is left alone and nothing panics. OXC_LOG=debug with @oxc-node/core logs exactly as before; with OXC_LOG unset nothing was printed before either, since an empty Targets filters everything.

How: init() returns early when OXC_LOG is unset or doesn't parse, then calls try_init() and ignores the error. One behavior change: an unparseable OXC_LOG is now ignored instead of panicking at load.

Closes #805

Tested: cargo test, cargo clippy --all-targets --all-features -D warnings, pnpm test (all packages green), plus a manual OXC_LOG=debug node --import @oxc-node/core/register run.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TH57sBMq1RCCJVrbVkL6FC


Generated by Claude Code

module_init now installs the OXC_LOG subscriber only when OXC_LOG is set,
and uses try_init() so it never panics or replaces a subscriber that an
embedding Node-API addon already installed.

Closes #805

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TH57sBMq1RCCJVrbVkL6FC
@Brooooooklyn Brooooooklyn self-assigned this Oct 9, 2026
@Brooooooklyn
Brooooooklyn marked this pull request as ready for review October 9, 2026 16:10
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 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-10-09T16:12:40.953219Z 9b366d8 Draft marked ready
ℹ️ 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 review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Brooooooklyn
Brooooooklyn merged commit c1400e4 into main Oct 9, 2026
67 checks passed
@Brooooooklyn
Brooooooklyn deleted the claude/project-thread-18ehug branch October 9, 2026 16:28
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.

module_init installs a global tracing subscriber with init(), which panics or takes over the host's subscriber when embedded

2 participants