Skip to content

[rollout_trace] Record core session rollout traces#18877

Merged
cassirer-openai merged 6 commits intomainfrom
codex/rollout-trace-core-recorder
Apr 22, 2026
Merged

[rollout_trace] Record core session rollout traces#18877
cassirer-openai merged 6 commits intomainfrom
codex/rollout-trace-core-recorder

Conversation

@cassirer-openai
Copy link
Copy Markdown
Contributor

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

Summary

Wires rollout trace recording into codex-core session and turn execution. This records the core model request/response, compaction, and session lifecycle boundaries needed for replay without yet tracing every nested runtime/tool boundary.

Stack

This is PR 2/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 layer is the first live integration point. The important review question is whether trace recording is isolated from normal session behavior: trace failures should not become user-visible execution failures, and recording should preserve the existing turn/session lifecycle semantics.

The PR depends on the reducer/data model from the first stack entry and only introduces the core recorder surface that later PRs use for richer runtime and relationship events.

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

let event = Event {
id: sub_id,
msg: EventMsg::ShutdownComplete,
};
sess.send_event_raw(event).await;

P1 Badge Record thread shutdown in rollout trace

Session shutdown sends ShutdownComplete but never calls rollout_trace.record_thread_ended(...). As a result, traces never emit ThreadEnded/RolloutEnded, leaving rollout status stuck in running and dropping the session lifecycle boundary this change is meant to capture.

ℹ️ 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/core/src/session/turn.rs Outdated
Comment thread codex-rs/core/src/thread_manager.rs Outdated
Comment thread codex-rs/core/src/compact_remote.rs Outdated
@cassirer-openai cassirer-openai force-pushed the codex/rollout-trace-core-recorder branch from 3844251 to 582bf74 Compare April 21, 2026 21:25
@cassirer-openai cassirer-openai force-pushed the codex/rollout-trace-crate branch from f1f33a0 to 098ccc9 Compare April 21, 2026 21:25
@cassirer-openai
Copy link
Copy Markdown
Contributor Author

[codex] The review note about emitting ThreadEnded / RolloutEnded is handled in the later session/multi-agent layer of the stack (#18879), which adds record_thread_ended on shutdown and restores the lifecycle tests. PR #18877 is now scoped to core recorder plumbing and leaves rollout status running at that layer intentionally.

@cassirer-openai cassirer-openai force-pushed the codex/rollout-trace-crate branch from 098ccc9 to 15310f1 Compare April 21, 2026 21:34
Comment thread codex-rs/core/src/rollout_trace.rs Outdated
Comment thread codex-rs/core/src/rollout_trace.rs Outdated
Comment thread codex-rs/core/src/session/session.rs Outdated
Comment thread codex-rs/core/src/session/turn.rs Outdated
Comment thread codex-rs/core/src/session/turn.rs Outdated
cassirer-openai added a commit that referenced this pull request 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`](https://github.com/openai/codex/blob/codex/rollout-trace-crate/codex-rs/rollout-trace/README.md).

## Stack

This is PR 1/5 in the rollout trace stack.

- [#18876](#18876): Add rollout
trace crate
- [#18877](#18877): Record core
session rollout traces
- [#18878](#18878): Trace tool and
code-mode boundaries
- [#18879](#18879): Trace sessions
and multi-agent edges
- [#18880](#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.
Base automatically changed from codex/rollout-trace-crate to main April 21, 2026 21:54
@cassirer-openai cassirer-openai force-pushed the codex/rollout-trace-core-recorder branch from 582bf74 to 899bb99 Compare April 21, 2026 22:40
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.

Ok after my comments

Comment thread codex-rs/core/src/session/session.rs
Comment thread codex-rs/core/src/client.rs Outdated
Comment thread codex-rs/core/src/client.rs Outdated
Comment thread codex-rs/rollout-trace/src/compaction.rs
@cassirer-openai cassirer-openai enabled auto-merge (squash) April 22, 2026 16:38
@cassirer-openai cassirer-openai merged commit f67383b into main Apr 22, 2026
28 checks passed
@cassirer-openai cassirer-openai deleted the codex/rollout-trace-core-recorder branch April 22, 2026 17:00
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 22, 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