mirror of
https://github.com/openai/codex.git
synced 2026-05-16 01:02:48 +00:00
## Summary Adds the debug CLI entry point for reducing recorded rollout traces. This gives developers a direct way to inspect whether the emitted trace stream reduces into the expected conversation/runtime model. ## Stack This is PR 5/5 in the rollout trace stack. - [#18876](https://github.com/openai/codex/pull/18876): Add rollout trace crate - [#18877](https://github.com/openai/codex/pull/18877): Record core session rollout traces - [#18878](https://github.com/openai/codex/pull/18878): Trace tool and code-mode boundaries - [#18879](https://github.com/openai/codex/pull/18879): Trace sessions and multi-agent edges - [#18880](https://github.com/openai/codex/pull/18880): Add debug trace reduction command ## Review Notes This PR is intentionally last: it depends on the trace crate, core recorder, runtime/tool events, and session/agent edge data all existing. The command should remain a debug/developer tool and avoid adding new runtime behavior. The useful review question is whether the CLI exposes the reducer in the smallest practical way for local inspection without turning the debug command into a supported user-facing workflow.
76 lines
3.2 KiB
Rust
76 lines
3.2 KiB
Rust
//! Trace bundle format, writer, and reducer for Codex rollouts.
|
|
//!
|
|
//! This crate owns the trace schema. Hot-path Codex code should depend on the
|
|
//! small writer API here; semantic replay and viewer projections stay outside
|
|
//! `codex-core`.
|
|
//!
|
|
//! See `README.md` for the system diagram and reducer model.
|
|
|
|
mod bundle;
|
|
mod code_cell;
|
|
mod compaction;
|
|
mod inference;
|
|
mod model;
|
|
mod payload;
|
|
mod protocol_event;
|
|
mod raw_event;
|
|
mod reducer;
|
|
mod thread;
|
|
mod tool_dispatch;
|
|
mod writer;
|
|
|
|
/// Conventional reduced-state cache name written next to a raw trace bundle.
|
|
pub use bundle::REDUCED_STATE_FILE_NAME;
|
|
/// No-op-capable handle for recording one code-mode runtime cell.
|
|
pub use code_cell::CodeCellTraceContext;
|
|
/// Raw checkpoint payload for a remote compaction install event.
|
|
pub use compaction::CompactionCheckpointTracePayload;
|
|
/// No-op-capable handle for recording remote-compaction requests.
|
|
pub use compaction::CompactionTraceAttempt;
|
|
/// Shared recorder context for a compaction checkpoint.
|
|
pub use compaction::CompactionTraceContext;
|
|
/// No-op-capable handle for recording one upstream inference attempt.
|
|
pub use inference::InferenceTraceAttempt;
|
|
/// Shared recorder context for inference attempts within one Codex turn.
|
|
pub use inference::InferenceTraceContext;
|
|
/// Public reduced trace model returned by replay.
|
|
pub use model::*;
|
|
/// Stable identifier for one raw payload inside a rollout bundle.
|
|
pub use payload::RawPayloadId;
|
|
/// Coarse role labels for raw payload files.
|
|
pub use payload::RawPayloadKind;
|
|
/// Reference to a raw request/response/log payload stored in the bundle.
|
|
pub use payload::RawPayloadRef;
|
|
/// Monotonic sequence number assigned by the raw trace writer.
|
|
pub use raw_event::RawEventSeq;
|
|
/// Runtime requester observed before semantic reduction.
|
|
pub use raw_event::RawToolCallRequester;
|
|
/// One append-only raw trace event from `trace.jsonl`.
|
|
pub use raw_event::RawTraceEvent;
|
|
/// Event-envelope context supplied by hot-path trace producers.
|
|
pub use raw_event::RawTraceEventContext;
|
|
/// Typed payload for one raw trace event.
|
|
pub use raw_event::RawTraceEventPayload;
|
|
/// Replay a raw trace bundle and write/read its reduced `RolloutTrace`.
|
|
pub use reducer::replay_bundle;
|
|
/// Raw payload captured when a child agent reports completion to its parent.
|
|
pub use thread::AgentResultTracePayload;
|
|
/// Environment variable that enables local trace-bundle recording.
|
|
pub use thread::CODEX_ROLLOUT_TRACE_ROOT_ENV;
|
|
/// Raw metadata captured when a thread starts.
|
|
pub use thread::ThreadStartedTraceMetadata;
|
|
/// No-op-capable handle for recording one thread in a rollout bundle.
|
|
pub use thread::ThreadTraceContext;
|
|
/// Request data for the canonical Codex tool boundary.
|
|
pub use tool_dispatch::ToolDispatchInvocation;
|
|
/// Tool input observed at the registry boundary.
|
|
pub use tool_dispatch::ToolDispatchPayload;
|
|
/// Runtime source that caused a dispatch-level tool call.
|
|
pub use tool_dispatch::ToolDispatchRequester;
|
|
/// Result data returned from a dispatch-level tool call.
|
|
pub use tool_dispatch::ToolDispatchResult;
|
|
/// No-op-capable handle for recording one resolved tool dispatch.
|
|
pub use tool_dispatch::ToolDispatchTraceContext;
|
|
/// Append-only writer used by hot-path Codex instrumentation.
|
|
pub use writer::TraceWriter;
|