~/.codex/sessions/**/rollout-*.jsonl) to reconstruct spans. It runs entirely off Codex’s critical path through a fire-and-forget Stop hook, so Codex never waits on the network.
This is a Weights & Biases Weave plugin. A CoreWeave Forge version isn’t available yet. Traces the plugin sends appear in Agent Lens, because Agent Lens and Weave share the same trace data.
Prerequisites
- Node.js v20 or later.
- OpenAI Codex CLI with the hooks system.
- A CoreWeave Forge account and API key set as a
WANDB_API_KEYenvironment variable. - An Agent Lens project (
[YOUR-TEAM]/[YOUR-PROJECT]) to receive traces.
Install the plugin
1
Install the package
2
Set credentials and project
WANDB_API_KEY directly as an environment variable instead of using wandb login. See Credential resolution order for full precedence rules.3
Install the Stop hook
~/.codex/hooks.json. When each Codex turn completes, the hook spawns a detached worker that reads new rollout lines since a per-session cursor, reconstructs spans, and exports them to Agent Lens.4
Approve the hook in Codex
Codex marks newly added hooks as untrusted and won’t run them until you approve. On your next
codex launch, approve the weave-codex hook when prompted.Alternatively, set bypass_hook_trust = true in ~/.codex/config.toml to skip the prompt.Run weave-codex status to confirm everything is configured correctly.View Codex traces in Agent Lens
After running at least one Codex session, open your project in the Agent Lens UI:- Navigate to CoreWeave Forge, select Agent Lens from the product menu, and then select your project in the project selector at the top of the side menu.
- In the side menu, select Conversations.
- Select a conversation to inspect the full turn hierarchy.
Agent Lens groups turns into a single conversation in the Conversations tab using
gen_ai.conversation.id, which is set to the Codex session ID on every span. Span timestamps are backdated from rollout file timestamps, so durations reflect actual execution time.
Traces also render in any OTEL-compatible backend, since all attributes follow the GenAI semantic conventions.
Known limitations
- The
codex(interactive TUI) andcodex execcommands are supported. Thecodex mcpandapp-servercommands are not covered because they fire no hooks. - A spawned subagent appears as its
spawn_agenttool call only. Its own model calls and tool executions aren’t captured. - The Stop hook doesn’t fire on aborted or errored turns, so those aren’t captured.
Configuration reference
This section lists the settings you can use to customize plugin behavior. Configuration and runtime files are stored in~/.weave-codex/, including settings.json, the hook shim, per-session cursors, and the log file at logs/collector.log.
Credential resolution order
The plugin resolves credentials in this order:- Environment variables (
WANDB_API_KEY,WEAVE_PROJECT). ~/.weave-codex/settings.json.~/.netrcentry for the Agent Lens host.
Check plugin status
You can use these CLI commands to check plugin status or troubleshoot issues:✓ (OK), ✗ (action needed), or - (not yet active but not an error). If turns don’t appear in Agent Lens, check the collector log:
Troubleshooting
The following sections describe common issues and how to resolve them. The collector log at~/.weave-codex/logs/collector.log is the primary diagnostic source. The plugin always logs errors regardless of the debug setting.
No traces appear after running Codex
- Run
weave-codex status. Confirm all checks pass. - Confirm the hook is trusted. If you skipped the approval prompt on first launch, run
codexagain and approve when prompted, or setbypass_hook_trust = truein~/.codex/config.toml. - Confirm
WEAVE_PROJECTis set to a validentity/projectslug.weave-codex statusprints the resolved project. - Confirm the auth source.
weave-codex statusprints the resolved credential source. If it showsWANDB_API_KEY envbut you set the key elsewhere, the plugin reads the wrong value.
Turns appear but input/output text is empty
Content capture may be disabled. Check thatWEAVE_CODEX_CAPTURE_CONTENT isn’t set to 0 and that capture_content isn’t set to false in ~/.weave-codex/settings.json.
Errors sending traces to Agent Lens
If the plugin is active and generates spans that don’t appear in Agent Lens, check the collector log for an export error and match it against this table.Hook-locked environments
Ifallow_managed_hooks_only is set in your Codex config, you can’t add custom hooks directly. Use Codex’s notify program as a fallback trigger instead:
Uninstall
weave-codex entries from ~/.codex/hooks.json.