[rollout_trace] Add rollout trace crate#18876
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1f33a055d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
jif-oai
left a comment
There was a problem hiding this comment.
The shape looks good but this PR implies that the producer needs to build the objects (e.g. rawTraceEventPayload::ToolCallStarted from the tool dispatch). I think it would be better to provide helpers to the producer such that they don't get too polluted and they don't have to know about the details of the struct
We could imagine something like this:
let tool_trace = ToolTraceContext::enabled(
trace_writer.clone(),
thread_id,
codex_turn_id,
);
let attempt = tool_trace.start(ToolTraceStart {
tool_call_id,
caller: ToolCaller::CodeCell { runtime_cell_id },
model_call_id,
dispatch: &dispatch_request,
});
attempt.record_runtime_started(&protocol_begin_event);
attempt.record_runtime_ended(status, &protocol_end_event);
attempt.record_completed(status, &tool_result);
f1f33a0 to
098ccc9
Compare
jif-oai
left a comment
There was a problem hiding this comment.
Let's consider it as a basis and move on. Can you just add a README explaining we won't collect users data? We are OSS and we will get some pings otherwise
098ccc9 to
15310f1
Compare
|
The README already says it is opt in but I made it even more clearer that nothing leaves the machine and that has to be explicitly enabled to do anything. |
Summary
Adds the standalone
codex-rollout-tracecrate, which defines the raw trace event format, replay/reduction model, writer, and reducer logic for reconstructing model-visible conversation/runtime state from recorded rollout data.The crate-level design is documented in
codex-rs/rollout-trace/README.md.Stack
This is PR 1/5 in the rollout trace stack.
Review Notes
This PR intentionally does not wire tracing into live Codex execution. It establishes the data model and reducer contract first, with crate-local tests covering conversation reconstruction, compaction boundaries, tool/session edges, and code-cell lifecycle reduction. Later PRs emit into this model.
The README is the best entry point for reviewing the intended trace format and reduction semantics before diving into the reducer modules.