Skip to content

fix(acp): dedupe duplicate Thinking selector (pi ACP modes + config) - #445

Draft
julianromli wants to merge 3 commits into
gnoviawan:devfrom
julianromli:fix/duplicate-thinking-selector
Draft

fix(acp): dedupe duplicate Thinking selector (pi ACP modes + config)#445
julianromli wants to merge 3 commits into
gnoviawan:devfrom
julianromli:fix/duplicate-thinking-selector

Conversation

@julianromli

@julianromli julianromli commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • On pi ACP, Agent Chat showed two "Thinking: …" chips: the promoted thought_level ConfigChip (brain icon) and ModeChip, because pi dual-publishes thinking as both a config option and session.modes with the same value IDs/names.
  • Prefer the promoted Thinking chip and hide ModeChip when every mode id is also a thought_level option value. Real Agent/Plan/Ask modes are unchanged.
  • Also first-wins-dedupe duplicate model / thought_level config options in the composer chip row and / slash menu so a second generic chip cannot appear.

Related Issue

Closes #444

Prior related work (not duplicates of this bug): #286 / #302 (initial thought_level promotion). Closed PR attempt earlier today was incomplete until the ModeChip root cause was identified; this reopens that branch with both commits.

Type of Change

  • fix: bug fix
  • feat: new feature
  • docs: documentation only
  • style: formatting or non-functional styling changes
  • refactor: internal cleanup with no behavior change
  • perf: performance improvement
  • test: adds or updates tests
  • build: build or dependency changes
  • ci: CI/CD workflow changes
  • chore: maintenance or tooling
  • revert: reverts a previous change

What Changed

  • modesRedundantWithThoughtLevel in chat-input-bar-config.ts — detect when session.modes is the same control as thought_level
  • ChatInputBar + AgentLauncher gate ModeChip behind showModeChip so pi ACP no longer renders a second Thinking pill
  • shouldAdvertiseConfigOption + partitionConfigOptions — first model / thought_level wins; later same-category options discarded from rest
  • buildSlashSections applies the same first-wins filter so / does not expose a second Thinking/Model section
  • Unit tests: modesRedundantWithThoughtLevel, partition/slash dedupe, AgentLauncher pi-acp regression (getAllByRole length 1 for "Thinking: off")

How It Was Tested

  • bun run ci (Biome lint + format + imports, strict mode)
  • bun run typecheck
  • bun run test (2210 passed)
  • cargo clippy --all-targets -- -D warnings (in src-tauri)
  • cargo test (in src-tauri)
  • Manual verification completed (UI-level AgentLauncher regression + modesRedundantWithThoughtLevel cases for pi dual-publish vs real agent/plan modes)
  • Not applicable (frontend-only; no Rust changes)

Screenshots or Recordings

Before: two "Thinking: off" chips in the composer toolbar (one with brain icon, one without) when pi ACP is selected.
After: a single promoted Thinking chip; ModeChip suppressed only when modes are redundant with thought_level.

CI & Review Gate

  • All CI checks pass (PR Validation, Rust Checks, Build Verification, Security Scans)
  • Code review comments from CodeRabbit / Claude have been addressed or resolved
  • No unresolved review findings remain

Checklist

  • My PR title follows the conventional commit format used by this repo
  • I linked the related issue or explained why none exists
  • I updated docs when needed (N/A — no doc changes required)
  • I added or updated tests when needed
  • I verified the change does not introduce unrelated modifications
  • I read AGENTS.md and followed the contributor guidelines
  • A human reviewed the complete diff before submission

Test plan

  • Connect pi ACP and confirm only one Thinking chip in empty-state (AgentLauncher) and in-session (ChatInputBar) composers
  • Confirm ModeChip still appears for agents that advertise real Agent/Plan/Ask modes alongside thought_level
  • Confirm model picker still works when only one model option is advertised
  • Open / and confirm a single Thinking Level / Model section when duplicate config options are present
  • Confirm custom/non-singleton config chips still appear
  • Confirm existing mode-config dedupe (filterDuplicateModeConfigOptions) is unchanged for true mode options

Agents that advertise multiple model/thought_level options were showing
a promoted chip plus a generic duplicate. Keep first-wins for those
categories in the composer and slash menu.

Closes gnoviawan#444

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 26e8ef6d-4e18-40e9-b989-0ac58d5fbf1c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds shared first-wins filtering for duplicate model and thought_level configuration options, applying it to input-bar partitioning and slash-menu section generation while preserving uncategorized options.

Changes

Promoted singleton config options

Layer / File(s) Summary
Singleton gating and partitioning
src/renderer/components/chat/chat-input-bar-config.ts, src/renderer/components/chat/chat-input-bar-config.test.ts
Defines promoted singleton categories, adds shouldAdvertiseConfigOption, discards later model and thought_level options, and retains generic options in rest with accompanying tests.
Slash-menu filtering
src/renderer/components/chat/slash-menu-model.ts, src/renderer/components/chat/slash-menu-model.test.ts
Applies the shared first-wins filter when building slash-menu sections and verifies duplicate promoted categories are excluded while other categories remain.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • gnoviawan/termul#302: Updates the same chat configuration and slash-menu areas with promoted-singleton filtering.

Suggested reviewers: gnoviawan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement the shared first-wins helper and apply it to both partitionConfigOptions and buildSlashSections, with tests.
Out of Scope Changes check ✅ Passed No unrelated code changes are evident; the edits stay within duplicate thought_level/model chip deduplication and tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: deduping duplicate Thinking/config selectors, with a concise and specific summary.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@julianromli
julianromli marked this pull request as draft July 23, 2026 06:09
pi-acp publishes thinking both as a thought_level config option and as
session.modes named "Thinking: …". Prefer the promoted Thinking chip and
suppress the redundant ModeChip when every mode id is a thought_level value.

Co-authored-by: Cursor <cursoragent@cursor.com>
@julianromli

Copy link
Copy Markdown
Contributor Author

Follow-up: real pi-acp root cause

The first commit only deduped multiple thought_level config options. pi-acp still looked duplicated because it dual-publishes thinking as:

  1. configOptions with category: "thought_level" → promoted Thinking chip (brain)
  2. session.modes with names like Thinking: offModeChip

Pushed a second commit that hides ModeChip when every mode id is also a thought_level option value (AgentLauncher + ChatInputBar). Real agent/plan/ask modes are unchanged.

Please hard-refresh / let Vite HMR reload and re-check pi ACP.

@julianromli julianromli reopened this Jul 23, 2026
@julianromli julianromli changed the title fix(acp): dedupe duplicate Thinking/model config chips fix(acp): dedupe duplicate Thinking selector (pi ACP modes + config) Jul 23, 2026
Keep Thinking chip and modes in sync after ModeChip hide so launcher
xhigh does not snap back to off in the running ChatInputBar.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(acp): duplicate Thinking selector when agent advertises multiple thought_level options

2 participants