Skip to content

[codex] Preserve steer input as user input#23405

Merged
pakrym-oai merged 8 commits into
mainfrom
pakrym/turn-input-user-messages
May 19, 2026
Merged

[codex] Preserve steer input as user input#23405
pakrym-oai merged 8 commits into
mainfrom
pakrym/turn-input-user-messages

Conversation

@pakrym-oai
Copy link
Copy Markdown
Collaborator

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

Why

Steered input was queued as a ResponseInputItem, then parsed back into a user message before recording. That path loses information that only exists on UserInput, such as UI text elements.

This change keeps turn-local pending input typed as either original UserInput or existing response items, so steered user input reaches user-message recording without being reconstructed from a response item.

What changed

  • Add TurnInput for active-turn pending input.
  • Queue Session::steer_input as TurnInput::UserInput.
  • Run pending-input hook inspection only for TurnInput::UserInput.
  • Process drained pending input item by item: accepted items are recorded, blocked items append hook context and are skipped.
  • Remove the pending-input prepend/requeue path.

Validation

  • just fmt
  • just fix -p codex-core
  • RUST_MIN_STACK=16777216 cargo test -p codex-core --lib session::tests::task_finish_emits_turn_item_lifecycle_for_leftover_pending_user_input -- --nocapture
  • RUST_MIN_STACK=16777216 cargo test -p codex-core --lib steer_input
  • RUST_MIN_STACK=16777216 cargo test -p codex-core --lib pending_input
  • RUST_MIN_STACK=16777216 cargo test -p codex-core --test all pending_input
  • RUST_MIN_STACK=16777216 cargo test -p codex-core (unit tests passed: 1835 passed, 0 failed, 4 ignored; integration all target failed due missing helper binaries such as codex/test_stdio_server plus unrelated MCP/search/code-mode expectations)

@pakrym-oai pakrym-oai force-pushed the pakrym/turn-input-user-messages branch from 9aee7c7 to 44ebf79 Compare May 19, 2026 03:33
@pakrym-oai pakrym-oai marked this pull request as ready for review May 19, 2026 03:35
@pakrym-oai pakrym-oai requested a review from a team as a code owner May 19, 2026 03:35
@pakrym-oai
Copy link
Copy Markdown
Collaborator Author

@codex review this

…r-messages

# Conflicts:
#	codex-rs/core/src/session/turn.rs
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44ebf79791

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread codex-rs/core/src/session/turn.rs
.push_pending_input_and_accept_mailbox_delivery_for_turn_state(
active_turn.turn_state.as_ref(),
input.into(),
TurnInput::UserInput(input),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Materialize steered local images before queuing

When a steered prompt contains UserInput::LocalImage, this now queues the raw path until the pending input is eventually accepted, and ResponseInputItem::from(...) reads the file later in record_user_prompt_and_emit_turn_item. If the current model turn runs for a while and the local image is edited or deleted before the steer is drained, the model receives the changed file or an error placeholder rather than the image the user submitted; the previous input.into() materialized the image bytes at steer time.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine.

Comment thread codex-rs/core/src/session/tests.rs
@pakrym-oai pakrym-oai merged commit f0663fd into main May 19, 2026
31 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/turn-input-user-messages branch May 19, 2026 16:47
@github-actions github-actions Bot locked and limited conversation to collaborators May 19, 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.

3 participants