Skip to content

Move rollout trace recording to a background worker - #61253

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/32fd787bb1d281f1814df2f08c73b667628f8add
Nov 13, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/32fd787bb1d281f1814df2f08c73b667628f8add

Conversation

@copyberry

@copyberry copyberry Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Move rollout trace recording to a background worker

Why

Recording inference starts synchronously serializes prompts and writes trace payloads before model work can proceed. Defer that work so inference dispatch can continue while the trace is recorded.

What changed

  • Use one worker per trace bundle to write events in submission order, with up to eight pending jobs.
  • Share prepared prompts and encoded requests with the worker, and build remote compaction snapshots there. Write payloads before publishing events that reference them.
  • Add TraceWriter::flush and ThreadTraceContext::flush for live reads. Drain accepted jobs and seal the bundle on shutdown; suppress the closing marker after a recording failure.

Testing

Add tests for deferred prompt serialization, ordered start and completion events, shutdown draining, and serialization failures that preserve earlier evidence without publishing a closing marker. Verify compaction snapshots are built on the worker and skipped when tracing is disabled.

## Why

Recording inference starts synchronously serializes prompts and writes trace payloads before model work can proceed. Defer that work so inference dispatch can continue while the trace is recorded.

## What changed

- Use one worker per trace bundle to write events in submission order, with up to eight pending jobs.
- Share prepared prompts and encoded requests with the worker, and build remote compaction snapshots there. Write payloads before publishing events that reference them.
- Add `TraceWriter::flush` and `ThreadTraceContext::flush` for live reads. Drain accepted jobs and seal the bundle on shutdown; suppress the closing marker after a recording failure.

## Testing

Add tests for deferred prompt serialization, ordered start and completion events, shutdown draining, and serialization failures that preserve earlier evidence without publishing a closing marker. Verify compaction snapshots are built on the worker and skipped when tracing is disabled.

GitOrigin-RevId: 32fd787bb1d281f1814df2f08c73b667628f8add
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor
Codex Review Summary: 🔄 Running

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-11-13T04:36:28.215039Z d043dfb PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/32fd787bb1d281f1814df2f08c73b667628f8add branch from d043dfb to b8dde1e Compare November 13, 2026 04:36
@copyberry
copyberry Bot merged commit b8dde1e into main Nov 13, 2026
12 of 24 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/32fd787bb1d281f1814df2f08c73b667628f8add branch November 13, 2026 04:36
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 13, 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.

1 participant