core-agent-ide/codex-rs/otel/src
Owen Lin aa3fe8abf8
feat(core): persist trace_id for turns in RolloutItem::TurnContext (#13602)
This PR adds a durable trace linkage for each turn by storing the active
trace ID on the rollout TurnContext record stored in session rollout
files.

Before this change, we propagated trace context at runtime but didn’t
persist a stable per-turn trace key in rollout history. That made
after-the-fact debugging harder (for example, mapping a historical turn
to the corresponding trace in datadog). This sets us up for much easier
debugging in the future.

### What changed
- Added an optional `trace_id` to TurnContextItem (rollout schema).
- Added a small OTEL helper to read the current span trace ID.
- Captured `trace_id` when creating `TurnContext` and included it in
`to_turn_context_item()`.
- Updated tests and fixtures that construct TurnContextItem so
older/no-trace cases still work.

### Why this approach
TurnContext is already the canonical durable per-turn metadata in
rollout. This keeps ownership clean: trace linkage lives with other
persisted turn metadata.
2026-03-05 13:26:48 -08:00
..
metrics feat: expose detailed metrics to runtime metrics (#10699) 2026-02-05 18:22:30 -08:00
traces image-gen-core (#13290) 2026-03-03 23:11:28 -08:00
config.rs feat: show runtime metrics in console (#10278) 2026-01-30 22:20:02 -08:00
lib.rs feat(core): persist trace_id for turns in RolloutItem::TurnContext (#13602) 2026-03-05 13:26:48 -08:00
otel_provider.rs feat(app-server): propagate app-server trace context into core (#13368) 2026-03-04 01:03:45 +00:00
otlp.rs feat: metrics capabilities (#8318) 2026-01-08 11:47:36 +00:00
trace_context.rs feat(core): persist trace_id for turns in RolloutItem::TurnContext (#13602) 2026-03-05 13:26:48 -08:00