Skip to content

[codex] Move pending input into input queue#22728

Merged
pakrym-oai merged 5 commits into
mainfrom
pakrym/input-queue-pending-input
May 18, 2026
Merged

[codex] Move pending input into input queue#22728
pakrym-oai merged 5 commits into
mainfrom
pakrym/input-queue-pending-input

Conversation

@pakrym-oai
Copy link
Copy Markdown
Collaborator

@pakrym-oai pakrym-oai commented May 15, 2026

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

  • Added session/input_queue.rs to own pending input queues and mailbox delivery coordination.
  • Removed the standalone agent/mailbox.rs channel wrapper and store mailbox items directly in the input queue.
  • Moved pending-input mutations off TurnState; TurnState now exposes the queue-owned storage directly for now.
  • Routed abort cleanup, mailbox delivery phase changes, next-turn queued items, and active-turn pending input through InputQueue.
  • Boxed stack-heavy agent resume/fork startup futures that the refactor pushed over the default test stack.
  • Updated session, task, goal, stream-event, and multi-agent call sites and tests to use the new queue ownership.

Verification

  • cargo test -p codex-core --lib agent::control::tests
  • cargo test -p codex-core --lib agent::control::tests::resume_closed_child_reopens_open_descendants -- --exact
  • cargo test -p codex-core --lib agent::control::tests::spawn_agent_fork_last_n_turns_keeps_only_recent_turns -- --exact
  • cargo test -p codex-core --lib agent::control::tests::resume_thread_subagent_restores_stored_nickname_and_role -- --exact
  • cargo test -p codex-core was also run; it completed with 1814 passed, 4 ignored, and one timeout in agent::control::tests::resume_thread_subagent_restores_stored_nickname_and_role, which passed when rerun in isolation.

@pakrym-oai pakrym-oai marked this pull request as ready for review May 18, 2026 17:42
@pakrym-oai pakrym-oai requested a review from a team as a code owner May 18, 2026 17:42
@pakrym-oai pakrym-oai merged commit afa0101 into main May 18, 2026
31 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/input-queue-pending-input branch May 18, 2026 22:43
@github-actions github-actions Bot locked and limited conversation to collaborators May 18, 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