[codex] Move pending input into input queue#22728
Merged
Merged
Conversation
…nding-input # Conflicts: # codex-rs/core/src/tasks/mod.rs
sayan-oai
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Pending model input was split across
Session,TurnState, and the agent mailbox. That made it easy for new paths to manage queued user input or mailbox delivery outside the intended ownership boundary.This PR consolidates the model-facing input lifecycle behind the session input queue so turn-local pending input, next-turn queued items, and mailbox delivery coordination are owned in one place.
What Changed
session/input_queue.rsto own pending input queues and mailbox delivery coordination.agent/mailbox.rschannel wrapper and store mailbox items directly in the input queue.TurnState;TurnStatenow exposes the queue-owned storage directly for now.InputQueue.Verification
cargo test -p codex-core --lib agent::control::testscargo test -p codex-core --lib agent::control::tests::resume_closed_child_reopens_open_descendants -- --exactcargo test -p codex-core --lib agent::control::tests::spawn_agent_fork_last_n_turns_keeps_only_recent_turns -- --exactcargo test -p codex-core --lib agent::control::tests::resume_thread_subagent_restores_stored_nickname_and_role -- --exactcargo test -p codex-corewas also run; it completed with 1814 passed, 4 ignored, and one timeout inagent::control::tests::resume_thread_subagent_restores_stored_nickname_and_role, which passed when rerun in isolation.