Skip to content

exec: avoid loading the full legacy rollout when recovering completed turn items #36688

Description

@MikeeI

What variant of Codex are you using?

CLI (codex exec)

What feature would you like to see?

I found a potential performance concern in current source rather than a confirmed user-visible bug. After a non-ephemeral codex exec turn completes, in-process delivery may have dropped non-terminal item notifications under backpressure. To recover final items, exec sends thread/read with include_turns: true and then selects only the matching completed turn. For legacy threads, this path loads every rollout item and constructs all turns before returning that one turn's items.

Please consider a completion-recovery read that returns only the matched turn's completed items without loading the full legacy rollout or materializing all legacy turns. It should preserve the active exec thread/turn filter, the non-ephemeral and TurnItemsView eligibility gates, paginated-thread behavior, the current backpressure fallback, best-effort warning behavior, final output, item order, and completion ordering. I am not assuming that a targeted legacy index already exists; the implementation could add one or another history-store-supported targeted read.

Additional information

Evidence

Impact

Not measured. No latency, allocation, or I/O-volume measurement was taken. The fallback performs work proportional to the complete legacy rollout before selecting one completed turn. User-visible cost, occurrence, and frequency remain unknown.

Question

Would maintainers like completion recovery to avoid materializing the full legacy rollout while preserving the current backpressure fallback semantics?

I checked all relevant issues, comments, pull requests, discussions, and release notes; this report is not a duplicate.

I am reporting this finding only and am not proposing a pull request unless a maintainer invites one.

Disclosure

Investigated thoroughly with GPT-5.6 (high reasoning effort), using Oh My Pi as the agent framework.

This report is not generic or unreviewed AI-generated output. Its claims were checked against the cited evidence, and it includes the relevant detail intended to help maintainers resolve the issue.

If reports like this are not useful to the project, please let me know and I will refrain from submitting similar ones. My intent is to help without wasting maintainer time or energy or discouraging their work.

Thank you for your work.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIapp-serverIssues involving app server protocol or interfacesenhancementNew feature or requestexecIssues related to the `codex exec` subcommandperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions