Skip to content

feat(side-chat): hide inherited messages and start a side chat from selected text - #252

Merged
GoDiao merged 5 commits into
mainfrom
feat/side-chat-selection-entry
Nov 15, 2026
Merged

GoDiao merged 5 commits into
mainfrom
feat/side-chat-selection-entry

Conversation

@GoDiao

@GoDiao GoDiao commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #251 from trying side chats in the app.

What changed

A side chat shows only its own messages. getSessionTranscript drops the inherited part when the session's parent kind is side (withoutInheritedEntries in src/server/transcript/entries.ts):

  • entries copied by the fork (they carry forkedFrom);
  • a tool_result message that only answers inherited tool calls. That is the fork note when the parent was mid-tool-call; its tool call is gone, so it must not show on its own.

Task notifications, subagent messages and the last todos come from the filtered entries, so the parent's don't leak into the side chat. The model's context is unchanged (the CLI reads the file), and getSessionMessages (rewind, branch from a message, workspace) is not filtered. Once detached, the parent kind is forked, so the full history shows; closing the tab on detach already drops the loaded messages, so reopening the session reads it afresh. No protocol change.

Start a side chat from selected text. Selecting text in the main conversation shows "Start a side chat | Reply". The first creates a new side chat (a new one every time), adds the same chat-selection reference Reply would add to the new session, and closes the popover. Nothing is sent.

  • SelectionPopover takes a list of actions (with a loading state that blocks a second click); both callers are migrated.
  • createSideChat returns the new session id. useStartSideChat (desktop/src/lib/sideChats.ts) holds the create, loading and error toast, shared with the new-tab page entry.
  • The action is offered when the session can use its side panel (canUsePanel in ActiveSession). So a side chat's own messages offer only Reply, and the mobile (H5) layout and team member sessions, which have no panel, don't offer it, same as the new-tab entry.
  • After the user starts a side chat (either entry), its composer takes the focus once. createSideChat sets a one-shot sideChatToFocus in the panel store (not persisted, not set on failure); the panel's SideChatView passes it to SessionConversation → ChatInput autoFocus, which reuses the existing auto-focus effect, then clears it. Tabs brought back by syncSideChats or restored after a restart never set it, and side chat composers still don't take focus otherwise.

A slimmer side chat composer. In a side chat (ChatInput with primary false) the composer has no "+" menu and no controls row (project, permissions, model, context usage), and dropped or pasted files are not attached (pasting text works). Quotes, / and @ menus, send/stop and permission prompts stay. Model and permission mode are inherited from the parent. Detached, it opens as a regular session with the full composer. The post-turn git info refresh is skipped there; the first read stays because the @ search takes its working folder from it.

Composer height follows width changes. The input's auto-grow measured scrollHeight only on mount and on input changes. A side chat started while the panel was closed mounts its composer in the same commit that opens the panel, so it could be measured while still narrow (Chromium counts the wrapped placeholder in scrollHeight) and stay about seven lines tall. ComposerBox now owns the auto-grow: it measures when the text changes and, through a ResizeObserver, when the textarea's width changes (height-only changes are ignored, so measuring cannot loop). The separate resize effects in ChatInput and EmptySession are removed.

Docs: docs/features/side-chat/tech-design.md and the existing CHANGELOG entry.

Testing

Each new test was checked to fail with the change reverted (filter disabled, tool_result rule removed, action removed, canStartSideChat not passed, id not returned, loading not passed), then the files were restored.

  • Server: session-links.test.ts side chats group: own messages only, no parent notifications or todos, model messages still complete; fork note mid-tool-call hidden; full history after detach. bun test --randomize --seed=1 on session-links and sessions tests: 209 pass, 2 fail (the slash-command tests that also fail on main). Full bun test: 2642 pass, 11 fail, the same 11 as on main.
  • Focus: WorkspacePanel (a started side chat is focused once, also from the new-tab page; a synced tab is not), workspacePanelStore, ChatInput, SessionConversation tests; each fails with the change reverted except the synced-tab guard, which checks that nothing focuses.
  • Slim composer: ChatInput tests for the tools menu and controls row, and for dropped/pasted files, each run for the main and a side chat composer; the side chat cases fail with the change reverted.
  • Composer height: ComposerShell tests: re-measures when the width changes and not when only the height does, grows with text up to the maximum; the width test fails without the observer.
  • Desktop: MessageList, SelectionPopover, WorkspacePanel (new-tab entry), ActiveSession (panel vs. mobile), workspacePanelStore, lib/sideChats tests. bun run lint passes. bun run test -- --run: 2835 pass, 1 fail (mcpCatalogInstall, unrelated; passes 3/3 when run alone).
  • Not checked in the running app.

…elected text

A side chat's page now shows only its own messages; the model still reads the whole fork. Selecting text in the main conversation offers "Start a side chat | Reply"; the first opens a new side chat with the selection quoted in its composer.
@GoDiao
GoDiao merged commit bd48a66 into main Nov 15, 2026
4 checks passed
@GoDiao
GoDiao deleted the feat/side-chat-selection-entry branch November 15, 2026 04:22
@GoDiao GoDiao mentioned this pull request Nov 15, 2026
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