Support instance-level originator metadata

Resolved 💬 2 comments Opened Oct 6, 2025 by andjohnsonj5 Closed Jan 14, 2026

Summary

originator() today doubles as both the logical component identity (e.g. codex_cli_rs) and the process-level identifier that gets copied into OTEL's service.name and outbound request headers. This makes it hard to tag telemetry for specific instances of the CLI.

Current Behaviour

  • The global originator is initialised once at runtime (codex-rs/core/src/default_client.rs).
  • exec attempts to switch it to codex_exec, but only succeeds if nothing else has touched originator() yet.
  • There is no supported way to include per-instance context (hostname, session id, etc.) while keeping the component category.

Desired Behaviour

  • Allow users/config to inject an instance-level tag so OTEL exports can distinguish codex_cli_rs@my-host from other instances.
  • Ensure subcommands such as codex exec can reliably set their own originator before telemetry starts flowing.

Additional Context

Right now we recommend setting the CODEX_INTERNAL_ORIGINATOR_OVERRIDE env var, but any code path that accesses originator() before the override runs leaves us stuck with the default value. Exposing a supported mechanism (for example, by adding a separate instance-id attribute to the OTEL resource and tolerating overrides in exec) would unblock observability dashboards.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗