Skip to content

fix(chatbot): 会话锁定后 CLI 选择器改为只读可见,不再消失 (#1118) - #1126

Open
wcy12378 wants to merge 2 commits into
Tencent:mainfrom
wcy12378:codex/pi-cli-visibility
Open

wcy12378 wants to merge 2 commits into
Tencent:mainfrom
wcy12378:codex/pi-cli-visibility

Conversation

@wcy12378

@wcy12378 wcy12378 commented Nov 20, 2026 •

Copy link
Copy Markdown

What changed

Issue #1118: after the first reply, the composer's CLI picker was removed entirely, so a running conversation gave no visible indication of which runtime it was bound to. This keeps the picker rendered but disabled, showing the bound runtime with a tooltip that switching requires a new conversation.

  • chatbot/src/App.jsx: render the CLI picker whenever more than one executor exists. When the conversation is pinned to an executor, disable it and set the tooltip; the model, effort and approval pickers are untouched, and the session stays locked to the same executor.
  • chatbot/src/PermissionPicker.jsx: add disabled / title support so a locked picker keeps its current value visible but never opens its menu. The disabled state is applied uniformly via an effectiveOpen value: the menu's aria-hidden/inert, the focus and outside-click effect dependencies, and keyboard handling all check it; choose refuses while disabled; and a picker disabled while open notifies the parent to close it, so re-enabling cannot reopen a menu the user did not ask for.
  • chatbot/src/styles.css: style the disabled selector as non-interactive (muted color, not-allowed cursor, no hover change).
  • chatbot/tests/app-render.test.jsx: update the locked-state assertion from "button removed" to "button present and disabled", and add a regression test that a locked picker cannot open its menu.
  • chatbot/tests/permission-disabled.test.jsx: regression suite for the open -> disabled transition (menu hidden/inert, parent closed, no choice from a focused closing menu, trigger cannot open).

Scope / not changed

Verification

  • chatbot vitest suite: 57 files / 409 tests passed, 0 failed. The devserver-cookie, composer-operations and element-picker tests read internal/** sources; after adding the internal sparse-checkout directory to this worktree, all three pass (the earlier failures were sparse-checkout gaps, not repo baseline failures).
  • chatbot vite build: passes.
  • Real-browser check (Playwright/Edge, headless) at 1440/390 × light/dark with a mocked session bound to Pi: the CLI picker is present, disabled, carries the tooltip, shows Pi, the header badge shows Pi, and no console errors. Script: loopforge-team/pi/loopforge-1118-qa.mjs; screenshots in loopforge-ui-evidence/cli-visibility-*.png.

…locks its runtime

After the first reply, the composer's CLI picker was removed entirely, so a
running conversation gave no visible indication of which runtime it was bound
to. Keep the picker rendered, disable it, and show the bound runtime with a
tooltip explaining that switching requires a new conversation.

- App.jsx: render the CLI picker whenever more than one executor exists; when
  the conversation is pinned to an executor, disable it and set the tooltip,
  leaving the model, effort and approval pickers untouched.
- PermissionPicker: add disabled/title support so a locked picker keeps its
  current value but never opens its menu.
- styles.css: style the disabled selector as non-interactive.
- app-render.test.jsx: assert the locked picker is present and disabled, and
  add a regression test that a locked picker cannot open its menu.
Review of Tencent#1126 found two P2 gaps in the disabled-state handling:

- The menu's aria-hidden/inert still read the raw `open` prop, so a picker
  disabled while open left its closing menu (mounted during the close
  animation) accessible, and `choose` had no disabled guard, so a focused
  option could still fire onSelect via Enter.
- The focus and outside-click effects keyed on `open` in their dependency
  arrays, so a disabled toggle did not clean up a queued focus RAF or the
  outside listeners.

Unify on `effectiveOpen`: menu aria-hidden/inert, effect dependencies, and
keyboard handling all check it; `choose` refuses while disabled; and a
disabled picker that is still open notifies the parent to close it so
re-enabling cannot reopen a menu the user did not ask for. Add a regression
suite covering the open -> disabled transition.

Also add the `internal` sparse-checkout directory so the chatbot suite's
devserver-cookie/composer-operations/element-picker tests (which read
internal/** sources) run; the full suite now passes 57 files / 409 tests.
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.

1 participant