Skip to content

tui: align pending steers with core acceptance#12868

Merged
charley-oai merged 50 commits intomainfrom
tui-pending-nudges-message-boundary
Mar 3, 2026
Merged

tui: align pending steers with core acceptance#12868
charley-oai merged 50 commits intomainfrom
tui-pending-nudges-message-boundary

Conversation

@charley-oai
Copy link
Collaborator

@charley-oai charley-oai commented Feb 26, 2026

Summary

  • submit Enter steers immediately while a turn is already running instead of routing them through queued_user_messages
  • keep those submitted steers visible in the footer as pending_steers until core records them as a user message or aborts the turn
  • reconcile pending steers on ItemCompleted(UserMessage), not RawResponseItem
  • emit user-message item lifecycle for leftover pending input at task finish, then remove the TUI TurnComplete fallback
  • keep queued_user_messages for actual queued drafts, rendered below pending steers

Problem

While the assistant was generating, pressing Enter could send the input into queued_user_messages. That queue only drains after the turn ends, so ordinary steers behaved like queued drafts instead of landing at the next core sampling boundary.

The first version of this fix also used RawResponseItem to decide when a steer had landed. Review feedback was that this is the wrong abstraction for client behavior.

There was also a late edge case in core: if pending steer input was accepted after the final sampling decision but before TurnComplete, core would record that user message into history at task finish without emitting ItemStarted(UserMessage) / ItemCompleted(UserMessage). TUI had a fallback to paper over that gap locally.

Approach

  • Enter during an active turn now submits a normal Op::UserTurn immediately
  • TUI keeps a local pending-steer preview instead of rendering that user message into history immediately
  • when core records the steer as ItemCompleted(UserMessage), TUI matches and removes the corresponding pending preview, then renders the committed user message
  • core now emits the same user-message lifecycle when on_task_finished(...) drains leftover pending user input, before TurnComplete
  • with that lifecycle gap closed in core, TUI no longer needs to flush pending steers into history on TurnComplete
  • if the turn is interrupted, pending steers and queued drafts are both restored into the composer, with pending steers first

Notes

  • Tab still uses the real queued-message path
  • queued_user_messages and pending_steers are separate state with separate semantics
  • the pending-steer matching key is built directly from UserInput
  • this removes the new TUI dependency on RawResponseItem

Codex author

codex resume 019c9259-8b56-7b02-9528-57c81c76c67d

@charley-oai charley-oai force-pushed the tui-pending-nudges-message-boundary branch from 653dd24 to 3ee6428 Compare February 26, 2026 05:52
@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 3ee6428600

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 3c826289d6

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 12eed0f18d

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 32eec29d04

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai charley-oai changed the title tui: submit pending nudges after message boundaries tui: align pending nudges with core acceptance Feb 27, 2026
source: tui/src/chatwidget/tests.rs
expression: combined
---
• Here is the result.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • This test was specifically exercising AgentMessageDelta* followed by a duplicate legacy EventMsg::AgentMessage
  • That is not the live path we want to preserve anymore
  • Keeping it would just pin stale compatibility behavior into the PR

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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

if !from_replay && self.queued_user_messages.is_empty() {
self.maybe_prompt_plan_implementation();

P1 Badge Gate plan-implementation prompt on pending nudges

on_task_complete now decides whether to show the plan-implementation prompt using only queued_user_messages.is_empty(). After this change, Enter-during-turn submissions are moved to pending_nudges, so the queue is empty even when a follow-up was already sent. That can incorrectly pop the implementation prompt at turn end despite pending/just-submitted nudges.

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 291fea2ed3

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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

if !self.queued_user_messages.is_empty() {
return;

P2 Badge Block plan follow-up popup while nudges are pending

Plan follow-up prompting still checks only queued_user_messages. After this change, Enter-during-turn submissions are stored in pending_nudges instead, so maybe_prompt_plan_implementation can fire even though the user already submitted a nudge that has not been committed yet. This can show an incorrect "implement plan" prompt.

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 39a9c3b658

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai charley-oai changed the title tui: align pending nudges with core acceptance tui: align pending steers with core acceptance Mar 2, 2026
@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 5590cc39dc

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 3e56682ed7

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai
Copy link
Collaborator Author

@codex review this

)
.await;
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Small core bugfix to emit ItemStarted(UserMessage)/ItemCompleted(UserMessage) for leftover pending user input at task finish (so we can rely on ItemCompleted(UserMessage) for core user message acceptance in all cases.

Copy link
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: 119ca71e8f

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 2fc7bb32d8

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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

TurnAbortReason::Replaced => {
self.on_error("Turn aborted: replaced by a new task".to_owned())

P2 Badge Clear pending steers on replaced-turn abort

TurnAbortReason::Replaced routes to on_error(...) only, unlike interrupt paths that drain/restore pending input. When a task is replaced, core clears pending input, so pending_steers can no longer be matched by later ItemCompleted(UserMessage) events. They remain stuck in the footer and can suppress follow-up plan prompting.

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai
Copy link
Collaborator Author

@codex review this

Copy link
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: 3e778b4a50

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@charley-oai
Copy link
Collaborator Author

@codex review this

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

} else {
self.record_conversation_items(
turn_context.as_ref(),
std::slice::from_ref(&response_item),
Copy link
Collaborator

Choose a reason for hiding this comment

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

will be recording this twice?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm no it's just recorded once?

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah it's if/else

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't like how the code is looking but I see why. Can we leave a comment here?

@charley-oai charley-oai merged commit 299b8ac into main Mar 3, 2026
29 of 30 checks passed
@charley-oai charley-oai deleted the tui-pending-nudges-message-boundary branch March 3, 2026 23:31
@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2026
@charley-oai charley-oai restored the tui-pending-nudges-message-boundary branch March 18, 2026 04:36
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