Skip to content

fix: persist Codex review threads - #557

Open
dinhnguyenminhhoang wants to merge 1 commit into
openai:mainfrom
dinhnguyenminhhoang:fix/persist-review-threads
Open

fix: persist Codex review threads#557
dinhnguyenminhhoang wants to merge 1 commit into
openai:mainfrom
dinhnguyenminhhoang:fix/persist-review-threads

Conversation

@dinhnguyenminhhoang

@dinhnguyenminhhoang dinhnguyenminhhoang commented Jul 26, 2026

Copy link
Copy Markdown

Summary

Persist Codex threads created by both review commands so their session IDs
remain resumable after the broker restarts.

Fixes #529

Changes

  • Make native /codex:review threads non-ephemeral
  • Enable thread persistence for /codex:adversarial-review
  • Add regression assertions verifying both review paths start threads with
    ephemeral: false

Testing

  • Targeted native review persistence test passes
  • Targeted adversarial review persistence test passes
  • Full test suite was also executed on Windows
  • Existing Windows/environment-specific test failures are unrelated to this change

@dinhnguyenminhhoang
dinhnguyenminhhoang requested a review from a team July 26, 2026 03:53
@urda

urda commented Jul 26, 2026

Copy link
Copy Markdown

Thanks, this matches what I asked for in #529. Two things before merge:

  1. Please confirm a real review run now writes a rollout with token usage to ~/.codex/sessions (e.g. it shows up in ccusage codex). The tests only assert the fake fixture's flag.
  2. Optional: pass a threadName for adversarial runs like the task path does, so persisted review threads aren't unnamed in the sessions tree.

@dinhnguyenminhhoang

Copy link
Copy Markdown
Author

Thanks, this matches what I asked for in #529. Two things before merge:

  1. Please confirm a real review run now writes a rollout with token usage to ~/.codex/sessions (e.g. it shows up in ccusage codex). The tests only assert the fake fixture's flag.
  2. Optional: pass a threadName for adversarial runs like the task path does, so persisted review threads aren't unnamed in the sessions tree.

Thanks — I verified this using real Codex CLI 0.144.4 runs on this branch.

Native /codex:review:

  • Completed successfully with a persistent thread ID.
  • Wrote a non-empty rollout under ~/.codex/sessions.
  • The rollout contains review lifecycle and message events, but no
    token_count events.

/codex:adversarial-review:

  • Completed successfully with a persistent thread ID.
  • Wrote a rollout under ~/.codex/sessions.
  • The rollout contains 5 token_count events with non-zero usage
    (169597 input tokens, 940 output tokens, 170537 total tokens).

So thread persistence is working for both review paths, while local token
accounting is currently present only for the adversarial turn/start path.
The native review/start path does not appear to emit or persist
token_count events in Codex CLI 0.144.4.

Would you prefer this PR to remain scoped to thread persistence, with native
review usage accounting tracked separately, or should that be addressed
before merging?

@urda

urda commented Jul 26, 2026

Copy link
Copy Markdown

Keep it scoped to persistence, this delivers what #529 asked of the plugin. The missing token_count events on review/start look like Codex CLI behavior, not something this PR can fix. I'll track native review usage accounting separately. LGTM.

@dinhnguyenminhhoang

Copy link
Copy Markdown
Author

Keep it scoped to persistence, this delivers what #529 asked of the plugin. The missing token_count events on review/start look like Codex CLI behavior, not something this PR can fix. I'll track native review usage accounting separately. LGTM.

Thanks for confirming and for the review. I'll keep the PR scoped to thread persistence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review commands should persist their Codex threads (write rollouts) like task runs do

2 participants