Skip to content

Conversation

@charley-oai
Copy link
Collaborator

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

Summary

This fixes a UX bug (#10442) where the "Implement this plan?" prompt could reappear after switching agents with /agent and then switching back to the original agent during plan execution.

Root Cause

On thread switch, the TUI rebuilds ChatWidget, replays buffered thread events, then drains any queued live events.

In this flow, a TurnComplete can be handled twice for the same logical turn:

  1. replayed (from_replay = true)
  2. then live (from_replay = false)

ChatWidget used saw_plan_item_this_turn to decide whether to show the plan implementation prompt, but that flag was only reset on TurnStarted.
If duplicate completion events occurred, stale saw_plan_item_this_turn = true could cause the prompt to re-trigger unexpectedly.

Fix

  • Clear saw_plan_item_this_turn at the end of on_task_complete, after prompt gating runs.
  • This keeps the flag truly turn-scoped and prevents duplicate TurnComplete handling from reopening the prompt.

@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: e241a04023

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

@charley-oai charley-oai enabled auto-merge (squash) February 3, 2026 01:38
@charley-oai charley-oai disabled auto-merge February 3, 2026 01:38
@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ 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 1096d64 into main Feb 3, 2026
28 of 31 checks passed
@charley-oai charley-oai deleted the fix-plan-subagents-bug branch February 3, 2026 01:40
@github-actions github-actions bot locked and limited conversation to collaborators Feb 3, 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