Skip to content

Fix side-chat interactions and mobile viewport layout - #2870

Merged
ymichael merged 3 commits into
mainfrom
bb/resolve-pending-question-submission-hold-thr_eny7cz94im
Sep 2, 2026
Merged

ymichael merged 3 commits into
mainfrom
bb/resolve-pending-question-submission-hold-thr_eny7cz94im

Conversation

@ymichael

@ymichael ymichael commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

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-5 treatment 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-height on the nested sidebar provider, but CompactSecondaryPanelShelf portals the compact side-chat drawer to document.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. buildSideChatSubmitMode hardcoded both pending-interaction inputs to false, while EmbeddedThreadChat treated 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

  • Always render the side-chat FollowUpPromptBox, pass the pending interaction into its dedicated slot, and keep its queued-message stack mounted while the composer is hidden.
  • Treat queued messages as disabled while the interaction is pending.
  • Add an explicit attachedToComposer contract to QueuedMessagesList; side-chat queues use standalone card spacing during an interaction, while normal side-chat and main-thread queues retain the attached composer cap.
  • Pass real pending-interaction and initial-loading state through buildSideChatSubmitMode, matching the main follow-up submission guard.
  • Hide the side-chat composer behind a visible checking state until the first interaction request resolves. If it fails, keep the composer unavailable and show an inline Retry action.
  • Keep queues attached to the visible composer for plugin-owned interactions, which deliberately do not replace that composer.
  • Publish the mobile shell height and keyboard safe-area override on document.body, the common style ancestor for both the app shell and body-portaled compact drawers.
  • Add regression coverage for the combined question-and-queue state, standalone queue-card styling, unknown and failed interaction state, plugin-owned interactions with queues, and the real body-portaled side-chat shelf inheriting the corrected viewport height.
  • 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

  • Added focused submission-policy tests that failed before the fix because active child side chats still returned queue mode while pending-interaction state was loading or present, then passed once side chats reused the real guard.
  • Added component regressions that failed before the fix because an unresolved or failed interactions request exposed the composer; they now pass with a checking state and retryable error state.
  • Added the plugin-interaction-plus-queue regression requested in review; it failed before the fix because the queue used standalone styling above a visible composer, then passed after deriving placement from the composer-blocking condition.
  • 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 --check and Prettier checks — passed.
  • Reproduced the interaction states with a real Claude Code provider question and a CLI-confirmed queued message, then checked desktop (1440 x 1000) and mobile (390 x 844) views. Live geometry changed from a 12 px overlap to the intended 8 px gap, and the normal composer states remained unchanged.
  • Confirmed the real QA sidechat still has the pending user_question at the server boundary while testing the fixed client policy.
  • Reproduced the Android IME behavior in a target-SDK-36 System WebView harness. WebViews that report a reduced visual viewport now pass that height through to the body-portaled shelf. A host that consumes IME insets exposes no web-side keyboard geometry and must correct its native inset propagation.

Fixes #2869

AGENT GENERATED

@ymichael ymichael changed the title Keep queued messages visible during side-chat interactions Fix side-chat interactions and mobile viewport layout Sep 1, 2026
@ymichael

ymichael commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

@slopcop

@bb-slop-cop

bb-slop-cop Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · review

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}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 654ca4f: queue placement now follows the composer-blocking condition, so plugin-owned interactions keep the queue attached to their visible composer. Added a plugin-interaction-plus-queue regression test. @slopcop

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 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/app type check passed.
  • git diff --check passed.
  • A doobie mobile smoke test opened the real dev app at 390 by 844 pixels. The compact right-panel drawer portaled to document.body and 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.json file 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.

@bb-slop-cop

bb-slop-cop Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · review

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 =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 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.

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 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.

@ymichael
ymichael merged commit 979b1f4 into main Sep 2, 2026
15 checks passed
@ymichael
ymichael deleted the bb/resolve-pending-question-submission-hold-thr_eny7cz94im branch September 2, 2026 02:41
ymichael added a commit that referenced this pull request Sep 2, 2026
## 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
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.

Side chat hides queued messages while a question is pending

1 participant