Skip to content

feat(ui): redesign /btw side chat into a floating multi-turn panel - #104749

Merged
steipete merged 6 commits into
mainfrom
claude/side-by-side-chat-design-1240bc
Jul 11, 2026
Merged

steipete merged 6 commits into
mainfrom
claude/side-by-side-chat-design-1240bc

Conversation

@steipete

@steipete steipete commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Closes #104747.

The /btw side-question answer (#104204) rendered as a full-width inline "BTW" card between the thread and the composer: it pushed the composer down, a new question replaced the previous answer (no follow-ups), and dismissing was all-or-nothing — closing the card retired the pending run and threw the answer away.

Why This Change Was Made

Side questions are a side conversation and should read like one. This redesigns the card into a floating Side chat panel pinned to the top-right of the thread column (fixed bottom sheet ≤768px), modeled after Claude Code's desktop side-chat popover:

  • Header: "Side chat" title with a "Not saved to chat history" hint, plus trash (discards the conversation and sends a targeted chat.abort for a pending run) and X (close; the conversation and a pending run survive — a new question or an arriving answer reopens the panel).
  • Multi-turn: completed answers accumulate as turns in a scrollable body instead of replacing each other; the newest turn pins the scroll to the bottom.
  • Follow-up input: a "Follow up…" pill inside the panel sends another detached /btw. Detached side answers never enter session history, so the follow-up command carries capped quotes of the previous side question and answer as context (buildSideChatFollowUpCommand). The panel displays the user's typed question via structured state (the pending record, correlated by run id) — the command text is prompt-only and never parsed back apart.

State model: the single chatSideResult becomes chatSideChatTurns (append-only per conversation) plus chatSideChatHidden; the pending/suppression machinery (chatSideResultPending, chatSideResultTerminalRuns) is unchanged, so retired runs still cannot leak late replies into the transcript.

User Impact

Control UI chat users get a persistent, conversational side chat: ask a /btw (typed or via the selection popup), read the answer in a floating panel, ask follow-ups inline, close it without losing the thread, and clear it when done. No gateway/protocol changes; chat.side_result is consumed as before.

Pending Multi-turn Dark
pending multi-turn dark
Mobile bottom sheet (375x812)

mobile

Evidence

  • Unit + responsive tests (Blacksmith Testbox): pnpm test over chat-gateway, chat-send, chat-state, chat-composer, chat-side-chat, chat-view, side-question, and chat-responsive.browser suites — 8 files, 628 tests passed on the final revision, including the rewritten desktop scroll-containment and mobile-overlay assertions.
  • pnpm check:changed (delegated to Testbox) — lint/type/i18n lanes green.
  • Codex autoreview (gpt-5.6-sol, xhigh), four rounds; each accepted finding fixed in-branch: follow-ups now carry the previous question+answer (answer-only context lost referents), the typed question travels as structured state instead of marker-parsing command text, trash actually aborts the pending run, rejected/pre-send-failed sends restore the typed follow-up, and the input is disabled while a question is pending so an in-flight answer cannot be silently superseded. Remaining known limitation (deferred, see below): panes other than the initiating one render a follow-up's server-echoed question as the full context command.
  • Live verification against pnpm dev:ui:mock (mock gateway): /btw send shows the pending turn; chat.side_result renders the markdown answer; panel follow-up (Enter and ↵ button) sends /btw with carried context and clears the input; X hides the panel and a new question reopens it with prior turns intact; trash clears and retires the pending run — a late chat.side_result for the retired run neither reopens the panel nor reaches the transcript.
  • New tests: chat-side-chat.test.ts (panel render/interaction incl. disabled-while-pending and draft restore), gateway turn-accumulation + reopen-on-arrival + pending-question preference, follow-up builder round-trip in side-question.test.ts, rejection-callback coverage for failed and pre-send-exit detached sends in chat-send.test.ts.

Follow-up (out of scope here): an additive chat.side_result field carrying the display question, so non-initiating panes/clients render follow-up questions cleanly instead of the embedded context command.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XL maintainer Maintainer-authored PR labels Jul 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5118bec22b

ℹ️ 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 on lines +78 to +79
props.onFollowUp(command);
input.value = "";

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.

P2 Badge Preserve failed follow-up drafts

When a side-chat follow-up is submitted while the Gateway is disconnected or chat.send rejects/returns a terminal ACK, this clears the only copy of the user's typed follow-up before handleSendChat(command) has accepted it. That handler is wired as a messageOverride, so the existing composer restore path has no previousDraft for the panel input; users lose the follow-up text on transient send failures. Please keep the input populated until the detached send is accepted, or plumb a failure result back before clearing it.

Useful? React with 👍 / 👎.

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Jul 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef2872026c

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

onSideChatClear: () => {
state.chatSideChatTurns = [];
state.chatSideChatHidden = false;
// Retire (not just clear) so a discarded question's still-running
// detached run cannot leak its late reply into the transcript.
retirePendingChatSideQuestion(state);

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.

P2 Badge Abort pending BTW runs when clearing side chat

When the trash button is pressed while a side question is pending, this only retires the local pending record; it never aborts the generated runId via chat.abort. I checked the gateway path in src/tui/embedded-backend.ts:450-495, and run-id aborts can cancel the BTW run, so the model work keeps running after the UI/docs say clear discards it and stops a pending run. Please abort the pending run before retiring it, or stop advertising clear as a stop action.

Useful? React with 👍 / 👎.

steipete added 3 commits July 11, 2026 15:44
The inline BTW side-result card becomes a floating Side chat panel pinned
to the thread column: multi-turn conversation with markdown answers, a
follow-up input that carries the previous side answer as context, and
header actions to clear (retires the pending run) or close (conversation
and pending run survive; an arriving answer reopens the panel).
…ion structurally

Review follow-ups: the /btw follow-up command now embeds both the previous
side question and answer (answers alone lose the referents), and the panel
shows the user's typed question via structured state (pending record
correlated by runId) instead of parsing a marker out of user-controlled
command text.
…drafts

Trash now sends a targeted chat.abort for the pending /btw run (the retire
set still suppresses its late events if the abort races), the follow-up
input is hidden while disconnected like other slash sends, and a rejected
detached send restores the typed follow-up into the panel input.
@steipete
steipete force-pushed the claude/side-by-side-chat-design-1240bc branch from ef28720 to cfddcb5 Compare July 11, 2026 22:51
@clawsweeper

clawsweeper Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 78bf67bb73367c87087e36fa2170f00dbc1f0e30, but the PR head is now 0d611f310cc0c792224f95caa2516003cf5c5d5f. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (1 earlier review cycle)
  • reviewed 2026-07-11T23:05:03.210Z sha 223d595 :: needs real behavior proof before merge. :: [P2] Disable follow-ups while a side run is pending | [P2] Restore the draft when picker gating rejects the send

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review


P2 Badge Restore drafts when picker gating rejects follow-ups

When a side-chat follow-up is submitted while a model/profile picker patch is in flight and that patch resolves false, this return exits before btwPending is created and before opts.onSideQuestionSendRejected runs. The side-chat input is unmanaged and renderSideChatPanel has already cleared it after calling onFollowUp, so the user's typed follow-up disappears even though no chat.send was attempted; call the rejection callback or defer clearing on this early-failure path.

ℹ️ 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 on lines +517 to +518
canFollowUp:
canCompose && props.connected && typeof props.onSideQuestion === "function",

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.

P2 Badge Disable follow-ups while a side question is pending

When a pending side question is visible, this still renders an enabled follow-up input. If the user submits another follow-up before the first answer arrives, handleSendChat treats it as a new /btw and retires the existing pending run (retirePendingChatSideQuestion), so the first answer is suppressed instead of accumulating as a turn while its model work can continue; hide/disable the composer while sideChatPending exists, or explicitly queue/abort the prior pending run.

Useful? React with 👍 / 👎.

…n pre-send exits

A follow-up while a question is pending would retire the in-flight run and
silently drop its answer, so the panel input is disabled until the answer
lands. The rejection callback now fires on every non-accepted path of the
guarded detached send (early exits, guard dedupe, rejected acks), not just
rejected acknowledgements.
@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 11, 2026
Pending and turn questions are already display-ready (chat-send strips
composer commands, the server echo carries no /btw prefix, panel follow-ups
pass structured text); re-extracting corrupted questions that begin with a
command token.
@clawsweeper clawsweeper Bot removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Jul 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d611f310c

ℹ️ 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 on lines +517 to +518
canFollowUp:
canCompose && props.connected && typeof props.onSideQuestion === "function",

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.

P2 Badge Preserve follow-up drafts across disconnects

When the Gateway drops while a user has typed a side-chat follow-up but has not submitted it yet, this props.connected gate flips canFollowUp to false; renderSideChatPanel then removes the footer entirely, and the side-chat input is unmanaged state, so the draft is recreated empty after reconnect. The fresh path is the connected gate here rather than the rejected-send path already handled; keep the composer mounted disabled or persist the side-chat draft before hiding it.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 724e90c into main Jul 11, 2026
85 of 89 checks passed
@steipete
steipete deleted the claude/side-by-side-chat-design-1240bc branch July 11, 2026 23:23
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 12, 2026
…penclaw#104749)

* feat(ui): redesign /btw side chat into floating multi-turn panel

The inline BTW side-result card becomes a floating Side chat panel pinned
to the thread column: multi-turn conversation with markdown answers, a
follow-up input that carries the previous side answer as context, and
header actions to clear (retires the pending run) or close (conversation
and pending run survive; an arriving answer reopens the panel).

* fix(ui): carry prior side question in follow-ups; display typed question structurally

Review follow-ups: the /btw follow-up command now embeds both the previous
side question and answer (answers alone lose the referents), and the panel
shows the user's typed question via structured state (pending record
correlated by runId) instead of parsing a marker out of user-controlled
command text.

* fix(ui): stop pending side runs on clear and keep rejected follow-up drafts

Trash now sends a targeted chat.abort for the pending /btw run (the retire
set still suppresses its late events if the abort races), the follow-up
input is hidden while disconnected like other slash sends, and a rejected
detached send restores the typed follow-up into the panel input.

* test(ui): attach side-chat panel test container for restore assertion

* fix(ui): block side-chat follow-ups while pending; notify rejection on pre-send exits

A follow-up while a question is pending would retire the in-flight run and
silently drop its answer, so the panel input is disabled until the answer
lands. The rejection callback now fires on every non-accepted path of the
guarded detached send (early exits, guard dedupe, rejected acks), not just
rejected acknowledgements.

* fix(ui): render side-chat questions verbatim

Pending and turn questions are already display-ready (chat-send strips
composer commands, the server echo carries no /btw prefix, panel follow-ups
pass structured text); re-extracting corrupted questions that begin with a
command token.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Control UI: side chat panel — floating, multi-turn, with follow-up input

1 participant