Skip to content

feat(site/src/pages/AgentsPage/components): allow disengaging plan mode from Planning badge#24651

Merged
jaaydenh merged 3 commits intomainfrom
df/plan-mode-dismiss-badge
Apr 23, 2026
Merged

feat(site/src/pages/AgentsPage/components): allow disengaging plan mode from Planning badge#24651
jaaydenh merged 3 commits intomainfrom
df/plan-mode-dismiss-badge

Conversation

@david-fraley
Copy link
Copy Markdown
Collaborator

@david-fraley david-fraley commented Apr 23, 2026

Adds an inline X button to the "Planning" indicator so users can disengage plan mode directly from the chat input, without reopening the + menu. Reuses the same pattern that already ships on the attached-workspace and MCP-server badges.

  • When onPlanModeToggle is provided and plan mode is on, the pill renders a dismiss X next to the label; clicking it calls onPlanModeToggle(false).
  • When no toggle handler is passed, no X renders (matches the other badges).
  • Extracts BadgeDismissButton inside AgentChatInput.tsx now that the dismiss pattern lives in three places, collapsing ~24 lines of duplicated markup.
  • Storybook coverage: tightened PlanningIndicator, new DisablePlanModeFromBadge (click fires onPlanModeToggle(false)), new PlanningIndicatorWithoutToggle (no handler, no X).

Demo

Demo: open + menu, enable Plan first, click X on the Planning pill to disengage

Higher-quality MP4 also available.

Implementation plan

Red / Green / Refactor

  1. Red: Extended AgentChatInput.stories.tsx to assert the X button exists in the Planning pill, clicking it fires onPlanModeToggle(false), and no X renders when onPlanModeToggle is absent. Two stories failed as expected.
  2. Green: Added an inline <button aria-label="Disable plan mode"> with XIcon to the Planning pill, gated on onPlanModeToggle, reusing the existing handlePlanModeToggle handler. All 35 stories pass.
  3. Refactor: Rule-of-three met with three duplicated dismiss-button sites (workspace, MCP, planning). Extracted BadgeDismissButton with onClick + ariaLabel props and replaced all three copies. Stories still pass.

Design notes

  • aria-label is "Disable plan mode" (mode toggle, not item removal) rather than "Remove planning" which would be misleading.
  • Planning pill stays outside the badgeContainerRef overflow container by design so it never collapses into the +N popover.
  • No changes to the Plan first menu item in the + popover or its behavior.

This PR was opened by a Coder agent on behalf of @david-fraley.

…de from Planning badge

Add an inline "X" dismiss button to the Planning pill in the agent chat
input so users can exit plan mode without reopening the "+" menu. Reuses
the same visual pattern as the workspace and MCP badge dismiss buttons.

- Extract BadgeDismissButton for the three dismiss-button sites (workspace,
  MCP, planning) now that the pattern repeats three times.
- Add stories covering the new control and the no-toggle-handler case.

Change authored by an agent on behalf of david-fraley.
… X via dedicated handler

Per reviewer feedback, decouple the badge dismiss button from the toggle
handler. The badge-pill X button is only rendered while plan mode is on,
so it should always disable, not toggle. Using handlePlanModeToggle worked
only because of the enclosing render gate; a dedicated handleDisablePlanMode
decouples the semantics from that gate.
Copy link
Copy Markdown
Collaborator Author

@david-fraley david-fraley left a comment

Choose a reason for hiding this comment

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

Deep review complete. Kicked off 7 parallel reviewers (Test Auditor, Edge Case Analyst, Contract Auditor, Frontend Reviewer, Duplication Checker, React Modernization, Style Reviewer) against this PR.

One P2 surfaced across Frontend Reviewer, Contract Auditor, and Edge Case Analyst: the badge dismiss handler was reusing handlePlanModeToggle, which only did the right thing by virtue of the render gate. Applied the fix in a898b81 before posting. One nit carried forward.

1 P2 (applied), 1 Nit across 2 inline comments. Full reviewer outputs in /tmp/deep-review/1776906843/.

Comment thread site/src/pages/AgentsPage/components/AgentChatInput.tsx
Comment thread site/src/pages/AgentsPage/components/AgentChatInput.tsx
@jaaydenh
Copy link
Copy Markdown
Contributor

@codex review

Copy link
Copy Markdown

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

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

Comment thread site/src/pages/AgentsPage/components/AgentChatInput.tsx
@jaaydenh jaaydenh marked this pull request as ready for review April 23, 2026 13:58
@jaaydenh
Copy link
Copy Markdown
Contributor

@codex review

@jaaydenh jaaydenh self-requested a review April 23, 2026 14:07
@chatgpt-codex-connector
Copy link
Copy Markdown

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

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

@jaaydenh jaaydenh merged commit 50dbb3d into main Apr 23, 2026
27 checks passed
@jaaydenh jaaydenh deleted the df/plan-mode-dismiss-badge branch April 23, 2026 14:19
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 23, 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