Skip to content

Conversation

@charley-oai
Copy link
Collaborator

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

Summary

This PR fixes a UI/streaming race when nudged or steer-enabled messages are queued during an active Plan stream.

Previously, submit_user_message_with_mode switched collaboration mode immediately (via set_collaboration_mask) even when the message was
queued. If that happened mid-Plan stream, active_mode_kind could flip away from Plan before the turn finished, causing subsequent
on_plan_delta updates to be ignored in the UI.

Now, mode switching is deferred until the queued message is actually submitted.

What changed

  • Added a per-message deferred mode override on UserMessage:
    • collaboration_mode_override: Option<CollaborationModeMask>
  • Updated submit_user_message_with_mode to:
    • create a UserMessage carrying the mode override
    • queue or submit that message without mutating global mode immediately
  • Updated submit_user_message to:
    • apply collaboration_mode_override just before constructing/sending Op::UserTurn
  • Kept queueing condition scoped to active Plan stream rendering:
    • queue only while plan output is actively streaming in TUI (plan_stream_controller.is_some())

Why

This preserves Plan mode for the remainder of the in-flight Plan turn, so streamed plan deltas continue rendering correctly, while still
ensuring the follow-up queued message is sent with the intended collaboration mode.

Behavior after this change

  • If a nudged/steer submission happens while Plan output is actively streaming:
    • message is queued
    • UI stays in Plan mode for the running turn
    • once dequeued/submitted, mode override is applied and the message is sent in the intended mode
  • If no Plan stream is active:
    • submission proceeds immediately and mode override is applied as before

Tests

Added/updated coverage in tui/src/chatwidget/tests.rs:

  • submit_user_message_with_mode_queues_while_plan_stream_is_active
    • asserts mode remains Plan while queued
    • asserts mode switches to Code when queued message is actually submitted
  • submit_user_message_with_mode_submits_when_plan_stream_is_not_active
  • steer_enter_queues_while_plan_stream_is_active
  • steer_enter_submits_when_plan_stream_is_not_active

Also updated existing UserMessage { ... } test fixtures to include the new field.

Codex author

codex fork 019c1047-d5d5-7c92-a357-6009604dc7e8

@charley-oai charley-oai force-pushed the queue-nudges-while-plan-generating branch from 5d8d18d to 7aa0b30 Compare February 3, 2026 03:01
@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: 7aa0b30a8f

ℹ️ 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: 699e77455c

ℹ️ 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 force-pushed the queue-nudges-while-plan-generating branch from 699e774 to 953cd45 Compare February 3, 2026 05:02
@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: 953cd450a2

ℹ️ 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: b530c9285c

ℹ️ 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: 804dd148b9

ℹ️ 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".

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@charley-oai charley-oai force-pushed the queue-nudges-while-plan-generating branch from 7da38d7 to 3c29c56 Compare February 6, 2026 03:08
@charley-oai
Copy link
Collaborator Author

@codex review this

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Breezy!

ℹ️ 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 merged commit b7ecd16 into main Feb 6, 2026
29 of 32 checks passed
@charley-oai charley-oai deleted the queue-nudges-while-plan-generating branch February 6, 2026 17:43
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 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