Repository navigation
feat(side-chat): hide inherited messages and start a side chat from selected text - #252
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #251 from trying side chats in the app.
What changed
A side chat shows only its own messages.
getSessionTranscriptdrops the inherited part when the session's parent kind isside(withoutInheritedEntriesinsrc/server/transcript/entries.ts):forkedFrom);tool_resultmessage 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 isforked, 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-selectionreference Reply would add to the new session, and closes the popover. Nothing is sent.SelectionPopovertakes a list of actions (with a loading state that blocks a second click); both callers are migrated.createSideChatreturns the new session id.useStartSideChat(desktop/src/lib/sideChats.ts) holds the create, loading and error toast, shared with the new-tab page entry.canUsePanelinActiveSession). 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.createSideChatsets a one-shotsideChatToFocusin the panel store (not persisted, not set on failure); the panel'sSideChatViewpasses it toSessionConversation→ChatInputautoFocus, which reuses the existing auto-focus effect, then clears it. Tabs brought back bysyncSideChatsor 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 (
ChatInputwithprimaryfalse) 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
scrollHeightonly 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 inscrollHeight) and stay about seven lines tall.ComposerBoxnow owns the auto-grow: it measures when the text changes and, through aResizeObserver, when the textarea's width changes (height-only changes are ignored, so measuring cannot loop). The separate resize effects inChatInputandEmptySessionare removed.Docs:
docs/features/side-chat/tech-design.mdand the existing CHANGELOG entry.Testing
Each new test was checked to fail with the change reverted (filter disabled, tool_result rule removed, action removed,
canStartSideChatnot passed, id not returned, loading not passed), then the files were restored.session-links.test.tsside 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=1onsession-linksandsessionstests: 209 pass, 2 fail (the slash-command tests that also fail onmain). Fullbun test: 2642 pass, 11 fail, the same 11 as onmain.WorkspacePanel(a started side chat is focused once, also from the new-tab page; a synced tab is not),workspacePanelStore,ChatInput,SessionConversationtests; each fails with the change reverted except the synced-tab guard, which checks that nothing focuses.ChatInputtests 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.ComposerShelltests: 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.MessageList,SelectionPopover,WorkspacePanel(new-tab entry),ActiveSession(panel vs. mobile),workspacePanelStore,lib/sideChatstests.bun run lintpasses.bun run test -- --run: 2835 pass, 1 fail (mcpCatalogInstall, unrelated; passes 3/3 when run alone).