Repository navigation
Fix side-chat interactions and mobile viewport layout - #2870
Conversation
|
🚨 SLOP COP 🚨 · I am the Slop Cop. I am now reviewing this pull request for security, code quality, performance, architecture, and user behavior. |
| () => | ||
| queuedMessages.length > 0 ? ( | ||
| <QueuedMessagesList | ||
| attachedToComposer={!hasPendingInteraction} |
There was a problem hiding this comment.
🚨 slopcop/review — Keep queued messages attached for plugin-owned interactions
hasPendingInteraction also includes plugin-owned interactions. Those interactions do not create pendingInteractionBanner, and the existing test confirms that their composer remains visible. A plugin interaction with queued messages will therefore render a standalone rounded queue card above a visible composer. Please derive this value from the composer-blocking condition instead: the active interaction must exist and its payload kind must not be plugin. Please add a plugin-interaction-plus-queue test.
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
Plain-English summary
This pull request keeps queued messages visible when a side chat asks for input. It also keeps mobile drawers inside the visible screen when the software keyboard reduces the viewport.
Finding
I found one P2 UI regression. Plugin-owned interactions keep the composer visible, but attachedToComposer={!hasPendingInteraction} styles the queue as a separate card. This creates the wrong queue shape above the still-visible composer. Use a condition that excludes plugin-owned interactions, and add a test for a plugin interaction with queued messages. I left the exact line comment below.
Other review areas
- Security: I found no new trust boundary, permission bypass, unsafe data sink, or script path.
- Performance: The viewport work stays limited to one animation frame and removes all listeners and body styles during cleanup.
- Architecture: I found no material duplicate implementation. A shared queue-placement helper could reduce minor class duplication, but this pull request does not need that refactor.
Verification
- 84 focused app tests passed across the viewport hook, compact shelf, queue list, and embedded chat.
- The
@bb/apptype check passed. git diff --checkpassed.- A doobie mobile smoke test opened the real dev app at 390 by 844 pixels. The compact right-panel drawer portaled to
document.bodyand matched the 844-pixel visual viewport. - The full app suite passed 3,705 tests. One unrelated test failed because the local
plugins/theme-preview/package.jsonfile was absent. - The headless browser cannot display an operating-system keyboard. The focused visual-viewport test covers the reduced-height state.
I am leaving a comment review, as required. Please fix the plugin-interaction queue styling before merge.
|
🚨 SLOP COP 🚨 · I am the SlopCop. I started a security, code quality, architecture, performance, and product review. |
| const hasComposerBlockingPendingInteraction = | ||
| activePendingInteraction !== null && | ||
| activePendingInteraction.payload.kind !== "plugin"; | ||
| const pendingInteractionsInitialLoading = |
There was a problem hiding this comment.
🚨 slopcop/review — This guard trusts old interaction data during a required refresh.
React Query keeps cached data while isFetching is true. useThreadPendingInteractions forces a refresh when the first observer mounts.
With cached [], data !== undefined, so this code leaves the composer ready before the refresh ends. A question can arrive while the side chat has no observer. The user can then submit before the refresh exposes that question. An error with a cached plugin interaction has the same result.
Block the composer when a nonblocking cached result has a refresh or error state. Add tests for cached [] plus isFetching, and cached plugin data plus isError.
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
Plain English summary: This PR keeps the side-chat queue visible during a question. It also keeps mobile drawers above the keyboard.
I found one issue. The side-chat guard trusts cached interaction data during the required refresh after the chat regains an observer.
Cached empty data leaves the composer ready while the refresh runs. A new question can exist on the server during this interval.
A refresh error with cached plugin data has the same result. The user can submit before the app shows the current interaction.
Please block nonblocking cached states during a refresh or error. Add the two cache-state tests in the inline comment.
The focused checks passed:
- 92 app and client-core tests passed.
- Both package type checks passed.
- All current pull request checks passed.
- The desktop test showed the queue and question together, with no visible composer.
- The mobile test gave the body-portaled shelf a 500-pixel visual viewport. The shelf had an exact 500-pixel height.
- The security and performance reviews found no other actionable issue.
The main thread view has similar query-state logic. A shared state resolver can prevent future differences between these paths.
## Human comments ## What was wrong PR #2870 kept side-chat questions and queued messages visible together, but its pending-interaction policy covered only sending: queued-message editing and deletion remained available while a provider waited for an answer. Side-chat tabs also remount, and the interaction query could reuse cached empty data while its required refresh was still discovering a new question, briefly exposing the composer before the answer controls appeared. ## What changed - Hide both the side-chat composer and queued-message stack while a normal provider question, interaction refresh, or interaction-load error owns the composer. Held messages return unchanged after the question is answered. - Keep plugin-owned interactions unchanged; they continue to show both the composer and queue. - Share one pending-interaction freshness rule between regular threads and side chats so cached empty data remains unknown while its refresh is in flight. - Add regressions for provider questions, plugin-owned interactions, initially unknown state, and cached-empty refreshes with queued messages. - This is UI-only: there are no host-daemon wire, CLI, guide, or documentation changes, so `HOST_DAEMON_PROTOCOL_VERSION` is unchanged. ## How you verified - `pnpm exec turbo run test --filter=@bb/app -- --run src/components/thread/embedded-chat/EmbeddedThreadChat.test.tsx src/hooks/queries/thread-queries.test.tsx` — 39 tests passed. - `pnpm exec turbo run typecheck --filter=@bb/app` — passed. - `pnpm exec turbo run build --filter=@bb/app` — passed with existing build warnings. - `pnpm exec turbo run lint --filter=@bb/app` — passed with 176 existing warnings and 0 errors. - Real Claude Code browser QA passed at 1280×720 and 390×844 coarse-pointer/no-hover viewports: the question remained usable while the held queue and composer were absent. - Delaying both interaction requests by eight seconds showed only the checking state until the real question appeared; neither the queue nor composer flashed. - The final rebase preserved stable patch ID `1e29d4c56a82d1935cdbaa356b2d40a85d9a48d9`, and `git diff --check` passed. Fixes #2869 > AGENT GENERATED
Human comments
What was wrong
The side-chat footer chose between the pending-interaction banner and the entire
FollowUpPromptBox, so showing a question or approval also removed the queue stack that lived inside the prompt box. After rendering both surfaces, the queue card's composer-attached-mb-5treatment caused a second bug: it overlapped and clipped the pending-interaction card because no composer sat beneath it. This is the root cause of #2869.Mobile side-chat sizing had a separate portal boundary bug. The visual-viewport hook published
--bb-shell-heighton the nested sidebar provider, butCompactSecondaryPanelShelfportals the compact side-chat drawer todocument.body. The drawer therefore kept the full layout-viewport height while the keyboard reduced the visible viewport, leaving its prompt box below the screen.Side chats also bypassed the main follow-up submission guard.
buildSideChatSubmitModehardcoded both pending-interaction inputs tofalse, whileEmbeddedThreadChattreated an unresolved or failed interactions query as an empty list. A composer could therefore appear usable before bb knew whether the child thread was waiting for input; a submission made during that window was held by the server even though the pending interaction and queue were not visible.What changed
FollowUpPromptBox, pass the pending interaction into its dedicated slot, and keep its queued-message stack mounted while the composer is hidden.attachedToComposercontract toQueuedMessagesList; side-chat queues use standalone card spacing during an interaction, while normal side-chat and main-thread queues retain the attached composer cap.buildSideChatSubmitMode, matching the main follow-up submission guard.document.body, the common style ancestor for both the app shell and body-portaled compact drawers.HOST_DAEMON_PROTOCOL_VERSIONis unchanged.How you verified
pnpm exec turbo run test --filter=@bb/client-core -- --run test/threadDetailPromptSubmission.test.ts— 17 tests passed.pnpm exec turbo run test --filter=@bb/app -- --run src/components/thread/embedded-chat/EmbeddedThreadChat.test.tsx— 15 tests passed.pnpm exec turbo run test --force --filter=@bb/app -- --run src/components/promptbox/banner/QueuedMessagesList.test.tsx src/components/thread/embedded-chat/EmbeddedThreadChat.test.tsx— 56 tests passed before the latest focused additions.pnpm exec turbo run test --force --filter=@bb/app -- --run src/components/layout/useMobileVisualViewportHeight.test.tsx src/components/secondary-panel/CompactSecondaryPanelShelf.test.tsx src/components/layout/AppLayout.root-compose-project.test.tsx src/components/layout/AppLayout.sidebar-resize.test.tsx— 32 tests passed.pnpm exec turbo run typecheck --filter=@bb/client-core --filter=@bb/app— passed.pnpm exec turbo run lint --filter=@bb/client-core --filter=@bb/app— passed with 0 errors and the existing warnings.pnpm exec turbo run build --filter=@bb/app— passed with existing Vite/chunk warnings.git diff --checkand Prettier checks — passed.user_questionat the server boundary while testing the fixed client policy.Fixes #2869