Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
99c7b2e
chore: scaffold codex plugin (build + test toolchain)
XinweiHe Jun 29, 2026
0a5552d
feat: rollout JSONL and hook payload types
XinweiHe Jun 29, 2026
e8719d7
feat: deterministic trace/span ids + primed id generator
XinweiHe Jun 29, 2026
14cdfa0
feat: config resolution (env > project json > global json) + util
XinweiHe Jun 29, 2026
7f6a3b7
feat: sidecar dedup ledger for emitted span ids
XinweiHe Jun 29, 2026
7e029bf
feat: map Codex token usage to backend token attribute keys
XinweiHe Jun 29, 2026
4c7007d
feat: derive git repo/ref from cwd
XinweiHe Jun 29, 2026
f773758
feat: parse Codex rollout into turns/steps/tool-calls
XinweiHe Jun 29, 2026
0b772a7
fix: harden rollout parser (guard message content, no empty step on t…
XinweiHe Jun 29, 2026
d398fe1
fix: make ResponseItem a discriminated union so typecheck passes
XinweiHe Jun 29, 2026
3765640
feat: OTLP exporter + node tracer provider (live SimpleSpanProcessor)
XinweiHe Jun 29, 2026
104ebf3
feat: plan + emit deterministic backdated span tree (backend attr con…
XinweiHe Jun 29, 2026
96aeb8f
feat: orchestrate incremental emission with sidecar dedup (live)
XinweiHe Jun 29, 2026
4007025
feat: fail-open hook entry point
XinweiHe Jun 29, 2026
e76605e
test: cover entry-point fail-open and dispatch paths
XinweiHe Jun 29, 2026
aa6ae6f
feat: codex plugin manifest + hook registration
XinweiHe Jun 29, 2026
e3f4571
build: commit self-contained dist bundle
XinweiHe Jun 29, 2026
e094cdb
docs: README install + configuration
XinweiHe Jun 29, 2026
6ef1225
docs: clarify config precedence in README
XinweiHe Jun 29, 2026
e1eca75
fix: remove subagent overclaim, guard NaN maxChars, mark sidecar post…
XinweiHe Jun 30, 2026
eb8f58b
refactor: adopt Codex marketplace-monorepo layout
XinweiHe Jun 30, 2026
38e6ab9
feat(tracing): enrich tool spans with kind/status/exit_code from *_en…
XinweiHe Jun 30, 2026
22b0916
feat(tracing): add recursive subagent span emission into parent trace
XinweiHe Jun 30, 2026
4df5842
fix(tracing): fail-soft subagent resolution; deprecate subagentThreadIds
XinweiHe Jun 30, 2026
6650b05
fix(tracing): e2e-validated fixes against prod
XinweiHe Jun 30, 2026
747545a
fix(tracing): real Codex multi-agent support + reliable batched export
XinweiHe Jun 30, 2026
e4972e9
fix(tracing): don't double-trace subagent sessions
XinweiHe Jun 30, 2026
2684521
feat(tracing): enrich LLM spans with input + rich output + metadata
XinweiHe Jun 30, 2026
68520f0
feat(tracing): set traceroot.sdk.name/version span attributes
XinweiHe Jun 30, 2026
18ddca9
fix(tracing): name the trace "Codex Turn" from the first live hook
XinweiHe Jun 30, 2026
694b6dc
refactor(tracing): simplification pass (reviewer findings 1-3)
XinweiHe Jun 30, 2026
bb030eb
refactor(tracing): rename two distinctive shared names for clarity/di…
XinweiHe Jun 30, 2026
4637d5d
docs: update README + manifest to current feature set
XinweiHe Jun 30, 2026
d825d5d
docs: tighten README — install/config first, internals trimmed
XinweiHe Jun 30, 2026
ad38562
chore: brand name TraceRoot (display) — leave lowercase identifiers a…
XinweiHe Jun 30, 2026
7fff9c3
ci: fix pnpm version dupe; mark committed bundle as generated
XinweiHe Jun 30, 2026
99f321d
chore: collapse lockfile and license in PR diffs
XinweiHe Jun 30, 2026
bcde2a0
fix: address PR review — config exfil guard, sidecar fail-open, resol…
XinweiHe Jun 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .agents/plugins/marketplace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "traceroot-codex-plugin",
"interface": { "displayName": "TraceRoot" },
"plugins": [
{
"name": "tracing",
"source": { "source": "local", "path": "./plugins/tracing" },
"policy": { "installation": "AVAILABLE", "authentication": "ON_INSTALL" },
"category": "Coding"
}
]
}
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# The committed bundle is a generated artifact (Codex runs it directly — there is
# no build step on install). Keep it tracked, but treat it as generated: collapse
# it in PR diffs and exclude it from GitHub language stats.
plugins/tracing/dist/index.mjs linguist-generated=true -diff

# Lockfile and license text are not human-reviewed line-by-line — collapse them in
# diffs and keep them out of language stats so the reviewable diff is real code.
pnpm-lock.yaml linguist-generated=true -diff
LICENSE linguist-generated=true -diff
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
ci:
name: Typecheck, test, lint:dist
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Typecheck
run: pnpm run typecheck

- name: Test
run: pnpm test

- name: Lint dist
run: pnpm run lint:dist
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules
*.log
.DS_Store
.superpowers/
.env
.env.*
coverage/
.idea/
.vscode/
*.tgz

# NOTE: plugins/tracing/dist/ is intentionally committed (Codex runs the bundle
# directly — no build step on install). Do not ignore it.
184 changes: 184 additions & 0 deletions LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 52 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
# traceroot-codex-plugin

TraceRoot Observability Plugin for OpenAI Codex.
Trace OpenAI Codex sessions to [TraceRoot](https://traceroot.ai). Every query becomes **one live trace** — agent turn, model calls, tool calls, file edits, and any subagents it spawns — streamed as the agent works and linked to your git repo. No daemon; tracing never blocks Codex.

> 🚧 Work in progress — placeholder README. Implementation coming soon.
## Install

```bash
codex plugin marketplace add traceroot-ai/traceroot-codex-plugin
```

Enable it in `~/.codex/config.toml`:

```toml
plugin_hooks = true

[plugins."tracing@traceroot-codex-plugin"]
enabled = true
```

## Configure

Add `~/.codex/traceroot.json` — that's all that's required:

```json
{
"enabled": true,
"api_key": "your-key-from-app.traceroot.ai"
}
```

Get your API key at [app.traceroot.ai](https://app.traceroot.ai). (The plugin runs as a Codex hook, which doesn't reliably inherit your shell environment, so the config file is preferred over environment variables.)

<details>
<summary>Optional settings</summary>

Resolved highest-precedence first: env vars → project `.codex/traceroot.json` → global `~/.codex/traceroot.json` → defaults.

| JSON key | Env var | Default | Notes |
|----------|---------|---------|-------|
| `enabled` | `TRACE_TO_TRACEROOT` | `false` | Turn tracing on (an API key must also be set). |
| `api_key` | `TRACEROOT_API_KEY` | — | Required. |
| `host_url` | `TRACEROOT_HOST_URL` | `https://app.traceroot.ai` | Point at a self-hosted instance. |
| `max_chars` | `TRACEROOT_CODEX_MAX_CHARS` | `20000` | Truncate long span attributes. |
| `debug` | `TRACEROOT_CODEX_DEBUG` | `false` | Log to stderr. |
| `fail_on_error` | `TRACEROOT_CODEX_FAIL_ON_ERROR` | `false` | Off by default — tracing never blocks a Codex turn. |

</details>

## Privacy

Only what appears in your traces is sent to your TraceRoot host: prompts, tool inputs/outputs (which can include commands and file contents), model and token info, and git repo/branch. If your tools handle secrets, their inputs/outputs are part of the trace.

## License

Apache License 2.0 — see [LICENSE](LICENSE).
32 changes: 32 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "traceroot-codex-plugin",
"version": "0.1.0",
"description": "Trace OpenAI Codex sessions to TraceRoot",
"license": "Apache-2.0",
"type": "module",
"private": true,
"scripts": {
"build": "tsdown --config plugins/tracing/tsdown.config.ts",
"test": "vitest run",
"test:watch": "vitest",
"typecheck": "tsc --noEmit",
"lint:dist": "pnpm run build && git diff --exit-code -- plugins/tracing/dist/index.mjs"
},
"dependencies": {
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/core": "^2.0.1",
"@opentelemetry/exporter-trace-otlp-proto": "^0.205.0",
"@opentelemetry/resources": "^2.0.1",
"@opentelemetry/sdk-trace-base": "^2.0.1",
"@opentelemetry/sdk-trace-node": "^2.0.1",
"@opentelemetry/semantic-conventions": "^1.28.0"
},
"devDependencies": {
"@types/node": "^22.10.0",
"tsdown": "^0.18.0",
"typescript": "^5.7.2",
"vitest": "^4.0.0"
},
"engines": { "node": ">=22" },
"packageManager": "pnpm@10.14.0"
}
22 changes: 22 additions & 0 deletions plugins/tracing/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "tracing",
"version": "0.1.0",
"description": "Trace OpenAI Codex sessions to TraceRoot.",
"author": { "name": "TraceRoot", "email": "support@traceroot.ai", "url": "https://traceroot.ai" },
"homepage": "https://github.com/traceroot-ai/traceroot-codex-plugin#readme",
"repository": "https://github.com/traceroot-ai/traceroot-codex-plugin",
"license": "Apache-2.0",
"keywords": ["codex", "hooks", "traceroot", "observability", "tracing"],
"hooks": "./hooks/hooks.json",
"interface": {
"displayName": "Tracing",
"shortDescription": "Trace Codex sessions to TraceRoot",
"longDescription": "Streams each Codex query to TraceRoot as one live trace — agent turns, model calls, tool executions (incl. file edits), token usage, and spawned subagents nested in the same trace, linked to your git repo. Stateless hooks, no daemon, fail-open.",
"developerName": "TraceRoot",
"category": "Coding",
"capabilities": ["Read"],
"websiteURL": "https://traceroot.ai",
"brandColor": "#5B8DEF",
"screenshots": []
}
}
Loading
Loading