Skip to content

[rollout_trace] Add rollout trace crate#18876

Merged
cassirer-openai merged 1 commit intomainfrom
codex/rollout-trace-crate
Apr 21, 2026
Merged

[rollout_trace] Add rollout trace crate#18876
cassirer-openai merged 1 commit intomainfrom
codex/rollout-trace-crate

Conversation

@cassirer-openai
Copy link
Copy Markdown
Contributor

@cassirer-openai cassirer-openai commented Apr 21, 2026

Summary

Adds the standalone codex-rollout-trace crate, 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.

  • #18876: Add rollout trace crate
  • #18877: Record core session rollout traces
  • #18878: Trace tool and code-mode boundaries
  • #18879: Trace sessions and multi-agent edges
  • #18880: Add debug trace reduction command

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.

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread codex-rs/rollout-trace/src/reducer/mod.rs
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

@cassirer-openai cassirer-openai force-pushed the codex/rollout-trace-crate branch from f1f33a0 to 098ccc9 Compare April 21, 2026 21:25
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@cassirer-openai cassirer-openai force-pushed the codex/rollout-trace-crate branch from 098ccc9 to 15310f1 Compare April 21, 2026 21:34
@cassirer-openai
Copy link
Copy Markdown
Contributor Author

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.

@cassirer-openai cassirer-openai enabled auto-merge (squash) April 21, 2026 21:42
@cassirer-openai cassirer-openai merged commit 27d9673 into main Apr 21, 2026
28 checks passed
@cassirer-openai cassirer-openai deleted the codex/rollout-trace-crate branch April 21, 2026 21:54
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants