Files
vscode/src
Sandeep Somavarapu e63efae792 sessions: quick chats (workspace-less sessions) in the Agents window (#323972)
* sessions: quick chats — workspace-less single-chat sessions

Adds quick chats to the Agents window: lightweight chats not scoped to a
workspace, backed by an agent-host session. The host infers workspace-less
from an absent workingDirectory (forks excluded) and assigns a stable scratch
dir; the workspaceless tag rides the generic _meta bag. Quick chats are
single-chat, use the normal session presentation (Done hidden), render in an
always-visible in-list "Chats" section, and persist across reloads.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: New from a quick chat opens another quick chat (Round 23)

The primary "New" action gated quick-chat routing on `isCreated &&
isQuickChat`, but a quick-chat draft is Untitled (isCreated=false), so it
fell through to the workspace composer seeded with a throwaway scratch dir
(no session-type picker, "No models available").

Route on `isQuickChat` alone so a quick chat — draft or committed — opens
another quick chat mirroring its harness. Extract the routing into a pure,
side-effect-free `openNewChatOrQuickChat` helper so it is unit-testable
(chat.contribution.ts is not test-importable). Supersedes Round 14(2) and
updates Round 22(3); the Round 14(2) discard branch and Round 17 picker
re-parent are kept as internal defense.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: quick-chat list & layout polish (Round 22 items 1-2)

- Suppress the redundant per-row chat icon when a quick chat is rendered
  under the always-visible "Chats" section (the section header already
  carries a chat icon); keep it in Pinned/custom/date groups where the
  chat identity is useful.
- Disable the "Toggle Side Panel" command for quick chats via
  precondition IsQuickChatSessionContext.negate(), since a quick chat has
  no side pane (the empty aux bar is hidden and the chat is full-width).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: persist empty peer-chat catalog sentinel to avoid re-running legacy migration

When a session has no legacy peer chats, write an empty catalog so
_readPersistedPeerChatCatalog returns [] on subsequent restores and
_migrateLegacyPeerChats never re-runs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: Cmd+N always creates a new session; New Quick Chat gets Cmd+K Cmd+N (Round 24)

Per user feedback, Cmd+N must always open a NEW SESSION — never a quick
chat. Drop the context-aware quick-chat routing from
NewChatInSessionsWindowAction (rename its title "New Chat" -> "New Session",
keep the id) so it unconditionally calls openNewSession from the active
session; the helper is renamed openNewChatOrQuickChat -> openNewSessionFromActive.

Quick chats are created only via the Chats-section "+" (NewQuickChatAction),
which now has a default Cmd+K Cmd+N chord. The peer-chat "+" (Cmd+T) is
unaffected. Supersedes the Round 22(3)/23 mirror routing; the Round 14(2)
discard branch and Round 17 picker re-parent are untouched.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: Cmd+N never inherits a quick chat's folder into the workspace composer (Round 25)

New from a quick chat must always land on the clean New Session composer with
a visible session-type picker. Gate openNewSessionFromActive's folder
inheritance on isQuickChat so a quick chat never carries a (possibly leaked
scratch) workspace URI into openNewSession.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: re-seed workspace draft when composer swaps out of quick-chat mode (Round 25b)

Cmd+N from a quick chat reuses the new-session composer and only
_activate(undefined), leaving it session-less. The session-type picker hides
itself when it has no folder types (no active session), so no picker showed.
Re-run the constructor's workspace-draft seed from an autorun when the composer
transitions out of quick-chat mode with no active session, matching a freshly
opened new-session composer (folder + visible picker).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: quick-chat untitled title falls back to "New Chat" via shared helper (Round 26)

An untitled quick chat's titlebar showed "New Session" because the empty-title
fallback was hardcoded and not quick-chat aware. Add getUntitledSessionTitle(isQuickChat)
to the common layer and route all 5 fallback sites (titlebar, session header x2,
list hover, sessions picker) through it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: track isQuickChat in titlebar re-render autorun (Round 27)

The SessionsTitleBarWidget re-render autorun read the active session's
title and workspace but not isQuickChat, which _render() consumes for the
untitled title fallback. Track it as a reactive dependency for
forward-safety and consistency with other reactive render sites.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: move workspace-less marker ownership to the AH service

Each agent used to persist and re-emit its own workspace-less (quick chat)
marker (copilot.workspaceless / claude.workspaceless) in the shared session
database, and agents that persist nothing (Codex) lost the marker on restart.

Make the AH service the single owner: AgentService persists a single
agentHost.workspaceless key at create/materialize (from the value it already
infers in _buildInitialSummary) and overlays _meta.workspaceless onto every
agent's summary in listSessions. Agents no longer write or namespace the
marker; Copilot reads the shared key for its resume system prompt, and the
now-dead workspace-less plumbing is removed from the Claude session. This
fixes restored quick chats for every agent (including Codex) with no
per-agent code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions/agentHost: address review feedback (naming + inline)

- Rename the workspace-less launch-plan flag from isQuickChat to
  workspaceless in CopilotSessionLaunchPlan and IAgentHostPromptContext (and
  the disposeSession local) so the flag matches the workspaceless marker it
  flows from throughout the AH layer. Feature-descriptive names
  (COPILOT_AGENT_HOST_QUICK_CHAT_INSTRUCTIONS, _quickChatScratchDir) are kept.
- Inline openNewSessionFromActive back into NewChatInSessionsWindowAction.run
  and remove the single-caller seam module + its test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: make the AH service the sole owner of the workspaceless marker

Following the earlier ownership move, the agents still read + re-emitted
_meta.workspaceless in their metadata projections, which was redundant on the
listSessions path (AgentService overlays it centrally) and only load-bearing
on the single-session restore path.

Centralize the restore overlay in AgentService.restoreSession (reads
agentHost.workspaceless in its existing batch metadata read and merges it into
the restored summary _meta), then drop the per-agent re-emit: remove it from
the Claude metadata store entirely (Claude has no runtime need) and from the
Copilot listSessions/getSessionMetadata projections. Copilot keeps reading the
AH key for its resume system prompt and scratch-dir cleanup. Codex is now
covered centrally with no Codex code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: inline openQuickChatAndFocus into NewQuickChatAction

Single-caller helper folded into the action's run().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: make ISessionsProvider.createQuickChat mandatory

Replace the optional createQuickChat with a mandatory method that throws when
the provider does not support quick chats; callers now gate solely on the
supportsQuickChats capability instead of probing for the method. Workspace-bound
providers (Copilot chat, local chat) get an explicit throwing implementation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: use "workspace-less chat" terminology instead of "quick chat"

Rename the agent-host-internal quick-chat identifiers, prompt tags, and prose to
workspace-less: COPILOT_AGENT_HOST_QUICK_CHAT_INSTRUCTIONS ->
COPILOT_AGENT_HOST_WORKSPACELESS_INSTRUCTIONS, the <quick_chat> system-message
tag -> <workspaceless_chat>, and the scratch-dir helpers
(_quickChatScratchDir/_ensure*/_cleanup*/_withQuickChatScratch). The workbench
UI term "Quick Chat" is kept only where the agent host documents that mapping.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: address Copilot Code Review feedback on quick chats

- sessionsList: select the row chat icon from isQuickChatSession(), not from
  workspace === undefined, so a workspace session with a transiently-undefined
  workspace no longer briefly shows the chat icon.
- sessionContextKeys: correct the isQuickChat comment to reflect that the key
  is sourced from the isQuickChat tag, never inferred from workspace absence.
- Agents window accessibility help: document the New Quick Chat command
  (Cmd/Ctrl+K Cmd/Ctrl+N) and the Chats section plus button, and note that the
  workspace picker does not apply and Toggle Side Panel is disabled for quick chats.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-02 00:38:15 +00:00
..