vscode — Engineering Performance
90 engineers all time · Jan 2025 – Nov 2026 · built 2026-11-22 · GitHub
Performance snapshot
Today's rolling 90-day reading for vscode, compared with the start of the series. Pick a window to move that comparison point.
Avg. perf / dev / mo
+897.0%
1.94 → 19.36 ETV
Active engineers
+17.4%
46.0 → 54.0
Features
−13.3pp
40.2% → 26.9%
vs. Microsoft
1.8x
1.4x → 1.8x · +78% above
vscode vs. Microsoft
Per-engineer ETV for vscode against Microsoft as a whole. Both lines are 90-day rolling averages scaled to a 30-day month, so they share one axis and can be read against each other at any point. Pick a window to zoom the chart to it.
Performance Composition
Each month's output split by type of work: Features (new value), Maintenance (sustaining systems), Tests, Docs, and Fixes (rework). The yellow line is output per engineer, so when it rises each engineer is delivering more, whatever the team size did. Unit: Engineering Throughput Value (ETV).
Engineering capacity
Effective engineers behind vscode, against its pre-AI baseline. Each subject has its own: vscode's is 1.94 ETV / dev / mo, its first reading in Q1 2025. Per-engineer ETV divided by that gives a capacity multiple, and that multiple applied to the engineers active in the trailing 90 days turns it into engineer-equivalents. The line is the real headcount, so the gap between line and area is what the leverage is worth. Because each baseline is its own, every subject opens at 1.0x on its first day: multiples measure improvement and are not comparable between subjects.
Knowledge concentration
How dependent is this repo on a small number of engineers? Higher top-1 share = higher key-person risk.
roblourens owns 7.0 % of commits.
Behind the numbers
Written summary of the work completed each month.
No monthly reports available yet.
Top engineers
Most impactful commits
Top 10 by ETV in the all-time window.
- 41.7ETVagentHost: run on-device models with llama.cpp (#341325) * agentHost: run on-device models with llama.cpp Adds on-device models to the Copilot Agent Host. Models (MAI Code 1.1 Flash today) are listed from the Azure ML catalog, downloaded into the shared ~/.copilot/azureml-models store, and served with a user-provided llama.cpp llama-server. VS Code doesn't install llama.cpp; loading without a usable build explains how to get one. - Model picker: an On This Device tab (NVIDIA GPUs where a model fits) with per-model detail pages for download, thinking level, context size and Use in Auto. - Loading, waiting for running responses and errors show in a notice above the chat input with Cancel, instead of dialogs and toasts. - A CopilotRequestHandler bridge serves direct selections on the local server, and offers the loaded model to Auto (off by default, with the local model safety disclosure) with cloud fallback. - Swaps and reloads wait for running turns; turns that used the on-device model are labelled On-device. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: fix on-device CI hygiene and Linux supervisor test Drop a non-ASCII settings breadcrumb from the accessibility help and run the supervisor test's child as Node under the Electron test runner. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: run only the configured llama-server and trim on-device code Use only chat.copilot.localModel.llamaServerPath (machine-scoped) for llama-server. Drop PATH, LLAMACPP_SERVER_PATH and install-location discovery, the approval flow and the runtime digest. Re-resolve the configured path before every launch, never cache zero-GPU qualification, and key cached probes on the llama.cpp libraries next to the binary. Rename llamaCppInstaller to llamaCppRuntime, remove dead exports, trim comments that restate code, and merge near-duplicate tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add blank signing commit Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Logan Ramos · 4d4267b7 · 2026-10-14
- 39.8ETVchat windows: chat windows of the Agents window on parts, with drag and drop between parts (#345683) * Chat window: layout model and stacked input-only rules in the workbench Move two pure models of a chat window to src/vs/workbench/contrib/chatWindow/common, with their tests, renamed to chat window names: - chatWindowLayout.ts, from the session grid layout model of I2 (#345075): the layout modes (Chat only, Editor only, Stacked, Side by Side), the grid topology per mode and terminal position, the activity bar column, the tab order, and when a layout change needs a rebuild. - chatWindowInputOnly.ts, from the stacked input-only rules of I4 (#345077): when the chat in Stacked collapses to its input, while dragging, on resize and when the window forces it. Behaviour and test assertions are unchanged. Nothing uses them yet. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat: a chat input can lay its editor out one line tall ChatInputPart.setSingleLine lays the input editor out exactly one line tall, whatever its content or minimum lines, for the input-only chat of a chat window. Moved here from #345663, whose only consumer this is. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * editor: the Add Tab entries act on the group of their tabs bar The Add Tab control runs its entries with the group of the tabs bar, so that they act on that group rather than on the active one, such as in a chat window whose window does not have focus yet. Moved here from #345663, whose only consumer this is. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat: links in chat markdown open with the opener of the renderer's scope The chat markdown renderer opens links with the opener service of its scope, such as of the window that shows the chat, rather than the global one. Moved here from #345663, whose only consumer this is. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the chat composite bar and the card frames follow a chat surface outside the Sessions part The header's background and the frame ownership of a card apply to a chat surface as to the Sessions part, and the tests of the Sessions part mark it as a chat surface, as the part's chat background now does. Moved here from #345663, whose only consumer this is. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: show sessions outside the Sessions part grid The Agents window can only show a session in the Sessions part grid of its main window. Add window sessions: ISessionsService.showSessionInWindow shows one chat of a session outside the grid, in a session view registered with ISessionsPartService.registerWindowSessionView. A chat shown that way leaves the tabs of its session in the grid, and the session leaves the grid when that chat was its only one; closeSession stops showing it. Active session rule: a session shown in another window becomes active while that window has focus, unless it is shown passively; the main window's layout follows its own session. The sessions list, layout controllers, Changes, the terminal and the agent host provider follow mainWindowActiveSession, which is the active session while no other window shows a session. The agent host provider treats sessions shown in other windows as shown, for chat config and loading. Nothing shows a session in another window yet, so behavior does not change. A test covers that the main window follows the active session without other windows. Ported from agents/sessions-window-sessions 94f6c110d69, 5ec09ac3f48, 664d4e717db and 4a10fdb1bb8, e08ab865cad. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: let session actions act on a given session The title bar's Changes, pull request and review actions, the Changes view and editor, and the Agent Merge context keys always act on the active session, so they cannot serve a session that is shown but not active. Make them take a session: - Actions resolve their session from an explicit argument (by resource, against the sessions shown in the grid and in other windows), else from the main window's active session. - ISessionScope gives a view or editor its session; the Changes view, summary, picker, changeset selection, editor, resolver and review actions read their changes through IChangesViewService.getSessionChanges(session). - Session action context keys are bound per context key service, so a title bar hosted for a non-active session gets its own scoped keys; their observables only react to the keys they read. Without an argument and without other windows every action still targets the active session, so behavior does not change. Squashed from agents/session-scoped-titlebar-actions (94b140fb23d, 4000cd23529, 46bf53f9e44, 376161c28b5, 170261683c6, 49ae8b2654e, 0be0e134bef, 258419ba130, 6b76d9d947c, 15b99a7f6e4, 42e61c7cd4d, 9e5e58f7a75, a26d679dd55, 0515ba584b9, 31e44e57cca, f575613f549), with 993cf42ec96, 2f339933667 and 65c2e7c69c1 for the main window's session. A Changes editor shows the changes of the chat its source names, from that chat only: whichever chat or session is active and whichever window has focus, so that two editors of two chats of a session, in one window or not, each show their own (ISessionChangesEditorOptions.chatResource, getChangesEditorChanges). The main window's editor, which names no chat, shows the chat the main window shows for its session, as its active session or a session of its grid, never the session another window shows or has focus, as on main; once the main window does not show its session, such as when the editor moves into the window a chat of its session opens in, the chat that window shows. Fix Checks sends its prompt to the widget of the chat its session shows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: let session views be hosted outside the Sessions part, with an input-only chat view A session view only works inside the Sessions part: it always shows the session header and the Session Activity Bar, and its chat input always takes the main window's options. Session views, chat groups and chat views now take ISessionViewHostOptions, so a host outside the Sessions part can hide the session header and the Session Activity Bar and configure the chat input (placeholder, minimum lines, status pills). SessionView exposes its primary chat view, and Sessions part styles also apply under .sessions-window-host. The chat view gains an input-only mode: it shows only the input, with the latest message and the progress or outcome of its response above it, and switches back to the conversation when the chat waits for input that only the conversation can show. Waiting for input, failing and cancelation are announced once to screen readers, and nothing is read from the chat until input-only is enabled. While input-only, the input editor is laid out exactly one line tall (ChatInputPart.setSingleLine, from the workbench parts foundation). The Sessions part passes no host options and nothing enables input-only mode, so behavior does not change. Ported from agents/sessions-window-sessions c0685f56d02, 10fb2354aa6, 5de12de1983, adapted to the Session Activity Bar taking its own column. Carried for the chat windows on parts without the two input-only context keys (sessions.chatViewInputOnlyEnabled, sessions.chatViewInputOnly), which nothing read, and without ChatInputPart.setSingleLine, which the workbench parts foundation carries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: share the chat background surface beyond the Sessions part The Sessions part painted the chat background itself, so nothing else could show a chat with the Agents wallpaper behind it. - SessionsChatSurface paints the chat background behind an element and follows the background service; the codicon confetti, its announcement and its telemetry move with it. The Sessions part uses it. - The rules that let the background show through chat surfaces, lift a surface's `.content` above the background, give its editors the panel background and place the confetti target match `:is(.part.sessionspart, .sessions-chat-surface)`, keeping the weight of the `.part.sessionspart` rules they override. The sticky scroll replica finds the background through the surface. No visual change. The wallpaper half of 3825a51e90b (#345561). Its card surface half (`.agents-card-surface`, `--agents-card-frame-owner`) belongs to the part-grid look of the workbench parts foundation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: generic window layout keys, the chat window service seam and window state The first piece of chat windows in the workbench (P9): - `layoutMode` and `splitLayout`: generic per-window context keys, next to the panel keys, for how a window shows its chat and its editor parts. They are bound in a window's own context and unset elsewhere, so that the Layout menu's entries stay extensible and keybindings can test the mode. `bindWindowLayoutContext` binds them to a window's state. - `IChatWindowService` and `IChatWindowProvider`: a chat window shows a chat in its chat part beside its main part. The provider supplies the content (the chat's editor, title and scoped services), the chrome (title row and strip), the look (gap, cards, chat background) and where a chat goes back to. There are no chat window kinds. - `ChatWindowState`: the layout rules of chat windows (Stacked / Side by Side / Editor Only / Chat Only, the next split arrangement, input-only, terminal position), what chat windows were last left as, and what is remembered per chat. It reads the keys chat windows of the Agents window stored them under. - the opening helpers (one opening per chat at a time, clean up on failure) and the serialization of a main part's editors for restore. The layout model (`chatWindowLayout.ts`) gains the split layout type and guards for stored values. Nothing registers a provider or the service yet, so nothing changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: layout commands on the generic window layout keys The layout commands of chat windows (P9), in the workbench: Show Chat Only, Show Editor Only, Show Chat and Editor Stacked / Side by Side, Show Chat, Show Editor, Stacked and Toggle Chat Conversation, with the rules chat windows of the Agents window have (the last part shown cannot be hidden; Stacked changes the arrangement while both show, else only how both show next). Changing the layout is announced to screen readers. - Their checked state reads the generic `layoutMode` and `splitLayout` keys. - They apply where a window has layout modes (`layoutMode` is set), in the Agents window (`IsSessionsWindowContext`) while AI features are enabled. - They act on the chat window that has focus (`IChatWindowService.activeWindow`) instead of on a window handle passed by the toolbar that runs them. The Agents window loads the contribution; regular VS Code does not. The menus and buttons that show these commands come with the Agents provider. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: restore the chat windows open when the window last closed The restore rules of chat windows of the Agents window (P9), driven by the chat window provider: - the chat windows open when the window last closed open again, without focus, with the editors of their main part and their terminals, once the provider registers and while it restores (`restoreEnabled`), such as while chat windows are enabled and AI features are not hidden; - until then, and while restoring is pending, the stored ones are kept; - a chat that is gone is not restored (`canRestore`), and a removed chat is forgotten at once, before the next save (`onDidRemoveChats`). The storage key and format are those chat windows of the Agents window always used. Their entries named the session, and its chat only when it was not the main one; the provider resolves a session to its main chat, so the windows open before chat windows were built on parts open again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the chat window service and its window, on content parts `ChatWindowService` opens a chat window for a chat through the registered provider (P9): - one window per chat: opening a chat that shows, also as the chat the provider resolves it to, reveals its window; one opening per chat at a time; a failed opening takes down what it set up; - the window is an auxiliary window with its own context, scoped to its document body, where the generic `layoutMode`/`splitLayout` keys and `mainEditorAreaVisible` are bound; - two content parts: the main part, created first so it is the window's main part, starting with the editors moved from the main window or restored, and the chat part, showing the chat's editor from the provider. Both take the window's context and the provider's services; - Move to Main Window closes the window and hands the chat and the editors of its main part to the provider; - the stored chat windows are restored once the provider registers. `ChatWindow` follows today's rules: its main part shows when an editor opens in it and the window shows only its chat once its last editor closes (not for a move, nor while it closes or unloads); closing the chat's editor, the end of its chat, or closing it closes the window, the chat part first so the chat's editor does not move to the main window; a main part editor that cannot move keeps the window open; focus goes to the chat while it shows, else the main part. `ChatWindowPartsLayout` places the two parts per layout mode from the chat window layout model until the window part grid of the workbench takes over. The service registers in the Agents window only; without a provider nothing opens. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: chrome hosts for windows of their own The sessions chrome that a chat window shows outside its chat, carried from the chat windows work without its chat-window keys and handles: - the session header can show in a host outside its session view, such as the title bar of its window (SessionView.setHeaderHost, headerShown), as the window's top row; the title bar hosts it in place of its title, with the header's actions last at its right (getSessionHeaderHost, getSessionHeaderActionsHost, setHostsSessionHeader), and can show a fixed title or height; - the Session Activity Bar can show in a host outside its chat, such as a column of its own (registerSessionActivityBarExternalHost), also while its chat is hidden (partVisible on the chat groups); - the items of a submenu flyout run with the context of their entry; - the title bars of other windows show the Layout menu of their window (Menus.TitleBarWindowLayout), whose buttons the user shows and hides with the toolbar's own hide/show state, in place of the promoted-button keys; it is empty in windows without layout modes; - in a window with layout modes (the generic `layoutMode` key is set), a checked entry of the strip's side panel group hides the window's editor parts, in place of the main window's side panel; - the title bar of an editor window reads no session's keys. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the provider's title row and strip, and the chat's size, in the window The chrome facet now reaches the window: a provider renders its title row and its strip into elements of the window that the window places, with an instantiation service that has the window's services (its content's, and the window's context), and tells the room they take (`size`). The interim placement of the parts lays them out with the chat window layout model: - the title row is above the chat while the main part is beside it (Side by Side), else across the window; - the strip is a column of its own at the right while the chat is below the main part or hidden (Stacked, Editor Only), as the layout model's column placement says; - the chat part's maximum height bounds it, such as a chat that shows only its input, and the main part takes the rest; parts share the room as the chat windows did, the main part wider and taller than the chat, in whole pixels. Interim: the window part grid replaces this placement. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the chat of a session as a view editor Registers the view editor `sessions.chat`, which the chat part of a chat window shows: a session view of the window's session, configured as the chat windows showed their chat (its session header, its Session Activity Bar and its pills, the default input placeholder). It brings its own title, so its group shows no tabs. Whoever opens its editor gives it what it shows (registerSessionChatViewHost): the window session, the chat window, and where the session header shows (the window's title row). - the view's size constraints are the chat's: 280 by 120 at least, and, while the window stacks the chat below its main part and the chat shows only its input, at most its input's height, which its part and the window respect (input only, carried from the chat window's input-only controller onto the view's constraints); - the chat follows the window's input-only state, and what the user chooses in the chat is kept for the window, but not the conversation the chat shows while its input cannot show what it needs; - its view is hidden while the window shows only its main part; - the active editor its menus read is the one of the window's main part, as the main window's chat reads the one of its editor area, so that the Session Activity Bar's entries show checked. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: bind the window's content, and the look of its main part What the Agents provider needs of the window, kept generic: - `IChatWindowContent.bind(window, instantiationService)`: called once the window's services exist, before its parts show anything, such as to show the session of the window and bind its keys on the window's context; - the look facet's options of the main part: part options that override the user's settings there (`mainPartOptions`, enforced live) and the options of its groups (`mainPartGroupViewOptions`), such as the menus and modern tabs of the main window's editor area; - a content part takes the options of its groups at creation (`groupViewOptions`, an ordinary option any part can use); - a chat window is an auxiliary window: its context sets `isAuxiliaryWindow`, so that what applies to the main window only, such as its panel and side panel toggles, does not apply there. Carries the chat window's test for moving the main window's editors into a chat window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the Agents provider of chat windows Registers the provider of chat windows for the Agents window (SessionsChatWindowProvider), on the chat window seam of the workbench: - content: a session or a chat resolves to the chat the window shows (the one asked for, else the one the session shows in the grid, else its main chat), shown as the `sessions.chat` view editor; once the window exists the session shows in it as a window session (showSessionInWindow), with its loaded chat model held across the move (ChatModelHold); the window acts on that session (ISessionScope) and binds its keys on the window's context (session keys, including sessionHasWorkspace and isQuickChatSession, hasWorktreeAndRepository, isAgentHostSession); the session view registers as the window's session view, which focuses its window and its chat; a focused window activates its session; the title is the chat's, or the session's; the window ends when its chat is deleted or archived, follows a replaced session, and stops showing its session as it closes; - chrome: the title bar as the window's title row, which shows the session header in place of the chat's title, with its actions centered above the Session Activity Bar's column (only with a custom title bar); and the column the Session Activity Bar shows in while the chat is below the main part or hidden; - look: the gap between cards per density (none in compact), cards, the chat background behind the chat (SessionsChatSurface), and the main part as the main window's editor area: its menus and modern tabs, `showTabs: none` as one tab, no group sizing on a double click; - move to the main window: the chat or session opens there again with the window's editors once the main window is laid out for it; - restore: after the main window restored, a chat restores while its session loads within 30s and the chat is not gone; only while `sessions.chatWindows.enabled` is on and AI features show; the chats of removed sessions are forgotten. The editor parts of other windows show whether the main window's editor part shows or not. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: entry points of chat windows, behind sessions.chatWindows.enabled Registers `sessions.chatWindows.enabled` (experimental, off by default), which gates the entry points only: - Open in New Window on a session (sessions list, session header) and on a chat of the sessions list, and Open Chat in New Window (Command Palette); the chat takes the main window's editors along only while the main window shows that chat; - Move to Main Window in the session header of a chat window and the Command Palette; - the accessibility help of the Agents chat describes chat windows while the setting is on. In windows with layout modes (the generic `layoutMode` key is set), without chat-window keys: - the Layout menu (Show Chat, Show Editor, Stacked, checked on the generic keys) and the buttons of its actions, in the title bar, or in the Session Activity Bar while the strip shows the layout actions; the user shows and hides the buttons with the toolbar's own hide/show state, Show Editor showing by default, in place of the promoted-button keys; - the Changes, Files and Browser entries of the Session Activity Bar and of Add Tab open in the main part of the window that has focus, checked while it shows them; Changes and Files need a session with a workspace; - an empty main part has one close button, which shows only the chat; the main window's Close Editor Area stays out of these windows; - Run and Open in VS Code show in the title bar of a window that shows a session with a workspace, as in the main window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: banners and agent feedback show the session of their window Carried from the chat windows work, on the session scope a chat window gives its parts: - the pull request and agent comment banners above a chat's input read the session of their window (ISessionScope): a chat window's own session, and in the main window its session (mainWindowActiveSession), which is the active session whenever no chat window has focus; - agent feedback in the editors of a part other than the main one, such as a chat window's main part, belongs to the session of that part's window whichever session is active; not for floating editor windows, which have the main window's session scope. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: on the part grid A chat window lays out its cells on the workbench's part grid instead of the interim placement: - `ChatWindowGrid` arranges the title row, the chat part, the main part and the strip for the layout mode, as chat windows always did: side by side and chat only with the title row above the chat's column and the main part running to the top of the window; stacked and editor only with the title row across the window and the strip in a column of its own at the right. The part a mode hides stays in the grid; the grid hides a part with no editors. - The parts open with the shares they always had (the main part wider and taller than the chat); the title row and the strip are as large as their chrome says. Sashes let the user size the parts, and the sizes are kept per arrangement, so that a mode shows with the sizes it had, and per chat across reloads (the chat sizes storage chat windows always used). - The look facet's `className` replaces `cards`: the Agents provider styles the cards of the grid (`--part-grid-card-*`) as the main window's, with the main part's card on the editor background and none in compact density; the gap is the floating-panel gap, 0 in compact density. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the part that holds a window's terminals A chat window gets a part that holds its terminals, in its part grid, and the generic per-window keys that describe it: - `terminalsVisible` and `terminalsPosition` (workbench/common/contextkeys.ts, next to `layoutMode` and `splitLayout`): whether the window shows the part that holds its terminals, and where that part sits ('underChat', 'underEditor', 'fullWidth'). They are bound on the window's own context by the window shell, and unset in windows without such a part. - `IChatWindow.getOrCreateTerminalsPart()` creates the part the first time, as a cell of the window's part grid at the terminal position: below the chat, below the main part, or across the bottom of the window; across the bottom of the chat and the main part while stacked (the strip runs past it), and below the strip in editor only. Like every part, it hides while it has no editors; `terminalsVisible` follows the cell. What it shows is what the feature that shows terminals opens in it. - `IChatWindow.setTerminalPosition()` moves the part's cell in the grid (`PartGrid.moveCell`), keeping its height; changing the layout mode rebuilds the grid with the part where the topology puts it. - The terminals keep their height as the window is resized: the other parts take what it grows or shrinks by. Tall terminals give way first in an arrangement they did not show in yet, so that the chat and the main part keep their heights. The terminals' sizes are remembered per arrangement and across them, with the window's other sizes. - `IChatWindow.onWillClose` fires as the window closes (once its chat and main parts closed) or as its window unloads, before the part that holds its terminals closes, so that terminals can leave the window still running. - The part takes the look's main part options (tabs as in the main part). - Restoring: a window stores whether it showed its terminals, and opening it with `showTerminals` creates the part for the terminals feature to fill. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: terminals in chat windows, in the part that holds them The sessions terminals open the terminal of a chat window's session into the part of the window that holds its terminals (ChatWindowTerminals, created by ChatWindowTerminalsContribution), rather than through a terminal host that the window calls: - Shown, a window shows the terminals it showed, else a terminal of its session that no other chat window shows, else a new one in the session's working directory. The terminal is created at the view column of the window's part, directly in the window, so that nothing flashes in the main window, and is not moved again. - The panel leaves a terminal to the chat window while it shows there (SessionsTerminalContribution.setShownInChatWindow): it is neither made visible nor the panel's active terminal for the session. - Hidden, the window's terminals go back to the background of the panel, still running, so that the part that holds them is empty and hides; focus in them stays in the window. Closing their last terminal hides the part too, and a move does not: both are the part grid's rule for a part without editors. As the window closes (`IChatWindow.onWillClose`) its terminals are released the same way, back to their session. - New Terminal or Split in the part makes the new terminal the window's; a terminal opened in the window's main part moves to the part that holds the terminals; a terminal handed to a window, such as the terminal of a task, shows beside the others. - A window restored with its terminals shows them again: the window creates the part that holds them as it opens, and the terminals fill it. - A file opened from a terminal opens in the main part of the window it is opened from (TerminalLocalFileLinkOpener): when the active group is in another part of its window than the window's main part, such as the part that holds a chat window's terminals, the file goes to the window's main part. Elsewhere, including the modal editor part, nothing changes. - `IChatWindow.terminalsPart` is an `IContentPart`, which has its element. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the terminal commands of chat windows The commands of a chat window's terminals, in the Agents window, while AI features are enabled and in a window with layout modes, on generic keys only (`IsSessionsWindowContext`, `chat.enabled`, `layoutMode`, `terminalsVisible`, `terminalsPosition`, `activeEditor`): - Toggle Terminal in Chat Window (workbench.action.chatWindow.toggleTerminal) with the panel and terminal keys (Cmd+J, Ctrl+`), above the main window's rules for them wherever the focus is in the chat window, and never sent to the shell (terminal skip-list). Checked by `terminalsVisible`. It is the Terminal entry of the Session Activity Bar of a chat window. - The Terminal entry of Add Tab (workbench.action.chatWindow.addTerminal): adds a terminal to the terminals that show one, else shows them. - Terminal Position (Full Width, Under Editor, Under Chat) in the More Actions of the terminals and in the context menu of their tabs, recognized by the active editor of the group, a terminal; checked by `terminalsPosition`; unavailable while Stacked. - Toggle Editor in Chat Window (workbench.action.chatWindow.toggleEditorByKey) with the side panel key (Cmd+Alt+B): hides the main part, leaving the chat, and shows it again as it showed with the chat; also skipped by the shell. The commands act on the window of the editor group they are invoked from, such as the terminals' title, else on the chat window that has focus (`resolveChatWindow`). The terminals of chat windows are a service of the Agents window (IChatWindowTerminalsService), which the commands use and a contribution creates at startup, so that restored windows show their terminals again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the Changes editor is the same in every window The Changes editor of a chat window, which shows in the window's main part, now offers what the main window's offers and acts on the session of its window: - Its actions are in the "…" of its tab row in every window. Its title actions read MainEditorAreaVisibleContext as each part binds it (the main window for its editor area, a chat window for its main part) in place of excluding auxiliary windows; the Create Pull Request bar shows by the existing per-window keys (IsSessionsWindowContext, !CustomViewVisible, DesktopLayout, SessionIsCreated). - Each changeset operation is registered once, with the command ids of the main window, while any scope shows it. Two generic per-scope keys, sessions.changesetOperations and sessions.changesetOperationsEnabled, bound through registerSessionActionContextKeyBinder for every scope that shows a session's Changes, decide where it shows and whether it is enabled. Its run resolves the session from the Changes editor it is invoked from: the file toolbar passes { session, editor }, the title passes its editor context. Open File, Expand/Collapse Unchanged Regions, Mark as Viewed and Collapse/Expand All Diffs act on that editor too. - The chat window's provider binds the keys of the session it shows, and of its changes, on the window's context with bindSessionScopeContextKeys, as the main window binds those of its own session; no chat window contribution or key is involved. - A Changes tab is closable while the part that shows it is visible: the main window's editor area for its part, MainEditorAreaVisibleContext of the part otherwise. - Opening the Changes editor of a chat with a changeset selection finds the session of the window that shows that chat (findSessionByChatOrResource). Carried from #344666 (CW2 version), without its ChatWindowChangesetActionsContribution and chat window keys. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: type fixes in tests of terminals and Changes The tests of chat window terminals, of the Changes editor input and of the Agent Merge actions typecheck: an explicit type for a self-referencing parts list, the changeset operations the session observables now carry, and a generic invokeFunction in a test stub. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the part fakes of grid tests can be shown and hidden The part grid now tells a content part whether it shows (IContentPart.setVisible); the fake parts of the chat window grid tests take it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: keep the main window's outer insets to the window edges The cards of a chat window ran to the edges of its window (feedback on 491817); the main Agents window keeps a gap between its cards and the window edges. The look facet gains `outerInsets`, which the window's grid keeps to the edges of the window, also as it changes its arrangement; its cells share what is inside them. The Agents provider keeps the floating-panel gap to the right, bottom and left edges, none in compact density, and none at the top, where the title row is, as the main window's title bar is. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the main window's editors move in before the chat leaves the main window Open in New Window did not bring the editors the main window showed for the chat: binding the window's content shows the chat's session in the chat window, which takes it out of the main window together with the editors the main window showed for it, before they moved. They now move into the window's main part first, as chat windows always did. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the session header leaves its window's title row with its chat view A chat moved between groups showed the session header twice in the title row of its window: the view editor creates a new view for the chat where it moves to, and the old view's header stayed in the title row after the view went away. A session chat view now takes its header out of the host it shows in when it is disposed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: Run and Open in Editor follow the main window's rule in every Agents window The title bar's Run and Open in Editor showed in a chat window only while its session had a workspace and was not a quick chat (SessionTitleBarActionsShownContext). They now follow the main window's rule everywhere (user decision): no workspace check. Their expressions keep the main window's `!isAuxiliaryWindow` and add the generic `layoutMode` window key, set in windows with layout modes, so that they show in the main window and in chat windows, and not in editor windows, which have no session. No key exists that is true exactly in windows with a session, and none is added. SessionTitleBarActionsShownContext is removed. Intended difference from 491817: Run and Open in Editor show in a chat window also for a session without a workspace or a quick chat, as in the main window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: a chat keeps where it is scrolled to when its editor moves When the chat editor of a chat window moves, such as to another group, the view editor creates a view for it where it moves to, which shows the chat as it was last saved; the old view saved it only when disposed, after the new one loaded. The session chat view now saves what its chat shows when its pane asks, before the editor leaves it (IViewEditorView.saveViewState): chat views can save their view state (AbstractChatView.saveViewState), which the sessions chat view does as it does when disposed. The input's draft lives on the chat's model, which both views share. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: a chat editor moved out of its window takes the chat out of it A chat's editor moved into another window, such as dragged into the main window's editor area or moved into a new window, stayed there as a plain view editor, and its chat window only followed the groups its chat part had when it opened. The chat window now follows the chat's editor in every group of its chat part, also those added later, such as when the part splits, and closes when it closes there. When the editor moves out of the window, the editor closes where it moved to and the chat follows the user decision: into the main window, it moves to the main window as Move to Main Window does; into another window, it shows in a chat window of its own again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: close the window once the chat's editor closed Cmd+W in the chat of a chat window closes the chat's editor, which closes the window. The window closed its parts while the chat part's group was still closing the editor, so the editor close continued on a closed part: an error notification showed in the main window and the extension host received editor tabs without an active group. The window now closes once the editor closed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: chat window tests follow the Run rule and the strip's Terminal entry The editor area test expected Run and Open in VS Code in chat windows only for sessions with a workspace; they follow the main window's rule in every chat window now. The contribution test picked the strip's layout entries by a prefix that the Terminal entry of the strip also has. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chatWindow: title row and chat are one card side by side and in chat only Side by side and in chat only, the title row is the header of the chat's card, in the chat's cell of the grid, as in today's chat window: no card edge between the title and the chat. Stacked and in editor only, it stays a row of its own across the window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: chat window title row as tall as the main part's row of tabs The title row takes the height of the row of tabs of the window's main part, its card's frame included, in every layout: while the main part does not show, the height it last showed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: chat window title row across the window with the chats as tabs With the chats of the session as tabs, which replace the session header, the title row of a chat window is a row across the window, as the main window's title bar is, side by side and in chat only too; with a single chat it is the header of the chat's card again. The title row says so with the generic headsChat of a chrome element. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: one title row at a time, the window's across the top or the chat view's own, as tall as the row of tabs A chat window has two places for its title, and shows one at a time. The title bar part is a row across the top of the window, which shows and hides as a cell of its grid: stacked, in editor only, and with the chats of the session as tabs. With a single chat, side by side and in chat only, the chat view shows its own title row at the top of the chat's card instead, one surface with the chat. Both are as tall as the row of tabs of an editor part, from the first frame and in every layout, rather than measured from the main part. The classes of the window go on its own element, as those of the container of an auxiliary window follow the main window's, and the window lays out again once its styles have loaded. This replaces the title row in the chat's cell and the measured height of the previous commits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: chat windows look as they did The chat view is styled as the session views of the Agents window are (sessions-window-host). The cards draw the frames of the parts in them, the chat's card is the chat's surface, and the group of the part that holds the chat draws no frame of its own. The cards keep no gap to the edges of the window. The native title bar of a chat window shows its layout actions, and windows with layout modes show no Always on Top. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: frames, gaps, strip and title rows as before The main part shows without editors, as it did. The title row of the window keeps no gap to the cards below it. The chat view's own title reaches over the gap beside the chat's card, so that its actions are where they were. The groups of the main part draw their frames, and the session view the chat's, but while the chat shows its own title row, which the chat's card frames with it. The strip's column holds the gap beside it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * editor: no Lock Group or Close Group in the empty groups of windows with layout modes An empty group of an auxiliary window offers to lock or close it, which closes an editor window: a window with layout modes, such as a chat window, shows more than its editors, and its empty groups offer neither, as before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: close with the workbench, such as as it reloads A chat window closes as the workbench shuts down, after the windows to restore were saved, as editor windows do: reloading left the window open beside the one that restored. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the main window's padding, the window controls in the title row The cards keep the gaps of the main window's to the edges of the window, but at its top, where the title row is, as the user asked, rather than none as before: the chat leaves its frame to the session view in its card, or, while it shows its own title row, frames both, so that the frames are where the main window's are. The chat's own title row reaches to the edges of the window, under its window controls, and only the title row that shows places them: one laid out without height while it is hidden moved them to the top edge of the window. Its negative top margin no longer moves the chat with it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: Terminal Position in the menus of the terminals of a chat window The menus of an editor group read the id of its active editor pane, which for a terminal is the terminal editor's, not the id of its input: Terminal Position never showed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the terminals of a chat window line up with its other cards The groups of the terminals draw their frames with connected tabs, as the main part's do: their card leaves its frame to them, so that it is as wide as the cards beside it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * terminal: recreate the WebGL renderer once a terminal shows in another window The canvas of the WebGL renderer loses its context in another window than the one it was created in, without the renderer falling back: a terminal that moved to an auxiliary window, such as one restored into a chat window, showed a lost canvas. Attaching the terminal to a container in another window recreates the renderer there. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the terminals of a chat window framed as the main window's panel The terminals' card draws its frame at its edges, as the main window's panel does, rather than the groups of the terminals inside it: their frame was missing at the edges of the window and doubled at its sides. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: disable hiding the part that shows alone in the chat window Layout menu The Layout menu entries are menu items of their own, which don't carry the preconditions of the actions: Show Chat stayed enabled in Chat Only and Show Editor in Editor Only. Give them the same preconditions, as 491817 does. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: window-scoped actions act on the chat window's session A chat window's session became the active session only once focus moved into its session view, so its title row actions (Open in VS Code, the Run dropdown) and its tab entries acted on the main window's session. Its session now becomes the active session as its window gains focus, without moving focus, and those actions take the session from the window's own session scope. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: no New Session title bar button in chat windows The button stands in for the main window's sessions list while it is hidden, and a chat window inherited the main window's sideBarVisible key, so it showed in a chat window's title too. It now shows in the main window only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: no lock action in the title of the part that holds the terminals Terminal groups lock as terminals open in them, which keeps other editors out of the part that holds a chat window's terminals, but its title then offered Unlock Group, which the main window's panel does not. A generic editor group view option, hideLockActions, hides the lock and unlock actions of the groups of a part; the terminals part uses it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: keep the editors and terminals of a chat window whose chat moved to another window As the chat's editor moved out of a chat window into another window than the main window, the window closed and the chat opened in a new chat window without the editors of its main part and its terminals. They now show there again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: no second Changes tab in a chat window A Changes editor that moved into a chat window with its chat, or that a restart restored, is the Changes editor of the session rather than of the chat, so the Changes entry did not find it and opened another. It now activates any Changes tab of the window's session. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: a chat window no longer sets the title of the main window The title bar of a chat window set the document title of the window it was in, and the title row of the chat view is created before it is in its window, so it set the main window's title to the chat's, where it stayed. The title of a window is now its owner's: the chat window service sets it for its window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: a title bar looks active while the window it is in is active A title bar took the window to follow for its active look as it was created, so the title row of a chat view, created before it is in its chat window, followed the main window: it looked inactive in a focused chat window. It now follows the window it is in as the active window changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: pin closing the editor area with the terminals under the editor Close Editor Area shows only the chat. With the terminals under the editor they stay, across the window and as tall, rather than going away with the main part, and go back under the editor as it shows again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the first open of a chat with no editor to bring along shows only the chat As 491817 does: a chat that shows in a chat window for the first time, with no editor in its main part, opens in Chat Only rather than with an empty main part, without changing what is remembered, so that a mode the user chooses for the chat shows again. Also pins that an editor dropped beside the chat, which splits the chat part and empties the main part, changes no mode. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: keep the sizes of the parts across mode round trips and part moves - The terminals moved between arrangements take their height once the cells beside them show: resized while the main part was still hidden, it took a share of their height as it showed (200 -> 270 after Chat Only and back). - Sizes are remembered for an arrangement only while the part grid still shows it as the window arranged it: after a part moved, such as with Move Part, the chat across the window was remembered as its width side by side, and the main part came back at its minimum. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: pin the widths of the chat and the main part over QA's second split sequence Terminal position walk, terminals hidden and shown, Chat Only and back, a resize and a change of density keep the chat at the width the user gave it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: Side by Side never comes back with the side part at its minimum Chat Only and Side by Side share an arrangement, but in Chat Only the chat takes the room of the hidden side part: its full width, saved as the window saved its state, was remembered for Side by Side, and the side part came back at its minimum. - Sizes are remembered per arrangement and per part it hides, and before every change of mode, so that the split the user had is saved before a part move. - A remembered size that leaves the other parts less than their minimum, such as one stored by earlier builds, gives way to the default share. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the terminals keep the height the user gave them in every mode The terminals drifted taller across mode round trips (199 -> 286 -> 232 -> 265): - the title row took no room as soon as it hid, before the grid arranged the mode, and its room went to the terminals, which was then remembered; - the height remembered per arrangement won over the one the user last gave; - a rebuilt grid gave the room of a hidden title row to the terminals. The title row now shows and hides only with the grid, the user's last height applies in every mode, and the terminals take it once the cells show or hide. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: a chat view that disposes creates no title row Closing a chat window logged 'InstantiationService has been disposed': as the view disposed, its window changed, and the derived of its own title row ran again, creating a title bar part with the services the view had disposed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the split and the terminals come back as they were after a restart A restored chat window shows without its terminals until they are restored: the arrangement without them had no sizes remembered, so the chat and the main part took their default shares, and the terminals, which join empty, showed at a size of their own. The sizes of the chat and the main part are also remembered for the arrangement without the terminals, and the terminals take their height when their first terminal shows. Pins QA's second INFO-2 walk through every mode. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: a change of density restores the exact gaps and insets of the cards - The gap was not followed: read behind the grid, which did not exist yet as it was first read, so a change of density changed it only once the grid rebuilt. - The cards read the frames their insets leave room for as the gap changes, maybe before the styles of the new density apply: the grid lays out again on the next frame, so that a density round trip gives the cards their exact size back (QA: 476/714 -> 475/713 after compact and back). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the terminals keep the user's height when the chat changes size with the mode QA (Beta): terminals sized 199, then Stacked 286, Side by Side 286, Editor Only 72. While stacked the chat shows only its input, as tall as it exactly, and its size changes before the grid arranges the new mode: the row of the old mode was squeezed, the terminals took the room, and that was remembered as the height the user gave them; then, taller than their share, they gave way in Editor Only. - What shows is remembered as soon as what arranges it changes, before anything reacts to the change. - The main part takes the rest of a column or a row, not the chat, which may be only as tall as its input. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: read the app region of the title bar only where the browser computes it The browser runner of the Insider build failed the test of a click on a hosted session header: a headless browser may not compute -webkit-app-region, as Electron does. What a click reaches is still checked everywhere. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: remember only the sizes the user gives the parts The window remembered the sizes its cells showed with as the mode changed, as it saved its state, or as it went: sizes the grid had forced, such as the least width of a chat part that holds an editor, or the terminals as a mode showed, came back as the user's (QA: terminals dragged to 199 came back 286, then 72; a forced 502/688 split stayed after the editor left the chat part). - Sizes are remembered only when the user drags or resets a sash: of the cells it changed, the terminals' height for every mode, the chat's and the main part's for the arrangement. - The terminals take the height the user last gave them, else their share of the window, in every mode. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the strip's entries act on the window they are in, at the first click The Session Activity Bar ran its entries without naming its window, so the chat window commands they run, such as Terminal, the tabs and the layout, acted on the window that has focus. A click in a chat window that does not have focus yet runs before it does: the first click acted on no window, or another, and only the second one on the window. In a window with layout modes the strip now runs its entries with the window it is in, and those commands act on the window named. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: a canvas opened from a chat window opens in that window While the active group was outside the main window, a canvas opened in the main part of the main window, as for a canvas opened from an auxiliary window. Opened from a chat window, which shows its own editors, it now opens in the main part of that chat window: in the group that has it already, else in the active group. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat pills: the dropdown of a pill shows in the window of the pill The dropdown of a pill, such as the References or Pull Requests pill of a chat, showed in the window that had focus. For a pill of a chat window that is not focused yet, that was another window: an entry picked there acted from that window, so a pull request opened in the main window. It now shows in the window of the pill. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: sizes stored by earlier builds are not read Earlier builds stored the sizes the parts showed with, including those the window forced them to, such as terminals squeezed to 123: they came back as the user's. The sizes the user gives the parts are now stored under a key of their own, and those of the old key are removed, so that the parts take their defaults once. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: no agent feedback overlay on the chat of a chat window The navigation of the session's feedback (1/4) showed over the chat input of a chat window: in a window that shows a session of its own, every resource maps to that session, also that of the chat, a view shown as an editor. An editor that shows no file, such as a view, has no feedback overlay, as the chat of the main window has none. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: opening a chat in a window keeps the main window's side pane The editors of the main window moving to the chat window emptied its editor part, which the Agents layout took for the user closing them, and closed the side pane: it stayed closed for every session the main window showed next, until the chat window closed. While they move, the editor part's automatic visibility is suppressed, as it is when the main window switches sessions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: type the editor part of the side pane test of chat windows Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: a title row of a chat window gives up the traffic-light inset in full screen A title bar followed the full screen state of the window it was created in: the title rows of a chat window, created before they are in it, followed the main window, and kept the room of the traffic lights while the chat window was in full screen. It now follows the window it is in, as it moves there and as it is laid out. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * canvases: a chat window shows the canvases of its own chat Opening a canvas in a chat window failed: a canvas editor, and moving a canvas, accepted only groups of the main window. A canvas context service may now present canvases of an owner in groups outside the main window, and keep them presented outside the main window's working sets; the Agents one does so for a chat window and the chat it shows. Other windows keep the main-window-only rule. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the Changes editor of a chat window shows the changed files list The changed files list of the Changes editor shows where its host enables it: a chat window enables it on its context, which all its parts inherit, so its Changes editor shows the list wherever it shows; the main window does not. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the tab rows at the top of a chat window move the window In a chat window, the empty space of the tab row of a part at the top of the window moves the window, as the window's title row does: its tabs, actions and other controls keep their clicks and drags, and while something is dragged the row takes the drop. The part grid marks the cells at its top edge, and the groups at the top of their parts there, as the parts move, split, show and hide. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: Developer: Reset Chat Window Layout Lays out the chat window it runs in as it first opens: it forgets the layout and sizes remembered for its chat, the sizes the user gave its parts and the parts moved in it, and shows only the chat while its main part has no editors, else the chat and the editor side by side at their default shares. Other chat windows and the main window keep theirs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: Reset Chat Window Layout also puts the terminals across the window Where the terminals of a chat window show is part of its layout: the reset shows them across the window, as chat windows do until the user chooses, without changing where those of other chat windows show. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: a layout command moves the chat back into the chat part first A chat dropped onto the middle of another part of its window shows as a tab of that part, and its chat part hides as empty. A layout command shows the parts of the window as the chat part showing the chat: it moves the chat's editor back into the chat part first, so that the chat never hides with the part it is in. The main part showing as an editor opens in it moves nothing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the Changes editor of a chat window shows its actions in the header row too The main part of a chat window takes the header row's secondary menu of the main window's editor area, where the Changes editor shows Run Code Review, its More Actions and Toggle Files, as the main window does. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the chat's editor merged into another part still closes or moves the window out Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! chat windows: the tab rows at the top of a chat window move the window A double-click on the empty space of a tab row at the top edge of a chat window does what one on the title bar does (restores INativeHostService.handleTitleDoubleClick) instead of opening an untitled editor. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! canvases: a chat window shows the canvases of its own chat The owner of a canvas a chat window shows is visible and has a context whichever window has focus; the main window's canvases follow the main window's session rather than the focused window's. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * integration: stub the session scope, chat resource and layout service in main's newer tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: a title row of a chat window gives up the traffic-light inset in full screen An auxiliary window in full screen below the camera notch of its display is less tall than its screen: it counts as full screen while it spans the width of its screen. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! chat windows: the main window's padding, the window controls in the title row The tab row at the top right of a chat window keeps the room of the window controls that float above it beside the chat's own title (Windows, Linux), by new generic part grid markers for the right edge. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: the terminal commands of chat windows The side panel's command toggles the editor of the chat window it runs in, whatever key the user binds to it, instead of a separate command with a copy of its default key. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: the chat of a session as a view editor The suggest widget of a chat input shows in the window of the chat. A chat can render before it is attached, such as the chat of a chat window, whose view editor creates its view before attaching it. Its input's overflow widgets element then went into the main window's container, so the completions of /, @ and # showed in the main window instead of the chat window. The element now moves into the container of the window that the chat lays out in. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: the terminal commands of chat windows Type the context of the side panel's keybinding test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: the chat of a session as a view editor The session state indicator of a chat updates as the window that the chat shows in loses focus, rather than the window it rendered in, which for the chat of a chat window is the main window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: the terminal commands of chat windows A terminal in a window with layout modes, such as a chat window, does not offer to move into the panel, which is the main window's: the window keeps its terminals in a part of its own. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: share the chat background surface beyond the Sessions part Test that the confetti button of a surface outside the Sessions part has its hit area. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! chat windows: a change of density restores the exact gaps and insets of the cards The part grid reads the frames of the cards again only when asked to: once the styles of the density apply, it updates its look before the window lays out. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: terminals in chat windows, in the part that holds them Find the main part of the window with getWindowMainPart. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: let session actions act on a given session The skill buttons of an agent-host session run their skill in the chat of the session they are given, such as the chat a chat window shows, rather than in the main chat of the active session. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: let session actions act on a given session The resource of a session that an action is given, such as by the Changes toolbar of a chat window, names the session of the chat window that has focus when that window shows it, rather than the main window's session of the same resource: its window has focus as the action runs, before the active session follows it. Extension commands of the toolbar keep receiving the resource. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: show sessions outside the Sessions part grid Focus moving into a window of its own activates its session passively, as focus moving back activates the main window's: what the main window restores, opens and shows, such as its canvas, goes on, and no navigation is recorded. A chat the main window opens finds its chat in the session it opened, also once focus moved into another window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: terminals in chat windows, in the part that holds them - A terminal added in a chat window is a terminal of its session, in its working directory, with its profile, tracked for it, rather than one with the main window's defaults. - A window that closes, or whose terminals hide, while a terminal is created for it does not take it: nothing moves into it, no listener stays, and the terminal stays with its session. The group it opens in is that of the part once the terminal is there. - A terminal a chat window takes is marked as taken at once, so that another chat window asking meanwhile does not take it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: the Agents provider of chat windows Only the editor parts of a window built of content parts, such as a chat window, show whether the main window's editor part shows or not; those of editor windows follow it, as before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: chrome hosts for windows of their own The title bar of an editor window reads the keys of the main window's session again, as before, and so shows its session actions; a chat window binds the keys of its own session on its window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: no New Session title bar button in chat windows New Chat hides from the title bar only in a window with layout modes, such as a chat window; editor windows show it as before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: a title row of a chat window gives up the traffic-light inset in full screen An auxiliary window counts as full screen while flagged so and covering its screen but for the area of a camera notch above it, so that a wrong flag on a narrower or much shorter window keeps the space of the traffic lights. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! chat windows: the chat window service and its window, on content parts - A window that goes away while it opens, such as one the user closes, is not added as a chat window: its unload is handled from before what the opening waits for. - Closing a window closes its main part first: when an editor of it cannot move to the main window, the window stays as it was, its chat too. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: terminals in chat windows, in the part that holds them A link in the terminals of a window opens the file where the window shows it already, as revealIfOpened does without a group, else in the window's main part. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: entry points of chat windows, behind sessions.chatWindows.enabled Move to Main Window acts on the window it is run from, such as by a control of a window that does not have focus yet. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! chat windows: layout commands on the generic window layout keys - Toggle Chat Conversation acts on the window it is run from. - Showing the editor again by the side panel's command announces the layout, as hiding it does. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! chat windows: the tab rows at the top of a chat window move the window The double-click of a tab row at the top of a chat window routes to the title bar's action only with the custom title bar, and only reaches the window where the OS does not take the row as its caption, so that only one of them acts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: let session actions act on a given session Type the scoped instantiation service of the test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! sessions: terminals in chat windows, in the part that holds them Type the editors the test finds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: drag and drop between parts (#345685) * Parts drag and drop: editors between parts, and edge splits over views that handle drops Editors, including a view shown as an editor, drag from one part into another part of the window and split a part when dropped on its edge (D1, D2): - content registered as handling its drops (`registerContentDropTarget`), such as a chat view, keeps the drops in its center; editors and groups dragged over it still get the edge zones of its group. Other drags (files) are the content's everywhere; - an input drop target, such as a chat input, takes every drop on it, also at an edge of the group, as before; - a view shown as an editor can offer a drag handle, such as its title row, that drags its editor with the same transfer as a tab (a singleton moves); the handle owns its drag and does not start one from its text fields; - a drop that moves an editor into another part of the same window is announced; - Move Editor to Part... moves the active editor into a part picked from the other parts of its window (Agents window only for now). The editor area of a window with one part behaves as before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Parts drag and drop: drag a part to rearrange the window, and Move Part commands A part drags by the grabber on the top edge of its card, which shows while the card is hovered (D3). Over the window, a drop indicator shows where it goes: - near an edge of the window, to that edge of the window; - over another part, beside it on its side nearest to the pointer; - over itself, nowhere. The parts in the grid do not take the drag of a part, and the move is announced. Move Part Left/Right/Up/Down move the active part past the part beside it, or to that edge of the window (Agents window only for now). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Parts drag and drop: an editor dropped on an edge of the window goes into a new part An editor dropped on an edge of the window, outside the parts, goes into a new part at that edge (D4), with a drop indicator while it is dragged there. The owner of the part grid creates such parts through a part factory; without one, editors do not go into new parts. A part the grid created closes once its last editor closes (also after a restore), while the owner's own parts hide as before. Move Editor into New Part Left/Right/Above/Below move the active editor into a new part beside its part (Agents window only for now). The part grid now takes the editor groups service, to move the editors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Parts drag and drop: chat windows create the parts for editors dropped on their edges `ChatWindowPartFactory` creates the parts that a chat window's part grid adds, such as for an editor dropped on an edge of the window (D4): like the window's main part, with the window's services and the provider's look for the main part, and closed with the window. It goes to the window's part grid with `PartGrid.setPartFactory`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Parts drag and drop: drag a chat into a chat window, and move the chat between parts A chat whose drag ends outside the windows opens in a chat window where the drag ended (D5), like a tab dragged out of the window opens a new window: - from a chat tab, a chat row of the sessions list, a session row of the sessions list or the session header of the main window (a session stands for the chat it shows), which report the end of their drag to the handler the chat windows register; - the main window's editors go with the chat as with Open in New Window; - over a window, with chat windows not enabled (or AI features hidden), or without a chat window provider, nothing changes; - the opening is announced. A chat window opens at the bounds it is given (`IChatWindowOpenOptions.bounds`). The chat of a chat window drags by the session title of its header, also while the header shows in the title row of its window, where the rest of the header still moves the window (D1). Its own text fields, such as a rename, keep the mouse. The chat handles what is dropped on it, such as files to attach, while editors dropped on the edges of its part split it. Where a new window opens for a drag that ended outside the windows is now shared from the workbench's drag and drop helpers; tabs and groups dragged out of the window open where they did before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops * fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges * fixup! Parts drag and drop: drag a chat into a chat window, and move the chat between parts * fixup! Parts drag and drop: drag a chat into a chat window, and move the chat between parts fixup! Parts drag and drop: drag a chat into a chat window, and move the chat between parts The window's title row shows whenever the chat does not lead the window: moved into another part or after another part. Window edges are the edges of the parts, under the title row. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part The window edges for D4 and part drags are those of the parts: below the title row, which is an OS drag region across the top of the window, and the outer insets count as the edge. The grid tests from the base pass the editor groups service. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part The grid test from the base that keeps cells inside the outer insets passes the editor groups service. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops BUG-5: over content that handles drops, the edge overlay shows for the drag that creates it and that drag does not reach the content, so the content does not show its own feedback there; an overlay that shows takes its drop, also before any drag moved over it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands BUG-8: Move Part to the edge a part is at already leaves the parts, their sizes and the focus as they are. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a chat into a chat window, and move the chat between parts fixup! Parts drag and drop: drag a chat into a chat window, and move the chat between parts The chat leads the window from the first group of the chat part only: with a group split off to its left, the window's title row shows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops BUG-7: test that content showing its own drop feedback gets the leave of a drag that leaves it, directly or through the edge overlay. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges A part the grid creates or closes keeps the arrangement the window's, so its sizes are remembered, unless something else changed the arrangement first. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part Drop the part cell shown through a view of its owner: the chat is a plain part cell again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands QA FAIL #1: Move Part keeps the sizes of the other parts and the moved part takes the rest, so moving it back restores the layout. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a chat into a chat window, and move the chat between parts fixup! Parts drag and drop: drag a chat into a chat window, and move the chat between parts QA FAIL #4: the groups of a chat window's chat part besides the chat's, such as an editor split beside the chat, are stored with the window and restored in place, with the chat back in its own group. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges The grid tests from the base pass the part factory and the editor groups service. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a chat into a chat window, and move the chat between parts fixup! Parts drag and drop: drag a chat into a chat window, and move the chat between parts A stored chat part is checked as the window restores, and a chat group the part no longer has falls back to the active group. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges The density grid tests from the base pass the part factory and the editor groups service. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part A part created at an edge of the window takes its room from the part the editors come from, so the other parts, such as the terminals, keep their sizes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges The created parts of a rearranged chat window take their room from the main part, or else the chat, so the terminals keep their height. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges Type fixes after the rebase: a readonly copy, and the new base test passes the part factory and the editor groups service. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part The cells of the parts the grid created are marked (data-part-grid-created), so that a look can frame them as the parts they are like. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges The cards of created parts look like the main part's, frame included, so their edges line up with it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops The view editor drop test aims at the view, not at the group, which a browser lays out taller than the view. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges The sizes tests of created parts resize as the user does, by a sash, which is what the window remembers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part The cell of a part split into groups is marked (data-part-grid-split), so that a look can frame the part once, as one card. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges A part split into groups is one card in a chat window: its card frames its groups once, and the groups and the chat in them draw no frames of their own. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands A dragged part shows where it goes as a whole card: its slot after the move, from a dry run of the move, or, dropped on the center of another part, the whole part it merges into. Parts merge unless the window says they do not. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges The parts of a chat window do not merge, and the preview of a move shows the title row as the window will show it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands Cards move: while a part is dragged beside another, the other cells slide aside to where the drop puts them (from a dry run of the move) and its slot opens; they slide back as the drag leaves or ends, and a drop commits them in place. Every move glides from where the cells were (FLIP). Cells move by transforms, clipped as they get smaller; cards with native content move as plain cards, under which integrated browsers give way. No motion without monaco-enable-motion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands No reflow while a card is dragged (user decision): the cards stay put and the slot preview shows where it goes, as before. Only the move glides, one FLIP per move: drops and the Move Part commands. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands The slot of a dragged part is found by a dry run once for each place it would go, not on every dragover. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands The empty space of the title of a group that is not at the top edge of the window (no part-grid-top-edge-group, where the title moves the window) drags its part, as the drag handle does. Tabs still drag their editors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands Test: a tab still drags its editor, and the drag handle its part. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges Resetting a chat window's layout closes the parts its grid created, their editors moving into the main part first. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands getPartTitleDragSource: where a drag of the part from a group's title starts, for whatever starts it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges A layout command moves the chat's editor back into the chat part from any part of the window, such as one the grid created. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands A card drags by the pointer: it lifts (scaled 0.98, with a shadow) and follows the pointer by `translate` only; the other cards slide to where they go, once per drop target, with a running slide retargeted from where it shows; zones follow the cards where they show, with hysteresis; dropped, the part moves once and the card settles into its slot. Escape cancels. Native views move as plain cards, hidden meanwhile. Without motion, a static slot shows and the drop moves the part at once. `PartGrid.startPartDrag(id, pointerEvent)` starts it, from the grabber and from the empty title space of groups below the top edge (`getPartTitleDragSource`). Parts no longer use HTML5 drag and drop; editors still do. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands Card drag, as the user asked (U10): - the slot of a dragged card is an empty card, with the watermark of an empty editor, not an accent fill; - a part goes beside or into a part by where the center of the lifted card is, not the pointer at its grabber; to an edge of the window where the pointer pushes it, also over its own slot once the pointer moved 32px; where parts do not merge, the center of a part takes the nearest side; - the lifted card is scaled to 0.6 about where the pointer holds it. Dropped, the card settles into its slot first and the part moves once it settled, so that the layout of the parts, which can take a while, happens while nothing moves. The lift reads every card once before it writes, and the grabbing cursor is one layer over the window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands The slot of a dragged card takes the watermark of an empty editor group from its rules, rather than its own copy of them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges The parts of a chat window merge: a part dropped on the center of another merges into it, the whole part highlighted, as in any window; at its sides, it goes beside it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands Editors dragged on the rim of a card, between cards or at an edge of the window go into a new part there: the other cards make way for its slot, an empty card with the watermark of an empty editor, as for a dragged card, and the part comes once the cards settled. Further into a card, the part's own drop overlay takes them, into or beside a group, as before. What makes the cards make way is shared with the card drag (PartGridReflow), and the dry run of a new part mirrors how it is added (PartGrid.previewNewPart). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges The chat's editor is found in every group of the window (windowGroups), also in parts the grid created: merged there, it still closes the window, moves out and returns. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands Terminals merged into a chat window's main part stay there (U13): ChatWindowTerminals moved every terminal editor that opened in the main part to the terminals part, which put merged terminals back. It now moves only new terminals: an editor that moves from another group is still in that group as it opens. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands Editors dragged where they go into a new part stay there until the pointer leaves the grid: Chromium tells no related target as what is under the pointer changes, which it does as the cards make way. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands The cards that make way are laid out for real where they go, not only moved and clipped: as one starts to slide, it is laid out as large as where it was and where it goes, so that what it shows fills the card as the card's clip slides from size to size, and once it slid, exactly where it goes. A target change lays them out, not a frame. Leaving, Escape and the drop lay them out as the grid does. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges A part dropped on the center of the chat goes beside it, on its nearest side, rather than merging: its editors would join the chat's group, whose title is the chat's own. The parts of a grid say which merge with a predicate (`PartGrid.setMergeAllowed`), the chat window that none merges into the chat; the chat merging into another part still does. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops Editors and groups dragged over a view that handles drops, such as a chat, cannot go into its group, where they would be behind it: they split the group on the side nearest to them, also over its center, into a new group with its own tab row. The view's inputs still take them, and other drags, such as files, still go to the view. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands Over the center of a part it merges into, the cards stay as they are as the card lifted, its slot where it was, and only the part it merges into is highlighted, in its frame: what the merge changes shows once it is done. Moving beside a part, the cards make way; back over the center, they are as they were again. Dropped, the card settles into the part, then the part merges once, and the cards glide to where that leaves them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands While cards move, a part whose editor draws over the window rather than in it, such as a webview, a notebook, an integrated browser or a canvas, shows a placeholder for it: the content drawn over it hides, its tabs move and lay out with its card, and over the editor shows the watermark of an empty editor with the editor's icon and name. What draws over an element registers it as an overlay anchor (`registerOverlayAnchor`), as overlays positioned over elements and native web contents views do, so that the grid finds and hides it without knowing what it is. The content shows again once the cards settled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops On main's input drop targets (7525d703bb8): inputs take drops through the holes the overlay's clip-path leaves over them, and a drag that enters one creates no overlay, except for groups. The overlay no longer checks for inputs itself; content that handles drops still lets only editors and groups split the group. The test asserts the hole rather than a synthetic drag over the overlay, which ignores clip-path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops fixup! Parts drag and drop: editors between parts, and edge splits over views that handle drops An edge split over content that handles drops, such as a chat, gives the new group half of the group, as the drop indicator shows. Beside a group at its minimum size the group counted as expanded, and the part expanded the new group, squeezing the chat to its input. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part The look test from the base passes the editor groups service. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part M1: a drag of editors from another window that ends there, such as cancelled with Escape there, no longer leaves the new part's slot and the cards that made way for it: the drop target listens for drag ends in every window, and a leave once no editors are dragged resets it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands M3: PartGrid.setPreviewLayoutAllowed: a window can say which parts do not lay out at the sizes their cards take while cards make way, such as those showing terminals, whose processes resize, also for a drag that is cancelled. Their cards only show clipped until the grid lays them out. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges M5: a part does not merge into the terminals, whose groups stay locked to terminals. M3: terminals, the terminals part or a part whose active editor is a terminal, do not lay out while cards make way. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands M4: a card drag disposed while its drop still settles, such as with its grid, drops it; a new drag still settles the previous one first. L1: the window losing focus cancels a card drag. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part M4: disposed while editors dropped into a new part still settle, such as with its grid, the drop is dropped: no part is created. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges M2: the parts a chat window created, such as for editors dropped on its edges, are stored with their editors and open again as it restores: each part's editors move into a new part at the edge of the window, where such parts go as its parts are arranged (as after a layout-mode change). Where the window creates no parts, their editors stay in its main part. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part L2: editors go into new parts as the editor groups split: only while workbench.editor.splitOnDragAndDrop, as toggled by its key, and the copy key copies them into the new part. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands L3: Move Part restores the sizes of the other cells inside the change that glides, so that the cards glide to where they end up. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges L4: the parts a chat window creates are named apart from its main part, Editor, and from each other: Editor 2, Editor 3, for announcements and Move Editor to Part. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands L5: the parts of a part grid say so in their context (editorPartInPartGrid, generic, not chat-window only), and Move Part needs it besides the Agents window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part fixup! Parts drag and drop: an editor dropped on an edge of the window goes into a new part L5: Move Editor into New Part needs the part to be one of a part grid. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands L6: the overlay anchor registry is keyed by host: a host registered again, such as an overlay re-anchored mid-drag, keeps its hidden count, so it does not show again while hidden; one disposed while hidden shows again. Tests for the registry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands fixup! Parts drag and drop: drag a part to rearrange the window, and Move Part commands L7: the grabber takes the pointer only down to its grip, not over the tabs under it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges fixup! Parts drag and drop: chat windows create the parts for editors dropped on their edges Closing the window closes its main part first (#345683). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the parts of a chat window show as the window shows them The parts of a chat window bind whether they show on their own contexts, rather than taking the main window's editor area as theirs: on the window's context its parts show, such as the one holding its terminals or a part created by a drop, which show also while only the chat shows and whether the main window's editor area shows or not; on its main part's own context, the main part shows as the window's mode says. An editor in them, such as the Changes editor, can close as in the main window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: lay out the chat grid once a group is added or removed A layout while the grid of the chat groups changes, such as the window's as a terminal opens and moves focus, read the grid while it and the groups disagreed (Index out of bounds in getViewCachedVisibleSize). It now waits for the change and lays out once after it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the session header shows once in the title row Every session view of the chat bound its header into the title row, so a view the chat moved from that was still there showed its header beside that of the view the chat shows in: the title twice. Only the view that shows the chat, the last attached, shows it now, and the views attached before take it back as it goes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * editor: a locked active group hands off from a view with its own title too An editor opened without a group while a locked group was active, such as one of a chat window's terminals, went to the most recently active group that was not locked, also when that group showed only a view with its own title, such as the chat of the window: Quick Open opened a file behind the chat. It goes to the main part of the view's window now, as it does from the view's group itself. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * editor: closing a part leaves no errors, from its services or its diffs Closing the last editor of a part created in a chat window, which closes the part, logged errors ("InstantiationService has been disposed"): - The multi-diff widget disposed the items it renders before the scroll view that renders them: their bindings firing as they disposed made the scroll view render once more, creating templates while the widget disposed, with the services of the editor that disposes it already disposed. The scroll view now disposes first. - A part created with services made its instantiation service the one of the caller's collection, as an instantiation service adds itself to the collection it is created with. A chat window creates all its parts and its own services from one collection, so whatever the window and its other parts created after that, such as its title bar's actions as its layout changes, got the instantiation service of that part, disposed with it. Each part now has a collection of its own. Also, the Changes editor that a tab moves away from no longer lets go of what the input resolved while the editor it moved to shows it, which cancelled that editor's resolve ("Canceled"); a resolve cancelled while the input is still to show resolves again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: closing a window closes all its parts or none The chat part could keep the window open after its main part had closed: an editor beside the chat, such as one dropped beside it, that it could not move to the main window as it closed. The editors beside the chat now move into the main part first, and while one cannot, nothing closes; the chat part, holding only the chat, which closes without asking, then closes once the main part did. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * editor: test that closing a part closes its editors that need no confirming As closing an editor window does: only the editors that need confirming, such as dirty ones, merge into the main part, whose own editors stay. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: a layout mode arranges the parts from its own arrangement Switching layout modes kept the arrangement the grid showed where the modes arrange the parts alike, such as Side by Side and Chat Only: a part the user moved, such as the main part dropped above the terminals, stayed there once cells showing meanwhile adopted the move as arranged, and came back squeezed. A part a mode hid, such as the main part in Chat Only, also came back at its minimum size, as the terminals moved beside it while it was hidden. Each layout mode now arranges the parts again from its own arrangement, with the sizes remembered for it; parts created for dropped editors stay. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: a closing window does not arrange its parts again Closing a chat window closes its main part and its chat part, whose cells leave the grid, and then, as it goes away, the part that holds its terminals. That change arranged the grid again and set the chat cell visible: 'The part grid has no cell 'chat''. The grid of a window now stops arranging its parts once the window goes away (its willUnload), not as one of its parts closes, which can happen while it stays open. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: mark the title bar's groups that show no actions, in place of :has() A group of actions in the title bar of a chat window takes no room while its actions all hide themselves, such as the Create Pull Request bar without changes. The title bar now marks such a group with a class as its actions show and hide, which the style reads, in place of a :has() selector, which the repository's CSS guidelines advise against. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the chat model hold ends at its timeout, however often it polls The hold of a chat's model as it moves into a chat window measured its timeout by counting its polls, which a window whose timers are throttled, such as one in the background, makes fewer: the hold lasted much longer than its timeout, and its test failed on macOS CI. It now ends at a deadline; the polls only check whether the view has bound. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: closing a window keeps its layout, and moves editors back when it stays open Closing a window that showed only its chat, with an editor beside the chat, moved that editor into the main part, which showed the main part: the window's remembered layout and the default of new chat windows became Side by Side, and the grid was arranged again as the window closed. An editor opening in the main part changes nothing while the window closes. And when the window stays open, as an editor cannot move to the main window, the editors that moved go back beside the chat. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the Changes toolbar of a chat window gives its own actions the session A session resource resolves to the session of the focused chat window that shows it, so the first click on the toolbar of a chat window without focus could act on the main window's session. The actions of the toolbar get the session itself now, as those of its operations dropdown do; those of extensions keep getting its resource, as the API gives it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: a terminal created for a chat window that closed meanwhile goes to the panel It was created at the column of the window's terminals group, which may now be another group's, and stayed there as an editor. It goes into the background of the panel, as the terminals of a window do as they hide. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the Changes editor looks for the same input in other groups, not an equal one Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: a layout mode change keeps the parts and the focus when nothing moved Changing between layout modes that arrange the parts alike, such as Chat Only and Side by Side, only shows or hides the parts again, unless the user moved parts out of the mode's arrangement: the grid is not rebuilt, and the focus, such as in the chat input, stays. A mode change that does rebuild the grid, because parts were moved or the mode arranges them differently, puts the focus back where it was in the parts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: the Changes editor offers how its own files list shows, where it shows one In a chat window the Changes editor shows its changed files beside the diffs, but its More Actions menu offered only the side pane's Files View, of the main window, rather than how its list shows and where. It offers Files View & Position there now, with the commands of the multi-diff editors: View as List or Tree, On the Left or Right. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: test that a Changes editor keeps what its input resolved while another group shows the input Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the Terminals part holds only terminals Any other editor that opens or is restored in the part that holds a chat window's terminals, such as a dropped tab or Move Editor, moves to the window's main part once its open completes. The guard lives with the part, including while the terminals are hidden, and stops as the window closes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * browser view: open in the window's main part rather than a chat's or locked part The integrated browser's preferred group now hands off from a self-titled editor's group, as the editor group finder does (O3), so a PR link opened from a chat window opens in the window's main part rather than the chat's group. A part of only locked groups that is not its window's main part, such as the Terminals part, is no longer split for it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agents: the Files tab closes in a part of another window The docked Files tab stays uncloseable in the main window's main part, but in a chat window's part it closes like the other editors there, as the Changes tab does. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agents: trust a chat window's full-screen state, not its size In macOS full screen, a chat window's title row kept the traffic-light spacer: its full-screen state was only trusted when the window also covered its screen, which a window in full screen may not do, such as below the camera notch of a display or on an external display. The title bar now follows the state from the host's full-screen events for its window, and asks the host again (isFullScreen) as the window resizes or the title bar moves to it, to correct a stale state. The spacer and the titlebar-fullscreen class follow the same result. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * view editors: test that a view editor moving around leaves one live view Moving the editor of a view, such as a chat, into a group split off its own, to another part and back, five times over, leaves only the view that shows it alive: the panes it leaves dispose theirs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * browser view: do not open in a locked group of the window's main part either An open handed from a part of only locked groups to the main part of its window avoids a locked active group there too. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the chat dropped on the Terminals part goes back to the chat part The Terminals part sends other editors to the window's main part; the chat's own editor goes back to its chat part instead. IChatWindow exposes the editor that shows the chat for this. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agents: ask the host about full screen once a window is done resizing The re-check of a chat window's full-screen state waits for the end of a resize instead of running per resize event, and an answer that arrives after the title bar is disposed changes nothing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: a task run for a session a chat window shows opens its terminal in that window Running a task from the Run menu of a chat window opened its terminal in the main window's panel, which also took the focus there: the agent-host task runner always revealed the panel. It now shows the task terminal in the terminals of the chat window that shows the session, as F1 did, and only falls back to the panel when no chat window shows it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: Cmd+J in a chat window keeps the focus in it Showing a chat window's terminals moved a terminal of the window that was in an editor of another group, such as one the user moved into the main part, through the terminal panel: moveToTerminalView shows and focuses the main window's panel, which took the focus to the main window. Such a terminal now moves from its group to the part that holds the terminals directly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: a terminal of the main window's panel shows in a chat window without focusing the main window Showing a chat window's terminals can take a terminal of its session from the main window's panel. Two things there focused the main window: the panel group it left focused its next terminal when it was the active one, and the terminal was focused before it showed in the chat window, while still in the main window. The group now makes another terminal active first, and the terminal takes the focus once it shows in the chat window. A terminal in no group goes through the background rather than the panel. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: other editors stay in the Terminals part An editor dropped, moved or restored into the part that holds a chat window's terminals, such as the Changes editor, now stays there beside the terminals instead of moving to the window's main part. The chat's own editor still goes back to the chat part. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the Terminals part shows the header row for editors other than terminals A new group view option, showHeaderFor, decides per active editor whether the enabled group header shows. The groups of the part that holds a chat window's terminals take the header menus of the main part's groups and show the header row for another editor there, such as the Changes editor with its view options, and none for a terminal: terminals look as before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: a terminal moved into another part of a chat window stays there Cmd+J shows and hides only the terminals of the part that holds a chat window's terminals. A terminal the user moved into another part of the window, such as its main part, stays where they put it: hiding the terminals does not send it to the panel, and showing them does not pull it back. With none left in that part, showing them shows a terminal of their own there, as for a window without terminals. When the window closes, all its terminals still go back to their session. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: groups of the chat part look as those of the main part An editor split beside the chat inside the chat part, such as the Changes editor, showed the generic tab row with its lock action instead of the Agents header row and tabs of the main part. The chat part now takes the look's group view options and part options too; the chat's own group still shows no title area while it holds only the chat. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * view editors: a view lives on beside other tabs, and its group hands opens off A view shown as an editor now stays alive, out of the DOM, while another editor of its group shows, and shows again as it was; it goes as its editor closes or moves. A view editor whose views render their own title declares it (providesTitle), which gives its editor the new ProvidesTitle capability: a group that holds it hands editors opened in it off to the main part of its window also while another editor, as a tab, is active there. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: editors as tabs beside the chat The chat's group can hold other editors, as tabs. Its tab shows the chat's title and, while editors are beside it, no close action; Cmd+W on the chat then closes the window, as closing the chat did. The chat leads the window, and its view shows the session header, only while it shows; the window's title row shows the header meanwhile. Layouts that show the chat show it in its group. The chat's group shows no header row for the chat. A chat group with tabs is captured for restore, with the chat first. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: a task terminal goes to the chat window it was run from, and stays in another chat window A task of a session shows in a chat window's terminals only while that window, which shows the session, is the active window, such as when the task runs from its Run menu; run from the main window, it stays in the panel. Showing a chat window's terminals no longer takes one of them that another chat window shows now: it becomes that window's. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: Cmd+W, focus and visibility of the chat beside tabs Cmd+W closes the window also with focus in the chat, whose view binds the active editor of the main part in its context: the command checks the active editor when it runs, else does what Close Editor does. Focusing the window or its session shows the chat where a tab beside it showed. A view shown as an editor is told as it hides and shows again while its editor stays in its group, and the chat's view hides then. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid: the grabber of a part shows while the pointer is over the part, also over its webview The grabber on the card of a part showed only while the card was hovered. What draws over a part from outside its card, such as a webview, which is laid over it from the root of the window, did not count, so over the content of a webview, often most of the part, the grabber never showed. The grid now follows the pointer over its window and shows the grabber of the part it is over, mapping what draws over an element back to that element through the overlay anchor registry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid: with no gap between the cards, the grabber of a part takes the pointer over the sash on its edge Flush cards share their edge with the sash between them, which sat over the grabber on the top edge of the lower card and took the pointer there: a user reaching for the grabber resized instead. Without a gap, the grabber now takes the pointer within its own span; the sash keeps the rest of the edge. Cards with a gap are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the chat showing only its input grows to show its conversation when dragged taller In Stacked, a chat that showed only its input was at most as tall as its input but could be shrunk below it: the sash above it highlighted, yet could never make it taller, and could clip its input. The chat is now as tall as its input at least, and, while the user drags a sash of the window, may grow: dragged past its input it shows its conversation, and dragged back down to its input, only its input again, with a little room between the two so that neither flickers (the existing decideStackedChatInputOnlyWhileDragging). Let go past its input, the conversation stays at the height it was dragged to; let go at its input, the chat is as tall as its input again. The grid says when the user resizes, from the press on a sash, before the sash takes it, until it lets go. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid: the grabber mark leaves with its part and as the pointer leaves the window from a webview Review L6: a removed or disposed grid's part no longer keeps the mark, and leaving the window from inside a webview's frame, whose parent gets no pointerout, or the window losing focus clears it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: a resize starts on any pointer, survives a lost release, and announces what it showed Review L4/L5: the grid resizes from pointerdown (mouse, pen, touch) to pointerup or pointercancel; a press whose release went elsewhere no longer leaves the next resize off (resizing is set after the previous one ends); the grid does not end a resize as it is disposed; and what a drag of the sash showed, the chat's conversation or only its input, is announced once as it lets go. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid: the grabber shows for a part whose webview the pointer goes into straight from another part QA live check 6 (U23): into a webview, whose frame takes the pointer, the window has a pointerout but no pointerover, so the part the pointer came from kept its grabber. On a pointerout, the grid now marks the part of what is under the pointer, such as the frame of a webview over a part, and clears the mark only when nothing of the window is there. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid: the grabber shows for a part whose webview the pointer goes into, by where it heads QA live check 7 (U23): into the frame of a webview the window has a pointerout to nothing at the edge of the element the pointer leaves, and no event after it, so what is under that point is still that element. On such a pointerout, the grid now marks the part that something draws over where the pointer heads, such as a webview over the main part, found through the overlay anchor registry; else the pointer left the window and the mark clears. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid: a part's card lifts also when the first move goes into a webview QA live check 7 (U25): pointer capture taken on the press applies only to the next pointer event, and a first move upward from the grabber of the chat went into the main part's webview, whose frame took the pointer from the window: no move, no capture and no release reached the drag. From the press, the layer over the window that the drag shows once the card lifts now takes the pointer, above what draws over the window; and a press that loses the pointer before the card lifted ends. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid: the grabber shows for a part whose webview the pointer is in, once the window has no more events QA live check 8 (U23): going into a webview's frame, the window may have no pointerout at all: its last event is a move inside the part the pointer leaves. Once the window's pointer events stop for a moment, the grid now looks for what draws over a part that the pointer is over (an overlay hovered while the pointer is in its frame, through a new isPointerOver of the overlay anchor registry), marks that part, and looks again while the pointer is there; once it is not, with no event of the window, the pointer left the window from there and the mark clears. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid: the grabber stays shown as the pointer goes to it from the title above or a region that moves the window User report U34: in full screen, the grabber of the chat hid as soon as the pointer was over its title. A region that moves the window, such as the title row and the empty space of the tab rows at the top edge, takes the pointer from the window, which then has a pointerout to nothing and a mouseleave while the pointer is still over it; the grid took those for the pointer leaving the window. Now only a point outside the window clears the mark; inside it, the mark follows the part at that point, or a webview there. A cell that is not a part, such as the title row across the window, keeps the mark, as the pointer goes from a part's title there to its grabber below it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid: an editor dropped where the last move showed a new part goes there, whatever is under the pointer then QA live check 9 (compact density): with no gap or insets, a tab dropped at the window's left edge with no move after the cards made way for the new part was not taken, so the drag ended outside and opened an editor window. As the cards make way, what is under the pointer can be outside the grid's DOM, and the grid took drags only inside it. The grid now takes them at its window by where the pointer is, inside the grid, and a drop goes where the last move showed it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: the chat showing only its input does not move User request: while the chat shows only its input (Stacked, conversation hidden), its part does not move: it shows no grabber, so the sash on its top edge takes the whole edge, and neither its grabber, the space of its title nor Move Part moves it, the command announcing so. It moves again once its conversation shows, such as when dragged taller by that sash. Generic in the part grid: PartGrid.setMovable, which the window drives from whether its chat shows only its input. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid: every part put somewhere takes an even share of where it goes User decision U36: two gestures that put a part in the same place gave it different sizes (a drop at the window's edge took an even share of the row; a drop beside the part at that edge split only that part), and editors dropped into a new part split the part they were dropped on. Every part the user puts somewhere, a part dragged by its card, editors dropped into a new part at an edge or on a rim, and Move Part, now takes an even share (1/n) of the row or column it joins, within its least and most sizes; the other parts there make room in proportion to their sizes before, the parts inside them too, and views that are not parts, such as a title row, keep theirs. Dropped beside a part with no part beyond it on that side, a part goes to that edge of the window, as a drop there does, so both give the same place and size. Previews use the same function, so a drop ends where its preview showed. Parts the window arranges itself (moveCell, addPart) are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * editor: an editor dropped on the center of content that handles drops, such as a chat, joins its group as a tab User decision U37: an editor or tab dropped on the center of a view shown as an editor that handles drops, such as the chat of a chat window, went to the side of it nearest to the drop, as the center was the view's. It now goes into the view's group as its active tab, as the overlay shows, as on any group; the edges still split the group evenly, groups dragged there still only split it, and the view's own editor dropped on its center stays where it is. Only the chat view of chat windows registers such content. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid: the grid does not look for the pointer over a webview while its window has no focus Review L5: while the pointer rested over a webview, the grid looked again every 250ms for as long as it did, also after the window lost focus, which set the mark the blur had cleared. The window losing focus now stops looking, and its focus or its next pointer event starts it again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: no arranging while a window closes, and the chat with tabs beside it does not lead Closing a window with an editor beside the chat in its group logged "The part grid has no cell 'main'": moving that editor out of the chat's group showed the title row, which arranged the grid after the main part had closed. The grid stops arranging from the start of the close and arranges again when the window stays open. With editors beside it, as tabs, the chat no longer leads the window: the title row shows and the group's tab row is below it, rather than under the macOS traffic lights. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid, editor: a drop gets the size its preview shows, within the least sizes of what makes room QA final check (U36): an editor dropped at the window's right edge got a third of the main part, not an even share of the row, as the chat, split into groups, could not get narrower; and an editor dropped on an edge of the chat showed half of it but got less, as the chat kept its least width. The even share of a part put somewhere now leaves the others room for their least sizes, and those that would get less keep them while the rest make room in proportion. An even split of a group shows, and gives, half of the group within the least sizes of the group and of an editor. Previews and drops compute the size the same way. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agents: the title bar marks its groups that show no actions privately The helper is no longer exported: the test goes through a title bar that hosts a session header and checks the class on its real groups of actions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agents: docked editors decide themselves whether they can close The check whether the editor part that shows a docked editor is visible moves from a global helper into DockedEditorInput, which now takes the editor groups and layout services and adds CannotClose while that part is hidden. It moves to sessions/browser, beside its users, as it needs the layout service. The Changes and Files inputs pass their services and add only their own capabilities. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: moving out carries every part's editors, and close checks all of them first Move to Main Window and moving the chat into another window serialized only the editors of the main part: tabs beside the chat in the chat part and the editors of parts created for drops were lost. Both now take them, before the window closes; reopening passes the chat part and the created parts as restoring does. Closing a window checks first that every editor of its main part and chat part can move to the main window, so that a veto leaves every editor in place. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chat windows: drop a dead check and fix two doc comments Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * part grid: a dragged card whose drop fails still ends its drag Review L2: a drop that threw as the card settled, from a timer, left the layer over the window, the drag's window listeners and its settling phase, so that Escape and a release did nothing and no other drag started. The drag now always cleans up and ends, also when the drop fails, which is reported. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Sandeep Somavarapu · c8110cef · 2026-11-04
- 20.5ETVgithub: migrate shared service to cancellation tokens (#348496) * github: migrate shared service to cancellation tokens Use cancellation tokens throughout the shared GitHub engine, IPC, and its callers. Keep native conversion at networking and Copilot API boundaries while preserving request deadlines, credential invalidation, and mutation outcomes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * github: dispose pending reference request lifetimes Let cached reference requests own their operation stores so eviction and teardown release them synchronously after cancellation callbacks finish. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * github: simplify cancellation APIs and disposal lifetimes Shorten cancellation checks, standardize disposal-only tokens, and keep native signal conversion inside the branch-name and utility-model services. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * github: preserve cancellation delivery and request lifetimes Keep combined-token notifications intact during reentrant disposal, retain Agent Merge evidence cleanup until runtime cancellation, and stop credential and lazy fetch work when cancellation occurs during setup. Add focused regressions for these review findings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * github: cover cancellation helper fast paths and cleanup Cover direct-token reuse, empty and cancelled inputs, parent cancellation, lifetime cleanup, and throwIfCanceled. Document why a single input keeps reflecting cancellation after its supplied lifetime is disposed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Dmitriy Vasyura · 628d3553 · 2026-11-17
- 18.5ETVagentHost: resolve chat owners from recorded ownership, not chat URIs (#341191) * agentHost: resolve chat owners from recorded ownership, not chat URIs Core of Block 1 (m1). The host no longer derives a chat's owning session, storage location or parent from the session encoded in its URI: - AgentHostStateManager records owner, storage resource and parent chat at registration (getChatOwner/requireChatOwner/getChatStorageResource/ getChatParent, findRetainedChatOwner for evicted/announced sessions). - AgentHostDatabase.findChatOwner reads the owner from the containing record (chats_v2 incl. tombstones, then session_chats, then the sessions_v2 payload); catalog chats expose ownerSession. Read-only, no schema change. - AgentService resolves cold chats via registry -> retained -> central DB -> registered-session default chats -> in-flight restores -> spawn edges in loaded chats; no URI fallback. Unknown-owner dispatch keeps today's IsRead/IsArchived rejections, otherwise a traced no-op. - Teardown uses owners captured at subscribe/request/registration time (subscriptions, GC, residency, input-request timing, workspace preparation, side-effect signals for removed chats). - Provider listings carry their session (IAgentListedChat). Behavior note: a canonical subagent chat whose parent is neither loaded, restoring, nor recorded in the catalog is now not found instead of restoring the parent decoded from its URI (agreed case C / D6). Clients restore the parent first; a subscribe joins an in-flight parent restore. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: register chats with their recorded storage resource Chat registration paths now accept an explicit storage resource. Restoring a session passes chats_v2.storage_resource from the normalized catalog for the default chat, peers and restored subagents, and threads it into hydration, provider chat contexts, history reads and workspace transitions. The owner+URI-shape rule is kept only as the creation-time rule (creationTimeChatStorageResource) for brand-new chats and legacy sources that record no storage. A recorded storage resource is never overwritten by re-registration or summary refresh. No behavior change for existing data: for unmoved chats the stored storage_resource equals what the creation-time rule computes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: resolve chat owners in node services and chat contributions Node services and chat contributions take a chat's owning session from the in-memory registry, host-passed hook payloads, or owners captured at registration, instead of decoding the chat URI: - Telemetry reports, turn/tool-call trackers and session-open telemetry carry the recorded owner for attribution. - Chat contributions record the owner passed with every hook payload; `_owningSession` URI parsing is removed. - Turn service, chat input, automation, customization enablement, git state, completion provider, review, PR status, changeset services, session title, workspace context and input-needed use registry owners. - Teardown paths use captured owners: the changeset file monitor records each watch's session when tracking starts, workspace context records chat owners before release. - Persisted turn usage, turn delegation and the chat context use the recorded storage resource (hydration passes it explicitly). Legacy per-session peerChats entries now belong to the session whose database contains them. An entry is skipped when the live registry or the central catalog (chats_v2 incl. tombstones, then session_chats, then catalog payloads) records the chat under another session or as deleted. Behavior change: an entry whose URI encodes another session but has no central record is now accepted for its containing session instead of being skipped. No writer produces such entries, so the case is believed unreachable; unmoved chats behave as before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: take chat owners and storage explicitly in providers and shared code Providers and shared host code receive a chat's owning session and storage from the host instead of decoding the chat URI: - Copilot uses the session's recorded owner for server tools, MCP, edit tracking, discovery logging and history mapping (mapSessionEvents takes the routing session). - Claude sessions, pipelines and routers carry the owning configuration scope; subagent edit chats and retained terminal output use it. - Codex records each binding's storage resource from the host context and uses it, with the recorded configuration scope, for turn-id persistence and retained command output. - Subagent spawn events take the spawning chat's owner from a lookup (registry, Claude chat scope, Copilot recorded chat scope). - Server tools resolve the executing chat's owner from the registry; session server tools use an accessor owner lookup. - Local commands and Mission Control use registry owners. - Edit attribution, survival and arc telemetry take the owning session explicitly; storage-keyed tracking is unchanged. - MCP controllers take their owning session; channel parsing no longer checks the provider via the URI, since providers reject chats they do not host. - Changeset URIs report a session only for session- and folder-owned changesets; chat-owned changesets resolve their session through the recorded owner (changesetSession). Cold changeset subscriptions resolve and restore the owner through the host's cold owner resolution; session teardown disposes changesets of the chats registered to it. - Chat attachment links and plan links are built from the recorded owner. Unknown owners on non-teardown paths keep today's no-op outcomes. Existing chats keep today's behavior: their recorded owners and storage equal what the URI encoded. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: resolve chat owners on the client from session records Client code takes a chat's owning session from session state, session catalogs or host session records instead of decoding the chat URI: - Sessions provider: a completed chat turn keeps alive the session whose catalog lists the chat; context-reference links use the session's backend resource. - Subagent opener: the owner is the session of the spawning chat (parentSessionResource) or the session whose chat maps to the backend subagent chat; legacy subagent-session parents are still supported. - Remote session source, inspector and router: a chat listed in the backend session's own catalog belongs to that session. - Session handler: tool confirmation metadata reads the chat from the subscribed session state that lists it; restored subagent chats use the catalog resource or the canonical chat minted under the parent. - Usage sidecar: the owner of a default chat comes from the emitting host's session records (recorded default chat, else the forward default chat). - Chat reference chips resolve the owner when clicked: held session state, then the local host's and each connected remote host's session records. buildOpenSessionLinkForChatResource is removed. Behavior changes, all for chats whose URI does not encode the session that lists them (none exist for VS Code hosts today): remote inspection and messaging use such a chat instead of rejecting it; host-assigned opaque chat URIs now resolve through session state, so tool confirmations keep the tool call metadata like VS Code-shaped chats; a chat reference to a chat no host lists does nothing instead of opening the session decoded from its URI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: stop exposing the session encoded in chat URIs Removes parseRequiredSessionUriFromChatUri, parseDefaultChatUri, chatStorageUri and resolveChatUri, and narrows parseChatUri to the chat id: the session a chat URI was minted for is no longer readable, so a chat's owner and storage can only come from the records that contain it. Chat URIs are still minted from their session. Tests: - A mismatch oracle restores and creates chats whose URIs encode a session of an unregistered provider under another owner with recorded storage; ownership, configuration owner, cold owner resolution, provider routing, provider contexts and storage all follow the records, and the encoded session is never touched. - Cold subscribe restores the session whose normalized or legacy record contains the chat; a chat of a deleted session and an unknown chat are not found, and the encoded session is never restored. - Test fakes that emulate hosts use a shared test-only helper for the session they minted a chat URI for. Also restores import formatting that earlier milestone commits collapsed and documents chat ownership in the agent host AGENTS.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: batch the central owner lookup for legacy peer chats Legacy per-session peerChats entries are owned by the session whose database holds them unless the live registry or the central catalog records the chat under another owner or as deleted. The central check now uses one batched read-only lookup (findChatOwners) for all entries of a catalog, bounded by the existing import limit, instead of one query per entry. findChatOwner delegates to it. The peer store test now covers: an entry recorded centrally under another owner (skipped), an entry tombstoned centrally (skipped), an entry live elsewhere (skipped), and an entry whose URI encodes another session with no central record (accepted for the reading session). The last case is the behavior change already noted in the m2 commit (no known writer produces such entries). The database test checks batched and single lookups agree. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: harden client chat owner lookups Usage sidecar: - An owner lookup returns the matching session directly instead of caching every listed session and reading the target back, so a target listed among more sessions than the cache holds is no longer evicted. Only resolved owners are cached. - Records are queued per host, and the cache is re-checked when a queued step runs, so a burst during the first lookup lists the sessions once and a slow host no longer blocks the others. - Each step catches and traces its failure, so a failing listing no longer stops later records. - Held session state is checked before listing the host's sessions. Chat reference owner resolution: - Hosts' session records are queried in parallel with a per-host timeout (traced), keeping a deterministic preference: held state, then local, then remotes in connection order. A failing host is traced and skipped. - A reference whose value is a bare session URI (not a chat channel) opens that session, as before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: fix host review findings for unmoved chats Fixes regressions for unmoved chats found in host review of the chat-owner work: - Sandbox temp dir: a ShellManager keeps the owner session for configuration and terminal ownership but keys its sandbox temp dir by the chat's recorded storage resource (the session for the default chat, the chat URI for peers, as before). Disposing a peer chat's ShellManager no longer deletes the directory the default chat uses. - Session-open telemetry: a cold chat subscribe hands its resolved owner to the telemetry scope, so the attempt is measured again. - Local commands capture the chat owner when they start and pass it through, so removing the chat mid-command no longer rejects and the turn still ends. - A chat subscribed before it registers gets its owner when it registers, so it counts for residency and last-unsubscribe GC. - Owner lookups: findChatOwners decodes only catalog payloads that contain a pending chat's JSON literal (an instr prefilter, batched). Chat-backing checks read the marker owner only for legacy markers without a recorded provider, and share one default-chat inventory read per discovery, migration or filter pass. - A cancelled turn is tracked only when its owner is known, and its checkpoint discard uses the recorded owner of a chat that already left the registry. - Restored subagents read their transcript from their recorded storage resource (registry, then the catalog row), and fall back to the creation-time rule only when nothing is recorded. - Removed the unused IChatOwnerResolution.deleted field. Tombstone handling is unchanged. No schema, protocol or persisted-data change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: resolve batched payload owners per batch findChatOwners resolves a chat from a catalog payload only in the query batch that searched for it. Before, a payload matched for one batch also resolved pending chats of later batches, so a chat listed by two payloads could take the higher session instead of the lowest one that findChatOwner returns. Tests cover that shape with the lower owner live and deleted, a chat URI that needs JSON escaping, and a legacy peer-chat entry skipped because it is recorded under the reading session but tombstoned. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: make chat owner resolution a required API IAgentService.resolveChatOwner and the AgentSideEffects resolveChatOwner option are required instead of optional, so callers no longer skip the recorded-owner lookup when an implementation omits it. The chat-backing owner lookup passed to _readSessionRegistrationFacts is required too. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: make every Block 1 chat ownership API parameter required Optional members, optional parameters and default-value parameters that the chat ownership work added are now required. Where absent is a real state the caller decides, the type is `T | undefined`. A registration, chat context or hydration now receives the chat's storage resource explicitly. A caller that creates a new chat, or restores from a source that records no storage, applies the creation-time rule itself instead of relying on a hidden default in the API. - AgentHostStateManager: - addChat takes a required storageResource. - registerRestoredChatSummary requires options.storageResource. - restoreSession takes a required chatStorageResource(session, chat) function instead of an optional storage map. - _ensureDefaultChat requires its storage. - IChatEntry.parentChat is a required `string | undefined`. - createAgentChatContext and AgentService._chatContext require storageResource. - AgentService._getChatMessages and _loadWorkspaceTransitions require storage. - IHydrationContext.storageResource and restoreChatIsolation's storageResource are required, so contributions no longer fall back. - AgentService: - _isChatBacking and _findRecordedChatOwner require their lookups. - IChatOwnerResolution.spawnedBy and its title are required `| undefined`. - Session-open telemetry _start/_classify take a required `URI | undefined` owner. - AgentHostPeerChatStore requires its live-owner lookup. - getRenameChatArgs takes a required `ProtocolURI | undefined` currentChannel and `URI | undefined` currentSession. - Client: - findChatOwnerInSessionRecords requires defaultChatOnly. - resolveAgentHostChatOwner requires timeoutMs (AGENT_HOST_CHAT_OWNER_TIMEOUT_MS). - The subagent opener target reuses the existing IOpenSubagentChatContext shape. No behavior change: every caller passes the value the removed default produced. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: keep restore storage fallbacks neutral Review follow-ups to the required-parameter change, with no behavior change for unmoved chats. - A legacy subagent-session restore reads from the subagent's recorded storage when it is registered. An unregistered one follows the creation-time rule and still skips workspace transitions. - Peer and subagent restore fall back from recorded storage directly to the creation-time rule, without inheriting a live entry of another session. - Default-chat adoption uses the storage the loaded catalog records before the creation-time rule, matching restore. - A normalized catalog row without recorded storage logs a trace when it falls back to the creation-time rule. - getRenameChatSession takes a required `ProtocolURI | undefined` currentChannel, like getRenameChatArgs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: index subscribed resources by chat The subscription service indexes subscribed chat and chat-scoped canvas resources by their chat, so recording the owner of a newly registered chat and forgetting it after the chat's last subscription no longer scan every subscription. Owner semantics are unchanged: a registered owner is recorded only while the chat or one of its canvases is subscribed, and is forgotten when its last subscribed resource leaves. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: hand restored chat resolvers their recorded storage The state manager passes a restored chat's resolver the storage resource recorded on its entry when resolution starts, while the entry is valid. The restored peer and subagent resolvers use it for the provider chat context and the history read, so nothing looks up storage after registration. Resolution behaves as before: unmoved chats resolve with the same storage, and a chat invalidated mid-resolve still rejects with "Restored chat was invalidated while resolving" after its resolver completes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: add a chat ownership service Chat ownership resolution moves out of AgentService into IAgentHostChatOwnershipService, a core node service that consumers inject. It delegates live lookups (owner, required owner, storage, parent, retained owner) to the state manager registry rather than duplicating it. It owns the cold resolution chain: registry and retained summaries, the central catalog, the registered default-chat inventory, tracked in-flight restores, then spawn edges. It also provides createRecordedOwnerLookup, a lookup that reads the inventory once per pass. Registration events now come from the service. onDidRegisterChat and the new onDidUnregisterChat carry the owner and storage captured from the registry entry; unregistration fires from the entry's invalidation. AgentService reports each session and subagent restore with trackRestore, so the service depends only on the state manager and the database, never on AgentService. Callbacks replaced by injection: - IAgentService.resolveChatOwner and the side-effects resolveChatOwner option are removed. ProtocolServerHandler and AgentSideEffects inject the service. - AgentHostPeerChatStore takes the service instead of a live-owner callback. - The subscription service back-fills owners for chats subscribed before they register by listening to onDidRegisterChat itself, using the chat index. recordChatOwner leaves its interface. No protocol, persisted-data or schema change; behavior is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: read chat ownership through the ownership service Every DI-created consumer of chat ownership now injects IAgentHostChatOwnershipService instead of reading the state manager registry directly. This covers: - changeset coordinator, file monitor, operation and changeset services - chat input, customization enablement, Git state, pull request status, review, turn, utility model and session-open telemetry services - session residency and session permissions - local commands, Mission Control host and SDK event source - queue drain, turn delegation, persisted turn usage and workspace conversion contributions - AgentService, AgentSideEffects and ProtocolServerHandler - the server tool accessor wiring Contributions and telemetry that no longer need the state manager drop it. Non-DI helpers keep the state manager: chat context and turn-starter functions, branch changeset scope, the configuration service built before DI, the server tool host and the completion provider. Mechanical; behavior is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: keep catalog payload scans off the owner lookup hot paths Reading or reconciling a session's legacy peer chats checked each entry against every cached catalog payload. Those entries are rarely in the central catalogs, so they all fell through to sessions_v2 table scans: one per 100 chats, about 10 for a full list of 999 peers. Cold owner lookups also scanned payloads before the registered session inventory. IAgentHostDatabase.findChatOwner/findChatOwners are split into: - findCentralChatOwners: chats_v2 (tombstones included), then session_chats; two indexed IN queries and no payload pass. - findCatalogPayloadChatOwners: the prefiltered sessions_v2 payload scan. The legacy peer-chat filter consults only findCentralChatOwners and the live registry. Per the agreed rule, an entry is skipped only when the central catalog or the live registry records it under another session or as tombstoned. A chat listed only in another session's cached payload is not a central record, so its entry now stays with the session whose database holds it. The cold owner chain is now: 1. live registry and retained summaries 2. central catalogs 3. registered default-chat inventory 4. catalog payloads 5. in-flight restores 6. spawn edges A legacy default chat resolves from the inventory without a payload scan. Tombstone dominance is unchanged because chats_v2 is still checked first. No schema change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: name the payload owner lookup findPayloadChatOwners Renames IAgentHostDatabase.findCatalogPayloadChatOwners to findPayloadChatOwners, the name the review asked for. Adds a real-database test that a chat listed only in a cached catalog payload still resolves through the ownership service, as the last recorded source. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: keep the findCatalogPayloadChatOwners name Restores the IAgentHostDatabase.findCatalogPayloadChatOwners name that was accepted in review. The only change left relative to the perf fix is the real-database test that a chat listed only in a cached catalog payload still resolves through the ownership service. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: cache the registered default-chat index A cold owner lookup that misses the live registry and the central catalogs rebuilt the registered default-chat inventory on every call. It listed both registration tables and minted up to three default-chat URIs per session, which costs tens of milliseconds of JavaScript at 10000 sessions on each cold subscribe of a legacy default chat or an unknown chat. The ownership service now keeps the index (default chat to registered session identity) and rebuilds it only when the registrations change. The database counts registration changes with connection-scoped TEMP triggers on sessions, sessions_v2 and the tombstone/exclusion metadata keys: - getRegistrationGeneration reads the count. - readSessionRegistrations returns both listings together with the count they reflect, read in one sequenced task. The count catches every writer of those tables, including discovery and migration, because this host's connection is the only writer of agent-host.db. TEMP objects never change the database file, so there is no schema change. A newly registered session's default chat resolves immediately, and an unregistered, tombstoned or excluded session stops resolving. createRecordedOwnerLookup uses the same index. The index mints standard default chats and checks each hit against the state manager's recorded default chat, so it answers exactly as the per-call inventory did. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: count default-chat index reads with spies The default-chat index test counted registration listings from sqlite trace events, which can arrive after the awaited lookup resolves. It now counts calls to the listing methods, which is deterministic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: build the default-chat index once per recorded-owner pass createRecordedOwnerLookup holds the first default-chat index of its pass, so a pass builds it at most once, as before the index was cached, even when registrations change while the pass runs. Two fixes to the shared build: - A caller retries the shared build only when that build is older than the registration generation the caller read. - A finished build clears the shared slot only if the slot still holds that build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: adapt main's new call sites to chat ownership Adapts main's #340980 (preserve writable session downgrade compatibility) to Block 1. - SessionStorageIdentity translated a chat URI between the runtime and storage spellings of its session by reading the session from parseChatUri, which Block 1 no longer exposes. That address translation now lives in a private function inside sessionStorageIdentity.ts. It decodes the URI's encoded session, maps it through the identity records, and re-encodes it, keeping the chat id, the subagent tool-call form and any ?/# suffix. It never returns the decoded session and is never used to determine a chat's owner. - CompatibleAgentHostDatabase implements the Block 1 database members: - findCentralChatOwners and findCatalogPayloadChatOwners look up storage chats and return owners keyed by the caller's runtime chat. - getRegistrationGeneration passes the generation through. - readSessionRegistrations returns translated listings. - Main's new tests pass the arguments Block 1 made required: ownerSessionUri for edit attribution, and the ownership service for the peer chat store. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: read recorded chat storage once per restore Restoring a session read the catalog snapshot twice more than main to look up recorded chat storage: once for its peer chats and once for its restored subagents. Both now use storage from a snapshot the restore already reads: - Peer chats use the snapshot `_restorePeerChats` reads first. - Subagent admission and its retry receive the map the restore built from its own catalog snapshot. The map is a required parameter. A restore therefore reads the snapshot as often as on main. Storage values are unchanged. A restore never records storage other than the creation-time rule (a legacy migration records only that), so a chat without recorded storage in the snapshot falls back to the same value as before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: count chat-owned changeset subscriptions for their chat's owner A `<chat>/changeset/...` subscription was not associated with its chat, so no owner was recorded for it and hasSessionSubscribers/residency missed an active peer-chat changeset. Map a chat-owned changeset to its chat via the parsed changeset owner (no session decoding), so the registration back-fill and setSubscriptionOwner record its owner like the chat and its canvases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: register the peer chat in the Claude MCP artifact tools test The node-runner-only test (skipped in the Electron runner, which lacks SharedArrayBuffer) used a peer chat URI that was never registered. The artifact tools resolve the chat's owner from recorded ownership rather than the chat URI, so register the chat under its session as the other tool tests do. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Sandeep Somavarapu · c68efbe8 · 2026-10-13
- 18.4ETVGitHub IPC infrastructure and client updates (#341842) Added more GitHub API domains Added IPC connection to shared process GitHub service Switched sessions GitHub service to use the new connection Switched other clients to use the new connection NOTE: A lot of slop in the client implementation remains, this is to be cleaned up in upcoming PRs.Dmitriy Vasyura · 3a1a3fe6 · 2026-10-16
- 18.0ETVagentHost: make agent-host.db authoritative for session state (Block 3a) (#341626) * agentHost: add session state upgrade and downgrade test fixtures Test-only fixtures for Block 3a. writeLegacySessionState writes the session.db, peer db and agent-host.db state a 1.142, 1.143 or 2b build leaves for a Copilot session with a default chat and peers in the same and a different folder (drafts, local and failed turns, checkpoint refs, git/gitData, changes, titles, peerChats, storage identities, legacy chat catalog and catalog payload). readOldBuildView reads back exactly what those builds read, so later tests can assert an old build still sees the same state after a newer build writes it. InMemorySessionDataService keeps real in-memory SessionDatabases alive across simulated builds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: add the session state schema (migration 15) and foreign-row filter Block 3a C1. agent-host.db migration 15 adds the session state tables (session_state, session_state_values, session_folder_state, session_branch_changesets, session_chat_state, chat_turn_checkpoints, session_checkpoint_repositories, chat_row_mirror). They are additive; older builds skip the version and never read them. IAgentHostDatabase gains their API (import, CAS write, mirror and row acknowledgements, checkpoint index and sequence, row mirror bases, storage references, garbage), translated to storage spelling by CompatibleAgentHostDatabase. Tombstone, exclusion and both unregistrations delete a session's rows and markers; a provider-absent exclusion keeps them. session.db gets no schema change. setForeignRows records the row owner and the turn ids an older build kept for other chats; turn scans, truncation and the conversation check ignore them (read from the persisted keys in each statement, so every connection agrees), while getAllCheckpointRefs still returns every ref. A fork remap drops them from the copy, and the checkpoint parent fallback skips foreign refs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: add the session state store Block 3a C2. IAgentHostSessionStateStore owns session-level values, per-folder git state, branch-changes blobs and legacy-catalog chat summaries, authoritative in agent-host.db. - load imports a session once from the old format older builds keep in session.db (values, git maps, base branch, blobs, chat titles, read flag, directories, changes), lazily and without creating storage. On the first load in a process it reconciles: per entry, a mirror that differs from the recorded merge base was edited by an older build and wins; otherwise central state wins and stale mirrors are rewritten, which also repairs a crash between the two writes. - Writes go to agent-host.db first; their old format is written per entry, coalesced per session (250 ms), and the revision acknowledged only once every entry is mirrored. noteMirrored lets callers that wrote the mirror themselves skip the rewrite. - Operations on a session share one exclusive section keyed by its storage directory; re-entrant calls throw instead of deadlocking. - readWithoutImport and refreshFromMirror serve sweeps and provider writes the host cannot route. The registry in agentHostSessionStateMirror.ts is the frozen key format. The node layer may now import async_hooks for the re-entrancy guard. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: render session state in the old format for readers Block 3a C3.1. Readers can keep their old-format parsing while their source becomes central: - legacyMetadata renders what session.db would hold for given keys if every mirror were current, and names the keys the store does not own (provider data, blobs, membership) for callers to read as before. - catalogMetadataReference serves the catalog projection: owned keys centrally, the rest from session.db. - readWithoutImport renders central state for imported sessions that are not loaded and never imports; readValuesWithoutImport serves sweeps over many sessions with one central read. - readSessionStateValues reads any number of sessions in two statements. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * C3.3a: route existing metadata writers through the session state store Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * C3.3b: route git, worktree-list, summary, enablement and mission control writers through the session state store Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * C3.3c: route remaining owned-key writers through the session state store Worktree isolation, workspace conversion quarantine and CopilotAgent session-level owned keys now use store.writeMetadata with an Immediate mirror. Adds gitState delete test, per-group tests, and hardens fire-and-forget project resolution writes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: register the session state store in the contribution test fixtures Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: route GitHub folder-map migration through the session state store Whole folder-map writes (agentHost.gitData / agentHost.githubData) now map to per-folder central entries, and the migration writer uses the store with an Immediate mirror. The unowned single-folder key stays deleted until C4 renders it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: make the session state mirror the single owner of chat working directories _writeChatMetadata no longer writes agentHost.chatWorkingDirectories; the chat entry's working directories go through the store (Immediate mirror) and are read back from the store first, falling back to the chat database only for sessions the store has not loaded. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: import legacy chats without reading the cached catalog payload Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: mirror normalized chat metadata for older builds (C3.4c) Write-only mirror of peerChats, chat titles/sources, defaultChatIsRead, changes and working directories for normalized sessions; older builds' edits are never imported. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: read session state through the central store (C3.2a) Restore loads the store and reads legacy keys through legacyMetadata, opening session.db only for keys the store does not own. Listing and background readers use readWithoutImport and never import or open a session.db for owned keys. List-visible overrides for owned keys are now written to the store. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: harden session state mirroring and workspace conversion writes (C3.4d) Fold restore's catalog snapshot into store.load; mirror peer isRead/providerData/origin/inheritedTurnId; record mirrored values only after a successful write and forget them on delete; flush Immediate writes when the task throws; retry failed flushes; creation markers no longer roll back on mirror-only failure; workspace-conversion session-level keys go through the store. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: coalesce hot session state mirror writes (C3.2b) Git/GitHub data refresh and the changes summary mirror to session.db with the 250 ms coalescing window again; central state commits immediately. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * C3.5a: project the catalog from central session state ((A) reversal) The catalog sync now projects from central session state, and the catalog write-through adopts legacy metadata into central before the session.db mirror write. Unimported sessions stay projected from session.db. Test/design deviations (assertions unchanged): - Tests that wrote store-owned keys straight to session.db after load now write through the store. - The sync queue stays outermost; the store sequencer is entered in short per-call sections, since request factories use the store themselves. - The catalog outbox expectation is 'acknowledged'. - Projected keys are excluded from the legacy-metadata match, and the sync's own central write-through does not bump the payload-dirty counter. - A store record whose central rows were removed beneath it is treated as deleted (record forgotten); pruning stale external sessions evicts it. - The changeset-summary migration no longer persists on its own while the catalog is being built (it superseded the reconciliation); the catalog sync writes the derived summary instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * C3.5b: grep guard v1 for session state ownership (I1/I6) A node test scans production sources under agentHost/node for database metadata calls that mention a store-owned key and compares per-file/key counts with an explicit allowlist. Each allowance names the step that removes it (C4/C5) or is permanent with a reason (provider own-db reads, peer-store mirror writers, detached-worktree record dbs). New accesses and stale allowances both fail. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: route per-folder git/GitHub state and base branches through the central session state store Mirror maps and base branches (per scope) are central state mirrored to today's keys; unchanged refreshes write nothing; agentHost.github is retained and never deleted on restore. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: render legacy agentHost.github from central state; align tests with store-owned writes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: expose session settings and launch dirs on IAgentChatContext Adds required sessionSettings and launchWorkingDirectories to the chat context, derived from the session state store. Copilot customization directories and project keys become store-owned session values. Mission control now reads and writes through the store. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: fix changeset branch metadata typecheck Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: record launch working directories for chats Backfill explicit launch directories at import, split the chat/session working-directory operations internally with unchanged visible behaviour, and record launch directories on create, P1 conversion and P3 pinning. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: record per-chat launch folders for normalized-catalog sessions; snapshot P2-P4 dispatch sequences Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: Copilot reads session settings and launch dirs from host context (C5b) Drop the configuration-db reads for customization anchors, the resume fallback and workspaceless detection in favour of IAgentChatContext sessionSettings/launchWorkingDirectories. Adds cold-resume tests for unpinned and pinned peers plus a guard that no copilot.* key is read from the configuration db. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: Copilot gets additional worktrees from host session settings (C5c) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: per-chat drafts and local/failed turns in the chat's own database (C6a) Adds IAgentHostChatRowStore: rows are written to the chat's own database and mirrored into the session database keyed by chat, with a rows revision so a crash between the two writes is repaired on load. The first load copies existing rows into each peer chat's database and leaves the originals. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: restore read budgets and import old-build row edits (C6a-fix) Fold the first-load reads so snapshotReads/peerCatalogReads return to 12/0, and import rows an older build added to the session database mirror (additions only, watermark in the moved marker). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: wait for both git refreshes in provisional Uncommitted Changes test The chat changeset is now advertised before the session-level git refresh reaches the git service, so the test asserted gitCalls too early. Both refreshes still run; the wait now includes the second call. Assertion unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: per-chat checkpoint refs, central counter and checkpoint index (Block 3a C6b) Checkpoints are captured into the chat's own database under a per-chat ref namespace with one monotonic counter per session. Changeset readers resolve turn -> chat -> storage through the index (getTurnCheckpointPair takes a required chat), probing and re-indexing a missing row. Legacy peer rows are copied into the peer's database and kept, flagged foreign, so older builds keep a unique N. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: cover foreign checkpoint rows per consumer and unclaimable rows (Block 3a C6b-gaps) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * C6c: rebuild checkpoint index and counter at import, incl. lost agent-host.db Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * C6c-gap: count isolation and additional worktree repositories when rebuilding the checkpoint counter Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: stop writing and mirroring changeset diff blobs (Block 3a C4b) Drop agentHost.changeset.branch[.scope], the legacy diffs key and the session-db agentHost.changeset.session union: no writes, no mirroring, no blob routing and no reseed reads. Changesets are computed live. The durable agentHost.changes[:chat] summaries stay central and mirrored. Existing on-disk blob values are left untouched. Ratchet the ownership guard. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: keep ehcli adoption state as per-chat central data Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: keep Mission Control cursors as default-chat data (Block 3a group 4) Mission Control's sdkSequence/sdkJournalCursor are the default chat's own data in its own session db again: read and written directly, not store-owned and not mirrored. Removes the missionControl. prefix family from the owned-key registry and guard. vscode.scheduleCursors is automation data and was never store-owned. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: match main for chat summaries, no peerChats for chats_v2 sessions (Block 3a group 5) Drop the v2-only peerChats write from the normalized-chat mirror; legacy-catalog sessions still get it via the legacy mirror. Titles and change summaries are still mirrored for all sessions. Also remove the now-empty prefix plan from the mirror read plan. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: checkpoints are purely chat data (Block 3a item 5) - Peer checkpoint refs are chat-only, refs/agents/chats/<chatKey>/checkpoints/turn/<N>, numbered per chat (max N in the chat's own rows + 1). The default chat keeps main's refs/agents/<sid>/checkpoints/turn/<N> numbered over its whole database, legacy peer rows included, so older builds' numbers stay unique. - Remove the central checkpoint index, the session counter, the central checkpoint repository list and the C6c rebuild, with their store/database APIs; drop them from the never-shipped v15 schema (user_version stays 15). - Lookups read the turn's row in the asking chat's own database; the default chat reads the session database, which now ignores foreign rows in getTurnCheckpointRef too. The C6b copy of legacy peer rows into the peer's database stays, names unchanged. - Each chat records the repositories it captured in, in its own database. Deleting a chat's or session's data deletes the database's rows' refs in those repositories (a session also in main's working-directory resolution, with the baseline); never by listing a ref prefix. Deletes wait for captures queued under other keys. - Guard: no central checkpoint state under node/ or common/, ref listings ratcheted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: match main for keys in a chats_v2 peer's own db (Block 3a group 6) - chats_v2 sessions no longer mirror providerData, origin, inherited turn, read state or title into each peer's own database on every normalized change. Only agentHost.chatWorkingDirectories is written there, and only when that peer's working directories change ('' when cleared), because older builds overlay it over the catalog on every read. - Legacy-catalog (v1) sessions are unchanged. - Chat row store: a removal whose chat database was never created still removes the row from the session database mirror (previously only worked because the per-peer mirror always created the peer database). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: drop the unused session_branch_changesets table from schema v15 (Block 3a item 6) Schema v15 never shipped and branch changes are computed live, so the C1 table goes away with readBranchChangeset, hashBranchChangeset, the branchChangesets fields of the session state/patch/import, the compatible and test wrappers and their tests. user_version stays 15; the migration test now asserts the table is absent and the guard forbids the removed identifiers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: keep the ehcli markers as the adopted chat's own data, as on main (Block 3a item 7) Reverts 889ce28bccd ("keep ehcli adoption state as per-chat central data") and the earlier routing of agentHost.ehcliAdopted/ehcliLastMigratedTurn through the session state store: - session_chat_state loses the ehcli_adopted/ehcli_last_turn columns (schema v15 never shipped; user_version stays 15); - the keys leave the store's owned-key registry, so they are neither central nor mirrored, and listing/restore read them from the session database; - Copilot writes them straight to the adopted chat's database (the session database for the default chat), at adoption and in the backfill, as on main. The guard classifies them as chat data and checks the store does not own them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: delete chats by recorded storage with a reference guard (Block 3a C7) Session delete captures every chat with its recorded storage before tombstoning, without importing central state: live registrations, the normalized catalog (private chats included), the central chat state of a legacy-catalog session, else the creation-time rule. Provider teardown now includes private chats with a backing. Each chat's candidate directories are its recorded storage and the database its URI addresses (older builds' mirrors), minus the session directory, deduplicated by data directory; a candidate is deleted only when no other live session or chat records it. A single peer delete removes its central rows (chat state, row mirror bases), its draft and local/failed turns copied into the session database, and its storage under the same guard (the session's other chats' storage is kept). Legacy-catalog sessions now record the storage of their spawned and restored private chats centrally, so their delete finds them. Test data directories keep each chat apart, as the real service does. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: never mirror into a deleted chat's database (Block 3a C7 follow-up) A legacy-catalog folder's base branch is mirrored into its source chat's database. Deleting that chat now moves the row to the folder's next live chat (peers in catalog order) and writes the current value there at once, or deletes the row when no chat uses the folder any more. At write time the target is recomputed from live chats: a recorded chat that is gone is never written to, and a folder no live chat uses is not mirrored. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: final session state guard allowlist and dead-code cleanup (Block 3a C8) - The auto-archive sweep, the changeset-aggregate migration's configValues and the title controller's legacy-catalog title reads go through the store (readWithoutImport), so their direct session.db accesses leave the guard allowlist. Every remaining entry is permanent and justified: chat-own or provider-owned databases, detached worktree records, v1 peer databases and one-time title adoption of chats central state does not know. - Unexports module-internal values left by the reversals and fixes stacked doc comments. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: document the session state store (Block 3a C8) AGENTS.md gains an I5 note, the sessionSettings/launchWorkingDirectories rows of §8a and §8g, and a "Session State Store" section: what is central, chat-owned and mirrored, checkpoints as chat data and delete by recorded storage. agentHostChatCatalogV2.md notes the (A) reversal of the catalog projection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: a mirror flush never creates a chat database (Block 3a review #1) The session state mirror flush now writes chat-scoped targets only into the existing database of a chat that is still live in central state (via tryOpenDatabase), drops entries it has nowhere to write, and does nothing while the session is being deleted. The scheduled and retry flush is guarded the same way. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: write the ehcli markers in the same batch as the adoption metadata (Block 3a review #2) The adoption markers are chat data the store does not own, so they go to the default chat's database (the session database) in the same setMetadataValues batch as the other unowned adoption metadata, after the central write, instead of in a separate earlier write. This removes the crash window between the two writes; main wrote everything in one batch. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: scope the checkpoint delete wait to captures into the deleted database (Block 3a review #3) Deleting a database waited for every other sequencer key. It now waits for its own key and for the pending chat captures, of any session, whose chat's own database is the one being deleted; an unrelated session's pending capture no longer holds it up. A capture whose target cannot be resolved is still waited for. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: note how copied legacy checkpoint rows are cleaned up (Block 3a review #4) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: listing and sweeps read session state at main's per-session cost (Block 3a review #5) readWithoutImport of an unloaded session now reads session values from central state and every other key (titles, folder maps) from its session.db mirror in a single read, instead of reading the whole central state and the catalog per session. The mirror is used only while it holds the current revision (the same query reports it); a session whose last write is still waiting for its mirror renders from central state as before. A new prefetchWithoutImport reads the central values of many sessions in one query. The lifecycle sweep and the listing fallback use it, so a page costs one agent-host.db query and at most one session.db read per session, as on main. The sessions_v2 importer test waits for the listing's background migration instead of observing it mid-flight. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: never take an unknown chat for the default chat (Block 3a review #6) storageOf now answers only for chats central state records: the recorded default chat and recorded peers. A chat it does not know (a peer whose registration is racing its first turn) gets undefined, so its turn is not checkpointed (best effort, like concurrent turns) and lookups find nothing, instead of writing the default chat's ref names into the session database. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Sandeep Somavarapu · 83caa64d · 2026-10-15
- 17.5ETVagentHost: make the orchestrator own session enumeration and chat lifecycle (#329633) * agentHost: relocate Session ownership into the orchestrator (T2/T4) Make the orchestrator (AgentService + AgentHostStateManager) own the Session concept - identity, lifecycle, and grouping - so the agent harness talks only in chats. Session provisioning stays agent-specific but is now invoked through the chat surface instead of a Session-typed method, honoring "represent, don't orchestrate". - Create: `_provisionSessionViaDefaultChat` allocates the session URI and drives `chats.createChat(defaultChatUri, { provisionSession })`; the agent's provisioning runs inside creating the default chat and returns `IAgentCreateChatResult.provision`. - Dispose: routes to `chats.disposeChat(defaultChatUri)`. - Enumerate: `_enumerateProviderSessions` groups `listConversations()` into sessions via the default-chat URI convention. Gated per harness by `IAgent.orchestratorOwnsSession` (Codex, Claude, Copilot all opt in). Storage-preserving: session URIs and the derived `sdkSessionId == session raw id` (I3) are unchanged, agents read/write the same SDK stores, and providerData / PEER_CHATS_METADATA_KEY / protocol types are untouched. The legacy createSession/disposeSession/listSessions remain as the delegated fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: drop orchestratorOwnsSession opt-in; chat surface is the single path Address review feedback: the agent should not declare an orchestration policy, and the interface should not carry an optional flag that splits behavior. The opt-in was transitional scaffolding for a per-agent rollout; all harnesses have migrated, so remove it and make the orchestrator drive the chat surface unconditionally. - Remove `IAgent.orchestratorOwnsSession`; make `listConversations` required. - `AgentService` always provisions (non-fork/import) / disposes / enumerates through the chat surface; no per-agent branch. - Drop the flag from Claude/Copilot/Codex. - Make both test mocks first-class chat-surface agents (provisionSession bridge, default-chat disposeChat, listConversations) so their existing createSession/ disposeSession assertions still hold via the bridge. - Update the routing test to assert session create/dispose now also flow through the chat surface; refresh the architecture doc. Storage-preserving; no protocol/data change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: trim verbose comments on the T2/T4 session-ownership code Shorten the JSDoc/inline comments added for the session-ownership relocation to 1-2 sentences per the coding guidelines; drop obvious per-field comments. No behavior change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: drop redundant session-typed methods from IAgent (Category C) Remove `listSessions` and `getSessionMessages` from the IAgent contract - they are superseded by `listConversations` and `chats.getMessages`. Reroute the one remaining internal caller (the restore metadata catalog fallback) to `_enumerateProviderSessions` (which uses `listConversations`). The harnesses keep those methods privately as the implementation their chat/conversation bridges delegate to. `createSession`/`disposeSession` stay on IAgent as the session-lifecycle provisioning primitives the chat-surface bridge delegates to; `createSession` is also still used directly for fork/import, whose session id is minted server-side (sessions.fork) and so cannot fit the orchestrator-allocates-URI seam - left as a documented follow-up. No behavior change; storage-preserving. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: rename IAgent.getSessionMetadata to getConversationMetadata Align the single-item metadata lookup with the chat-addressed conversation surface: the method is now keyed by a chat URI and returns IAgentConversationMetadata, mirroring listConversations. All five implementers (Copilot, Claude, Codex, and both test mocks) derive the session from the chat URI and return chat-keyed metadata; the orchestrator maps the default-chat URI back to a session when hydrating restore metadata. Also reframe the fork/import createSession path in MULTI_CHAT_ARCHITECTURE.md from a deferred follow-up into a permanent, by-design exception (the fork id is minted server-side by the SDK, so the orchestrator cannot pre-allocate the URI). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: clarify IAgentConversationMetadata._meta is session-generic by design Document why the field keeps the SessionMeta alias rather than a conversation-specific type: _meta is the protocol's open property bag on SessionState / SessionSummary, carried through verbatim. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: clarify Claude disposeSession takes the agent's own SDK session URI Document that the session parameter is the provider's own SDK session (the SDK's terminology), NOT the AH-level Session grouping - that grouping lives in the orchestrator and the agent only ever deals in chats. The URI backs the default chat (invariant I3), so chats.disposeChat routes here when a default chat is disposed; peer chats go to _disposeChat. Teardown disposes that SDK session plus the peer-chat backings the agent parents under it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: document the AH-session vs SDK-session terminology convention Add a 'session is overloaded' convention table to the Mental Model section: in the protocol/orchestrator 'session' means the AH grouping; inside an agent harness it means the provider's own SDK session (Codex: thread); at the IAgent seam the session URI is a shared identity (AH-minted, SDK-session-id raw id per I3). Explains why we do not rename the provider-internal 'session' symbols. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: make IAgent enumeration session-keyed (orchestrator owns session->chat) Revert the chat-keyed enumeration surface (listConversations / getConversationMetadata) back to session-keyed listSessions / getSessionMetadata on IAgent. Chat-keyed enumeration forced every harness to derive default-chat URIs via buildDefaultChatUri for cold (SDK-discovered) sessions it never created in-process - re-deriving the session<->default-chat encoding that belongs to the orchestrator/protocol. Now each agent returns its own SDK-session identity (AgentSession.uri: provider scheme + SDK id, no protocol-chat knowledge) and the orchestrator owns the session->chat mapping. Drops the orchestrator's _conversationToSessionMetadata bridge (the enumeration/restore round-trip) and deletes the now-unused IAgentConversationMetadata type. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: stop agents synthesizing default-chat URIs at runtime Agents no longer call buildDefaultChatUri. Outbound events, default-vs-peer comparisons, and session-or-chat normalizers now reuse the chat URI the agent was already given - read back from the session entry's stored defaultChatKey (new getter on AgentSessionEntry) or the live session's stored chat channel, or tested with isDefaultChatUri - instead of re-deriving it from the session URI. The one irreducible conversion (a session URI first born inside the agent: a freshly forked SDK-assigned id, or a cold-restore/create seed) is centralized in a single node-layer helper, defaultChatUriForSession, in agentPeerChats.ts. This is creation-time only; no runtime routing/event path derives chat URIs anymore. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agents: reuse orchestrator default-chat URI on the provision path The provision (create) path already hands the agent the orchestrator-allocated default-chat URI via createChat(defaultChatUri, { provisionSession }). Claude and Codex decoded it to a session and then re-derived the identical URI inside createSession. Thread the supplied chat URI straight through (createSession's new optional defaultChat argument) so the agent seeds its entry with the URI it was handed instead of re-deriving the session-to-default-chat mapping itself. Copilot has no synchronous create seed (it stores a provisional session and seeds the default-chat key at materialize/resume), so it has no provision round-trip to thread; its derivations are the restart-lazy category. The remaining defaultChatUriForSession callers are the restart-lazy paths (cold resume, peer-send provisional default, fork/restore materialize) where the orchestrator supplies no chat URI in-call; documented as the single sanctioned, irreducible conversion. Behavior is unchanged (the mapping is deterministic); two Claude tests that deep-equal the emitted URI object are aligned with the file's toString-based convention since keying now populates the URI's cache. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: flatten provider chat bindings Make Agent Host own chat membership and pass contextual data only for individual operations. Providers route exact chats to their SDK conversations without deriving default or peer roles. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: make chat lifecycle exact and retry-safe Post-merge repairs and review follow-ups for the AH-owned multi-chat architecture, keeping providers on exact chat-to-SDK bindings: - Make `IAgentChats.releaseChat` mandatory so AgentService has one exact-chat release path with no optional legacy fallback; Claude, Copilot, Codex, and the test agents implement it explicitly. - Copilot chat disposal now propagates SDK deletion failures (preserving routing/state for retry) but tolerates an already-deleted session via an O(1) `getSessionMetadata` recheck, keeping a partially-completed multi-chat teardown retry-safe. - Claude: gate materialization on post-await cancellation, abort every live session's controller on dispose, and restore session-addressed resume without inferring chat membership from the URI. - Rename `IAgentCreateChatOptions.provisionSession` to `newSession` to state intent (this createChat creates the owning session). Verified typecheck, transpile, AgentService/Claude/Copilot/Codex unit suites, valid-layers, and hygiene. * agentHost: restore subagent transcripts via the chat-surface getMessages Copilot's `chats.getMessages` routes to `_getChatMessages`, which lacked the subagent-session-URI branch that only lived in the now-orphaned `getSessionMessages`. On the persisted replay/restore path the orchestrator loads a subagent's turns through the chat surface, so reopening a session rebuilt an empty subagent transcript — failing the "reopening a session keeps sub-agent messages out of the parent transcript (replay path)" E2E test on all platforms. Extract a shared `_getSubagentMessages` helper and route subagent URIs through it from both `_getChatMessages` and `getSessionMessages` (matching Claude, which already shares one path). Also address PR review feedback: - `AgentService._releaseSession` releases every catalog chat even if one rejects, then propagates the first error (idle eviction has already dropped the session state, so a skipped leaf would stay resident indefinitely). - `CopilotAgentSession` stores the host-supplied `IAgentChatContext.resource` as its persistence scope instead of re-deriving it from the mutable chat channel via `isDefaultChatUri`, so an explicitly chosen resource survives a later `bindChatChannel`. - MULTI_CHAT_ARCHITECTURE.md: correct the flat `IClaudeChatBinding` shape (`{ sdkSessionId, model? }`, no retained session/storageUri). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: orchestrator owns session provisioning; agents only create chats Removes the `newSession` seam so an agent no longer distinguishes "a chat for a new session" from "a chat for an existing session". Session provisioning now always goes through the agent's dedicated `createSession` + `chats.bindSessionChat` (the same path fork/import already used), and `chats.createChat` has exactly one meaning: add an additional chat to an already-provisioned session. Contract: - Delete `IAgentProvisionSession`, `IAgentCreateChatOptions.newSession`, `IAgentProvisionResult`, and `IAgentCreateChatResult.provision`. - Add `IAgentCreateChatOptions.inheritedContext` ({ workingDirectory, config }): the orchestrator supplies the owning session's resolved context when creating an additional chat, so the agent never reads it back from the parent session. Orchestrator: - `_createProviderSession` always provisions via `createSession` + `bindSessionChat`; delete `_provisionSessionViaDefaultChat`. - `_buildInheritedChatContext` resolves the AH-owned worktree/folder + session config values and passes them to `chats.createChat`/`fork`. Agents (Claude, Copilot, Codex): - Drop the `if (options.newSession)` branch and the `_provisionChat` method; the chat surface handles additional chats only. - Claude/Copilot consume `inheritedContext` for the additional-chat working directory (and Claude for its permission mode) instead of resolving the parent session; remove the now-dead `_createSession(target)` plumbing where the provision path was its only caller. Tests/docs: - Rewrite the AgentService routing test to assert provisioning via createSession + bindSessionChat. - Update MULTI_CHAT_ARCHITECTURE.md §2/§7 to the new seam. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: enable multi-chat for Codex (base for I3-removal branch) Adds Codex multi-chat support (parity with Claude/Copilot): the `multipleChats: { fork: true }` capability, `chats.createChat`/`chats.fork` minting a fresh backing Codex thread per chat, `materializeChat` restore, and a providerData codec. This is committed as the base of the dedicated I3-removal branch (it is intentionally not on the PR branch). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: add orchestrator-owned session registry (I3 removal stage 1) Introduce AgentSessionRegistry, a durable, orchestrator-owned index of the sessions that exist, keyed by session URI and persisted as a JSON blob in a reserved session database with serialized read-modify-write. Wire it into AgentService: register on every createSession success and on restoreSession, unregister on true delete (disposeSession). Add a Stage 1 validation surface (getRegisteredSessions) plus component and parity unit tests. This is additive and does NOT yet drive enumeration; listSessions still uses the provider-derived path. It is the foundation for switching enumeration off invariant I3 in stage 2. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: enumerate sessions from the registry, not providers (I3 removal stage 2) Switch AgentService.listSessions to iterate the orchestrator-owned session registry instead of unioning each provider's listSessions(). Per-session metadata still comes from the agent's direct getSessionMetadata lookup (I3 keeps the default chat's SDK id == session id, so it resolves), then flows through the existing DB and state-manager overlays unchanged. This decouples AH enumeration from the agents' SDK stores: peer-chat backings and subagent sessions never enter the registry (so they cannot leak as top-level entries), and a provider that transiently drops a session from its own snapshot no longer evicts it. Idle provisional sessions are suppressed explicitly via a new state-manager predicate (isIdleProvisionalSession), preserving #321269 now that the registry — not the provider snapshot — is the session source. A one-time, marker-gated backfill seeds the registry from the legacy provider enumeration so hosts created before the registry keep their on-disk sessions. I3 is unchanged; agents are untouched. Adds backfill and transient-drop tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: clarify Codex is already I3-decoupled (I3 removal stage 3a) Codex's default chat does not actively satisfy I3: a fresh session's raw id is an AH-minted provisional UUID while its backing thread id is app-server-assigned, with the real mapping persisted in the per-session metadata overlay. The residual sessionId == threadId uses (_readSession's ?? sessionId fallback and listSessions' thread->URI mapping) are legacy-compat shims for pre-existing sessions whose persisted identity is the thread id; they cannot be removed without a data migration (disallowed), so Codex is treated as already I3-satisfied. Comment/doc-only: clarifies the two shim sites and adds a per-agent nuance note to the I3 invariant in MULTI_CHAT_ARCHITECTURE.md. No behavior change. The active I3 removal targets are Claude and Copilot. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: collapse fresh-session provisioning into chats.createSessionChat (I3 removal stage 4, step 1) Add an optional chat-surface entry, chats.createSessionChat, that provisions a session AND binds its session-backed (default) chat in one call — the replacement for the IAgent.createSession + bindSessionChat provisioning pair. The agent reuses the session id as its SDK id (id-reuse kept; no storage change, no I7 for the default chat). The orchestrator mints the session URI, derives the default-chat URI, and calls createSessionChat; agents that don't implement it fall back to the create-then-bind pair. Claude implements it via its existing { kind: 'chat' } provisioning path (also used by truncate), so routing state is identical to create-then-bind. Only fresh sessions collapse: fork and import mint a fresh SDK-assigned session id inside the agent, so the orchestrator can't know the default-chat URI up front and keeps them on the create-then-bind pair. bindSessionChat is now documented as the restore-time counterpart. Additive and always-green: Copilot/Codex still use createSession. Validated typecheck, layers, eslint, hygiene; Claude units 206, AgentService 140, Claude E2E replay 8. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: implement chats.createSessionChat in Copilot and Codex (I3 removal stage 4, step 2) Both agents now provision a fresh session and bind its session-backed (default) chat through the collapsed chats.createSessionChat entry, delegating to their existing _createSession and then binding the default chat (id-reuse; no storage change, no I7 for the default chat). The orchestrator already prefers this path for fresh sessions across all providers; fork/import still use createSession. Validated typecheck, layers, eslint, hygiene; Copilot 347, Codex 47, AgentService 140 units; E2E replay Copilot 15 / Codex 6 / Claude 8. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: enable Codex multi-chat capability Advertise Codex multiple-chat and fork support now that the exact chat binding, model-provider forwarding, and registry-owned enumeration paths are complete. Keep provider-owned side chats disabled for Codex. Add replay-only parity gating for Codex model-backed peer/fork tests. Host-only capability checks and conformance catalog/lifecycle coverage remain enabled; recording mode still runs the gated tests once the documented live Codex recording defect is fixed. No capture files are fabricated or hand-edited. Validated typecheck, layers, ESLint, Agent Host unit suites, and Claude/Copilot/Codex strict replay. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: allow recording gated multi-chat E2E tests Keep Codex model-backed peer/fork tests skipped in strict replay while permitting both focused recording modes to execute them and generate fixtures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: harden session registry and chat lifecycle Make registry load/write mutations durable and retryable, require successful provider enumeration before marking backfill complete, and unregister before irreversible deletion. Dispose every peer and always run provider-level session finalization before surfacing the first error. Harden Codex workspace-less peer/fork managed-directory ownership across create, release, restore, and disposal; refresh an empty model catalog before validating restored provider-qualified models. Remove unsupported multi-chat capability from ScriptedMockAgent and add regression coverage for every reported failure/retry path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: remove Claude default-chat URI inference Use exact chat state routing and retain only the legacy bare-session compatibility path.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: make chat backings session-neutral Give every provider an exact default-chat backing, keep Agent Host authoritative for membership and lifecycle, and isolate provider enumeration to legacy discovery.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: dispose legacy Claude sessions Retain exact default-chat disposal while falling back to an unbound same-ID SDK conversation for direct legacy provider callers.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: route peer session events to owners Normalize session-scoped progress from exact chat resources, keep Codex peer lifecycle off backing session URIs, and resolve peer configuration through the owning AH session.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: restore Codex peer chat history Resume cold Codex peer threads before reading their turns and honor the persisted replacement thread ID. Share concurrent resume work with the first send and suppress idle usage notifications emitted during restore.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test: update AgentService worktree deletion stub Use the current prepare/remove worktree deletion contract so durable registry retry coverage reaches the expected cleanup path.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: fork the exact Copilot source chat Pass the orchestrator-owned default chat channel through session forks so Copilot resolves independent SDK backings. Preserve refork support when imported protocol turn IDs already match provider event IDs.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: clarify btw command input Document that selecting the slash command consumes the command token, so the remaining input must contain only the side question.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Restore persisted subagent chats Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Store orchestrator state separately Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Attach restored peer rejection eagerly Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Cancel session cleanup before revival Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Enforce Agent Host routing channels Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Use plural session working directories Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Apply provider feedback consistently Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Clarify provider chat backing terminology Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Stop inferring chat role from resource Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Simplify provider chat resolution Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Require exact source chat for forks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Let providers observe session config Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Restore subagent transcripts lazily Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Complete chat-only provider ownership Route provider provisioning, restore, lifecycle, configuration, and active-client behavior through exact chat-addressed seams. Preserve additive legacy default-chat migration across Claude, Copilot, and Codex and remove obsolete session compatibility paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix chat test field initialization Avoid directly reading the overridden chat surface from subclass field initializers so define-class-fields compilation remains safe. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Keep session chat roles in Agent Host Move legacy backing selection and session-versus-peer materialization filtering into Agent Host. Providers now recover or materialize exact opaque chat backings without retaining session/peer classifications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Make provider chat creation uniform Remove provider-visible chat role classification and collapse runtime initialization and additional chat creation into one createChat operation. Document and test the registry backfill's idempotent, coalesced migration behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Flatten provider chat creation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove session ownership from agent chats Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address active clients by chat Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Make agent provider seams chat-only Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Organize agent provider contract Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Group legacy chat recovery APIs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Document agent capability optionality Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Separate agent provider model Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix cold peer-chat fork to read source chat's own persistence resource Cold peer-chat fork previously read the shared configurationResource overlay instead of the source chat's own persistence resource, so inherited model/agent/permissionMode came from the wrong scope for any non-default source chat. _chatConfigScopes now records both the configurationResource and the exact resource (IChatScopeBinding) for each chat, and _bindInheritedConversation reads the source overlay by the source's own resource. Also adds a backing-model fallback for a source that was created but never materialized. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add regression tests for cold peer-chat fork scope inheritance Covers two scenarios for the claudeAgent.ts fix (commit aabdead86d7): - a peer chat materialized before a cold restart forks with its own model/agent/permissionMode/workingDirectories, not the session-wide decoy overlay - a peer chat never materialized before a cold restart still recovers its model via the _chatBackings fallback Also adds a per-resource-aware ISessionDataService test double, since the shared sessionTestHelpers.ts fake ignores the resource argument and returns one flat database for all resources, which would otherwise mask the session-vs-peer overlay bug. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Complete Agent Host chat ownership migration Make session registry migration durable, preserve exact chat backings across provider restore and lifecycle paths, and harden deletion and rollback behavior. Rename the architecture spec and add regression coverage across providers, migration, concurrency, and protocol restore. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Restore Agent Host checkpoint lifecycle * Fix Agent Host CI test portability --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Sandeep Somavarapu · 150119bd · 2026-08-12
- 17.0ETVSessions exploration (#294912)Benjamin Pasero · b1009c98 · 2026-02-17
- 17.0ETVSessions: one session object per session (#346561) * Sessions: remove unused ResourceOverrideSession `VisibleSessions.updateResourceOfSession` and its `ResourceOverrideSession` adapter have no production caller. Remove both, and keep the metadata forwarding test for the visible session wrapper. First commit towards one canonical session object shared by all session hosts (follow-up of #346171). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: pickers read the model and mode of the chat a host shows The model and mode pickers read `IActiveSession.modelId`/`mode`, which a session wrapper of the Agents window overrides with its active chat's. Once hosts share one session object, there is no such wrapper. Read the chat the host shows instead: - `SessionModelSelection` takes an `ISessionChatSource` (session and chat) and reads the chat's model, re-binding when the chat changes. A composer bound to another chat than its session's active one now selects that chat's model. - `ScopedModePickerModelCache` is keyed by the source and reads its chat's mode; the agent-host agent picker reads the focused host's chat. - The phone input context and the chat view's preparation input read the chat's model. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: read whether a session is created from its status `IActiveSession.isCreated` is the session wrapper's map of `status`: created once it is no longer untitled. Hosts will show the provider's session, which has no such member. Add `isSessionCreated(session, reader?)` next to the other status helpers and read it at every place that asked a host's or a pane's session, keeping narrowing where the session was optional. Test fakes that set `isCreated` now set the `status` that agrees with it, through the shared `withCreatedStatus` test helper; the layout test session derives `isCreated` from its status. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: ask the grid about panes by their hosts The grid answers which of its panes is active or detached for a pane's own session object (`isActivePane`/`isDetachedPane`), which identifies a pane only while each pane has its own copy of the session. Add host-addressed queries that do not depend on that identity: - `ISessionGridPanes.isActivePaneHost`/`isDetachedPaneHost`/`isGridPaneHost`: the grid host stands for the grid's active pane, the host of a slot's or a detached pane's view for that pane, including the new-session slot; other hosts, such as a chat window's, for none. - `ISessionsPartService.getSessionViewOfHost` finds the view of a host. - `getHostOfSession` keeps its URI signature and uses them. The session-addressed queries stay until their last caller moves. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: pane commands find their pane by its host, not its session object Pane commands, such as Pin, Close or Toggle Maximize, found their pane by the identity of the session object the pane's toolbars pass. Once panes share one session object, that names no pane. Name the pane by its host: - The menus of a pane's header, toolbars and chat tabs append the host's command context to their arguments (`sessionMenuArgs`: `[session, chat | undefined, hostContext]`), so session-level commands shared with the sessions list still get the session first. - `resolvePaneCommandTarget` resolves the pane of the host the arguments name: its view and session for a pane of the grid, else the opener of the surface that shows its chat (`getChatHostOpenerOfHost`); without a host, as from keybindings, the grid's active pane. - `resolveSessionCommandTarget` no longer names a host by the identity of a session object; a session resolves by its resource. - The Changes view's action bars pass the command context of their window's host too, so its actions, such as skill buttons, act on a chat window's chat. - `ISessionsService.getPaneSessionOfHost` maps a host to the grid's view of its pane's session until the pane API replaces it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the grid publishes a pane object per grid slot Add `ISessionGridPane` (sessionGridPane.ts): a pane of the main window's grid, a slot or a detached pane, with its kind, the session and chat it shows, its pin and its tab strip. The grid owns it, and it lives as long as its grid slot: its id is the slot id, which a replacement of the session, such as a draft graduating, keeps. - `VisibleSessions.panes`/`activePane`/`getPane` publish the panes in the same transaction as the wrapper arrays and the active session, so no reader sees a pane list and a session list that disagree. - Until the views move to the pane, each pane shows the state of the current adapter (`VisibleSession`) of the session incarnation it shows. A replacement gives the pane a new adapter, as it gives the grid a new wrapper today, and keeps the pane and its id, so views that rebind on a new wrapper keep rebinding. - `ISessionGridPanes.getPaneOfHost(host)`: the grid host stands for the active pane, including the new-session slot's; the host of a view of the grid for the pane of its slot (`ISessionsPartService.getPaneIdOfHost`); other hosts for none. The `*Host` booleans are reimplemented over it. - Tests: panes of a slot and a detached pane share the session object and keep their ids; same- and different-id replacement keeps the panes and publishes atomically; a detached active pane writes the remembered active chat while closed tabs stay the slot's; a layout of only a detached pane saves, restores, closes and reopens. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: address panes of the grid by pane objects, not session wrappers `ISessionsService` gains the pane API: `panes`, `slotPanes`, `activePane`, `activatePane`, `closePane`, `collapseToPane`, `detachChat(pane, chat)`, and focus, move and resize in a direction by pane. `closeChat` takes the session. Until the views move to panes, the pane members act through the adapter of the session incarnation a pane shows. - `ISessionGridPanes` takes its final shape: `getPaneOfHost(host)`, and `isActivePane(host)`/`isDetachedPane(host)`, renamed from the `*Host` queries together with their last callers. The queries by session wrapper, `isGridPaneHost`, `getPaneSessionOfHost`, `activePaneId` and `getSessionPaneId` are removed. - The part fires `onDidFocusPane` with the slot id of the view that gains focus, and focuses a pane by `focusPane`. - Pane commands act on `IPaneCommandTarget.pane`. - Migrated to panes: the comparison grid controller (pane ids for its isolated judge), Back/Forward's current entry (the active pane's session and chat), reopen-closed focus, the window notifier, Sync Changes, the conversation actions, and agent feedback channels. Request telemetry counts the slots that show a session, as before. - Focus moves into the active pane when the pane or the session it shows changes, but not into the grid's initial pane, and the active pane's view listeners rebind for either. - Test fakes of the sessions service publish panes for their sessions (`testGridPanes`, `testGridPane`). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: hosts of the grid show the provider's session object A host's session is the provider's `ISession`, one object for every host that shows it; the state of the pane that shows it, its pin and tab strip, is the pane's. - `IHostSession` is `ISession`. `ISessionPaneTabs` and the new `IPaneViewState` (pin, tab strip, detached) move to the common layer. - `setHostSessionContextKeys(session, chat, paneState, ...)` reads the pin and tab keys from the pane state. Without a pane, as for the Changes view's scoped session actions, the session is not pinned and shows no tab strip; only grid-window commands and the session header read those keys. - `SessionHost` shows a session and a chat of it, observing both without owning them. `ActiveSessionHost`, which the chat windows, composers and the automation dialog still use, is a subclass that shows a session view's active chat. - The grid host shows the active pane's session and chat. A view's host shows the provider's session of the grid's view it binds (`canonicalSessionOf`, until views bind their pane). - `findSessionOfChat`, the input toolbar and its pills take `ISession`. A pill action activates the pane of the grid that shows its session (`activateSessionPane`): through `setActive` for a session view, else the first pane that shows the session object, the pane that showed it before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: pane views take the content of their pane The pane chrome takes the content of the pane it is a view of, `ISessionPaneContent`: the provider's session, the chat the pane shows, the pane's state (pin, tab strip, detached), and how to close the pane. A view cannot close its pane by closing the session it shows any more: for a detached pane that would close the session's slot. - ChatGroupsView runs on the content: whether the pane is detached decides the carried layout, the drop target and persistence; its tabs come from the pane's state; closing its last group closes the pane. - The chat group context, ChatHeader, SessionHeaderBar, ChatCompositeBar and SessionRemoteConnection take the provider's session; a chat drag and the parent context read whether the pane is detached, and closing the main chat's tab closes the pane. - SessionView builds the content of the grid's view it binds, and closes its own pane (`closePane` of its host's pane) only while it still shows that content: a content kept past a rebind, such as a replacement of the session, or past its pane leaving the grid, closes nothing. - A chat window's editor builds the content of its window's view of the session, and closes through its opener until the window shows the provider's session. - Until the views bind their pane, ChatGroupsView and SessionHeader also take a view of a session, as their tests still give them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: composers show the provider's session object The new-session composer, the composer of a new chat in a session and the automation dialog run on the provider's `ISession`, not a view of it: the draft a pane or the dialog shows is the provider's draft object itself. - `IChatViewOptions.session` is the provider's session; a pane passes the chat it shows as `chat`. A chat window's editor passes its window's active chat the same way. - NewChatWidget shows the provider's draft (`newSession`) or its pane's session without wrapping it; quick chat creation returns the session. - NewChatInSessionWidget, SharedChatInputComposer, the composer input, the migration notice and the worktree suggestion take `ISession`; the composer's host is a `SessionHost` of the chat it shows. - The automation dialog observes the provider's automation draft non-owningly; its host and model selection show that draft and its main chat. - `shownChatOf`/`readShownChat` resolve the chat a composer shows while views of a session still reach it: the explicit chat, else the view's active chat, else the main chat. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: chat windows show the provider's session object A chat window shows the provider's `ISession` and the chat of it, which it observes without owning, instead of a copy of the session scoped to the chat: closing the window or moving its chat disposes no session. - A window's chat holds the provider's session and chat; its editor's pane shows them as a detached pane does, its one chat. Closing the pane closes the chat in its window, through the window's opener, only while the window still shows that chat of that session: a content kept past the chat being replaced, or ending, closes nothing. - The window's host and its editor's host are hosts of the provider's session and chat; the editor binds the keys of its pane's content. - The grid no longer special-cases a copy that another surface shows: `setActive` and `closeSession` act on the grid only. - A pill activates the pane its host is in, also from a host nested in it. A host of the main window outside its panes, such as the Inbox's, activates the pane of this grid that shows the chat it acts on: the detached pane of the chat, else the session's slot. A pill in a chat window leaves the grid as it is. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: remove ActiveSessionHost No host shows a view of a session any more: every host shows the provider's session and the chat it shows of it. The tests and component fixtures that built hosts of views of sessions build `SessionHost`s, giving the chat they show explicitly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the grid's views show its panes The sessions part renders the grid's panes rather than views of sessions: the view of each grid slot shows that slot's pane, and binds again as the pane shows another session, such as a replacement of it, while it follows the pane's chat and tabs. Code outside the grid's model reads its panes. - The sessions service renders the panes (`updatePanes`), also as a pane's session changes, before it moves focus into the active pane. `SessionView.openPane(pane)` binds to the pane's session, and follows a replacement by the same object through the pane's tabs and chat. - The part looks up panes by position, neighbor and view, and maximizes, resizes and focuses a pane; `updateVisibleSessions` and the lookups that returned views of sessions are removed. - Moving, focusing and resizing in a direction act on the exact pane, a detached one too. The chat commands of the grid read the active pane's tabs and chat. - The readers of the sessions the grid shows read its slot panes, and the main window's context keys its active pane. - The sync-changes button returns focus to the view of its own host. - Views of sessions remain only for tests, deprecated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: service tests show sessions and chats, not views of sessions The host and pane test helpers take what a host or pane shows (the provider's session and a chat of it, with a pane's pin, tab strip and detached state), and accept the old views of sessions transitionally. Six service suites build their hosts and panes from those. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the focused host stub follows the active window entry stubSessionHostsFromSessionsService found the focused chat window by the session it shows, so with one session in two windows it always picked the first. It now picks the window of the active entry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: management service tests drive the grid's panes The tests read the grid through its panes (the active pane, the slots and the detached panes, and each pane's session, chat, tabs and pin) and act on panes, rather than through views of sessions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the canvas focus test compares the session it had before The check compared two reads of the active pane's session after the operation, which agree whenever the pane does. It now captures the pane and its session before opening the canvas and compares those. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: navigation from a detached pane's views stays in that pane The views of a detached pane passed their own view of the session to openChat and openNewChatInSession, which kept the navigation in that pane. Since they pass the provider's session, opening another chat of a session whose slot is closed replaced another session's slot. They now pass their host: from a host that stands for a detached pane of the session, the navigation stays in that pane and the session's slot goes beside it. Without a host, as from the sessions list, nothing changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: tests fake the active session as a session with its shown chat A mechanical rename of the IActiveSession type to ITestSessionWithChat in the tests whose fakes are only ever seen as a session and the chat its host shows. ITestSessionWithChat, a session fake carrying activeChat, lives in the test utilities; new tests use ITestShownChat. The tests whose fakes still reach members typed IActiveSession move in later commits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the parts tests show session fakes through panes and pane contents The parts tests give their views panes (SessionView.openPane) and pane contents (ChatGroupsView and SessionHeader setSession) instead of views of sessions, through test helpers that keep one pane and one content per session fake, so a view given the same fake keeps what it shows. Their fakes are sessions that carry the pane state the grid gave them. No fallout fixes were needed in other tests or fixtures: the shared session fake keeps lastClosedChat, so it still satisfies the members that take IActiveSession until they are removed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the chat, chat editor and chat window tests fake sessions with the chat they show The tests fake the sessions their hosts show as sessions carrying the chat they show, and give UI a source of the session and chat (testChatSourceOf), a pane (testPaneOf) or a pane content (testPaneContentOf) instead of views of sessions. Their sessions service stubs model the grid's panes with gridShown rather than visibleSessions. Type-only: the openQuickChat fake in newSessionAction.test returns the type of ISessionsService.openQuickChat. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the contrib tests fake sessions with the chat they show and act on panes The remaining contrib tests (apart from the providers) fake the sessions their hosts show as sessions carrying the chat they show, model the grid's panes with gridShown, and their fakes of the sessions service and part override the pane members production calls instead of the members kept for views of sessions. ITestSessionWithChat now declares, as optional, the pane state legacy fakes carry (tab strip, pin, isCreated, the chat of a detached pane). Type-only fixes: - sessionsActions.test: two openQuickChat fakes return the type of ISessionsService.openQuickChat. - sessionsActions.test and sessionsPolicyBlocked.test: the fakes of focusActiveSession pass their session to the part's focusSession as its parameter type. - newChatMigrationNotice.test: isCreated overrides the member it declares again. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: Open in Editor transfers only sessions their provider created getChatSessionToOpenInEditor decided that a session was created from an isCreated member, treating its absence as created, so a provider's draft session (status Untitled, no such member) and its chat could be handed to another window. It now reads the provider's status (isSessionCreated). Without a chat, Open in VS Code opens the folders of the session's main chat rather than of an active chat the session does not have. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: Sync Changes from a composer syncs the composer's chat The composer's repository toolbar passes its session to Sync Changes, which read the active chat of that session. Composers have shown the provider's session, which has no active chat, so Sync Changes from a composer threw. The toolbar now passes the chat the composer shows with its session, and the action syncs that chat. Changed expectation: the sessionSyncChanges test of the menu action, which mirrors the composer's argument, now expects { session, chat } instead of { session }, as the composer passes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: subagent chat links look up the sessions of the grid's slots The subagent chat lookup reads the sessions of the grid's slots from its panes rather than from the views of sessions the grid kept for them: the same sessions in the same order, without the new-session slot. Its tests fake the grid with the slot panes, and a test pins the order and the skipped new-session slot. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the provider tests fake sessions with the chat they show The provider tests fake the sessions their hosts show as sessions carrying the chat they show, give UI a source of the session and chat (testChatSourceOf) instead of views of sessions, and model the grid's panes with gridShown rather than visibleSessions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the fixtures fake sessions with the chat they show The component fixtures fake sessions as the tests do: as the provider's session with the chat a pane shows (`ITestSessionWithChat`), with the grid's shown sessions in `gridShown` and its slot panes built from them, instead of the deprecated `IActiveSession` and `visibleSessions`. - The grid fixture activates a focused pane through a fixture-local `activate`, and maximizes the left session through its view's pane. - The workbench fixture utils count slot panes for the multiple-sessions key, and the part fake maximizes a pane. No fixture renders differently: every `sessions/**/Light` fixture renders the same before and after this change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the session pills fixtures provide the window's session host The session chat input toolbar takes the host it is shown in since chat windows show the provider's session object, and the session pills and chat reference fixtures failed to render without one. Their services now provide the main window's host of the fixture session and chat, which the input banners already used, so the toolbar and the banners share it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the workbench session fixtures fake sessions with the chat they show The session component fixtures under the workbench fake sessions as the other fixtures do: as the provider's session with the chat a pane shows (`ITestSessionWithChat`), and the grid's shown sessions in `gridShown` with its slot panes built from them, instead of `IActiveSession` and the deprecated `visibleSessions`. - The pills fixture's session carries no pane state, so it is an `ISession`. - The header fixture gives the header its pane's content (`testPaneContentOf`), which the header built from the session before. - The composite bar's fake keeps its tab strip's `shouldShowChatTabs` required. No fixture renders differently: every `sessions/` fixture renders the same before and after this change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: remove the session-view entry points of the grid, its part and its views The grid, its part and its views are addressed by pane only. The members that took a view of a session in a pane (`IActiveSession`) go, with the helpers that converted one. `IActiveSession` remains only inside the grid's model, which the next commits rewrite. - `ISessionsService` loses `visibleSessions`, `visibleSessionPanes`, `setActive`, `focusSessionInDirection`, `moveSessionInDirection`, `resizeSession` and `collapseToSession`. The service keeps the ones its model still drives as private members. - `ISessionsPartService` loses `focusSession` and `toggleMaximizeSession`. `focusNewSessionSlot` replaces `focusSession(undefined)`, the one use left, and focuses the same view. - `SessionView.openSession` goes. `SessionHeader.setSession` and `ChatGroupsView.setSession` take their pane's content only, and the header no longer depends on the sessions service. - `paneContentOf`, `isSessionPaneContent`, `canonicalSessionOf`, `paneViewStateOfActiveSession`, `setActiveSessionContextKeys`, `sessionChatSourceOf` and `readShownChat` go. - A surface given no chat shows its session's main chat: `shownChatOf` and the composer's bound chat no longer read the active chat of a view of a session. No surface relies on it: the grid's composers pass their pane's chat, and other composers show provider sessions. - `openQuickChat` returns the provider's session. The github PR and issue actions take sessions. Tests: - Fakes of the service and the part override the pane members and `focusNewSessionSlot`, keeping their recorded labels. Service fakes record `focusActiveSession` themselves instead of through the part. Host stubs read `gridShown` only. - `testPaneContentOf` gives the main chat when a fake has no active chat, as a session view gives its content. - Tests that relied on the active-chat fallback pass their chat. - Changed expectation: the composer test now pins the main chat ("binds the host's chat when it has one, otherwise the session's main chat"); with the old fallback it binds the fake's active chat. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the grid's model publishes panes, not its views of sessions The grid's model publishes its panes and the sessions of its slots, the provider's sessions, instead of the views of sessions it keeps per pane. The sessions service reads the grid only through its panes. The model still keeps a view of each session inside, which the next commit replaces. Model: - `gridSessions`, `activeSession`, `visibleSessions`, `getGridSession` and `getAdapterOfPane` are no longer public, and `isActivePane`, `isDetachedPane` and `isGridPane`, which nothing called, go. - `slotSessions` publishes the sessions of the slots as `visibleSessions` published their views: in the same order and transactions, with `undefined` for the new-session slot. - `setActive` takes a session or one of the grid's own panes, and ignores another grid's pane. `getChatPane` returns the detached pane. Service: - The chat a detached pane shows, its `chat`, replaces the scoped chat of its view. A pane's active chat follows its pane. - `closePane` attaches the chat of a detached pane back to its slot; `closeSession` closes a slot. Closed-session history and the new-session discard get the provider's session. - The reactions to the active pane read the chat it shows of their session only while it shows that session, as they read the chat of the session's view before. - The grid state saves its bindings from the panes, as version 1 did. Tests: - The model's tests read panes. Two tests whose subject was the view are renamed for the pane, with the same expectations: "the active pane shows the provider's session itself, with its metadata" and "replaces the session of the pane even when the session id is unchanged". - The atomic replacement test reads the slot sessions and the active pane's session; its four variants and expected values are unchanged. - New: "a stored grid of slots and a detached chat restores and saves back byte for byte (v1)", which also passes on the previous commit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the tab tests of a session's slot drive the grid The tests of a session's tab state drive a grid that shows the session in a slot, instead of the view of the session the grid keeps per slot: the grid seeds the slot from the session's persisted state, the tab operations go through the grid, and the state is read from the slot's pane. Their bodies and expectations are unchanged. The test of the view forwarding every session property goes: a pane shows the provider's session itself, which "the active pane shows the provider's session itself, with its metadata" covers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the grid round-trip test compares what the restored grid writes The test of a stored grid restoring and saving back byte for byte removes the stored state after the restore, so it compares what the restored grid writes with what it was restored from. Before, the stored state was still there, and the test passed even if the restored grid wrote nothing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the provider's model selection test shows the draft's own chat The test of the shared model selection for automation drafts gives the selection the draft and its main chat, as the composer shows them, instead of a view of the draft that the grid keeps per slot. Its expectations are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: a pane keeps the state of the session it shows, not a view of it The grid's model no longer wraps the sessions it shows. Each pane keeps the state of the incarnation of the session it shows, and a replacement of the session swaps that state in one transaction, keeping the pane: - the state of a session's slot: its active chat, and its tab strip with the chats closed in it, the subagent chats shown in it and the chats other panes or windows show; - the state of a detached pane: the one chat of its session it shows, and that chat as its tab strip. The state is not a session: it doesn't forward the session's properties or carry its active chat's model and mode, and `IActiveSession` goes. A detached pane is its state's kind, not a session scoped to a chat. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the session of a host is ISession, and the last session-view names go - `IHostSession`, an alias of `ISession`, goes: hosts show the provider's session itself (by tool, 28 files). - The test-only fake's detached flag is `detachedChat`, not `scopedChatResource`, which production no longer has (by tool). - The sessions part's `toggleMaximizeSession`, which nothing calls, goes, and its `focusSession` is `focusNewSessionSlot`: it was only called to focus the new-session slot, which it finds as before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: document one session object per session The session host contract and the layout documents describe the grid after the session views went: every host shows the provider's session object, and the grid keeps each pane's state (the chat it shows, its tab strip, its pin), with a detached pane as a kind of pane. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: a pane view keeps showing its session until it binds the next one A pane outlives the sessions it shows, and a view of it bound its content to the pane's own tabs and chat. Opening a session over the one a slot shows changed those before the view was bound to the new session: for a moment the view showed the old session with the new session's tabs, so its chat group found no chat of the old session, built a new-chat composer, and then a chat view again for the new session, instead of handing its chat view over. The content a view binds now follows the pane only while the pane shows that session, and keeps what it last was afterwards (paneShownOfSession). The view keeps its chat view and hands it to the next session, as before panes were introduced. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sessions: the grid fixtures fake the pane lookups the pane commands use The header's pane commands resolve their target from the host their menu passes: the part service's view of that host, then the sessions service's activatePane (Maximize) and closePane (Close). The grid fixtures' fakes lacked those, so Maximize from a pane's More Actions threw before it maximized, failing the Playwright test "sessions grid header actions update their owning state". Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Sandeep Somavarapu · 29ce94ad · 2026-11-06
- 15.2ETVSessions: session hosts replace the active session (#346171) * sessions: add session hosts backed by the current state Introduce ISessionHost, ISessionHostService and IFocusedSessionHostService. The main window, chat windows, session views, the shared chat input composer and the automation dialog provide a host, nested through DI. ISessionScope reads the window host. Behaviour is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: add the session command resolver resolveSessionCommandTarget resolves what a Sessions command acts on from its arguments: a host, editor group, window, chat or session, or the focused host without arguments. Arguments that name something that is not found resolve to nothing. The existing resolvers now read the hosts instead of the scoped services of chat windows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: move Changes, feedback overlay and terminals to session hosts The Changes scope carries the session and chat of its window host and whether that is the main window, instead of comparing observables with the main window's active session. The feedback overlay and chat window terminals look up the host of their editor group or window. Root services of the main window look up its host. Helpers that read the selected chat now take the host's chat. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: move session pickers to session hosts The agent host mode, permission, approvals and config pickers, the Copilot mode picker, the mobile config picker and the model picker take the session and chat of the host they are created in (ISessionChatSource) instead of the session context, and read that chat instead of the session's selected chat. The phone input context and the worktree suggestion take the chat explicitly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: pass the pane session down to new-chat composers The session view passes its session to the chat views it creates (IChatViewOptions.session). The new-session and new-chat-in-session widgets show the draft of their pane instead of reading the active session, which could be another pane's or another window's. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: move canvases and session input banners to session hosts The canvas context service finds the window that shows a canvas owner through the host of its chat: a chat window that shows the chat, else the main window while it shows the session. The canvas contexts follow the focused host. The session input banners show the session and chat of their window host. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: open canvases in the window that shows their chat A canvas opens in the main part of the chat window that shows its owner's chat, else in the main window, instead of in the window whose editor group is active. A canvas of a chat window opened while another window had focus no longer lands in that other window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: move the title bar widget and chat groups to session hosts The command center's session title shows the session and chat of the window whose title bar shows it, created with that title bar's services. A chat group view compares its session with that of its window host rather than with the active session. The workspace display info takes the chat explicitly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: act on the last focused window while the app is in the background Without a focused document, the focused host is the window host that last had focus instead of the main window, which getActiveWindow falls back to. Commands without arguments run from the background, such as from the dock, act on that window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: move window-independent consumers to the focused host Services and contributions that follow focus read the session and chat of IFocusedSessionHostService.focusedHost instead of ISessionsService.activeSession and its selected chat: agent feedback, browser views, canvases, Changes activity, workspace handoff, AI customizations, artifacts, voice, turn changes, code review, tours, agent host pickers and presenters, customizations, the workspace folders and labels, and telemetry. Behaviour is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: look up shown sessions through session hosts The Agent Host provider, GitHub pull request polling, worktree cleanup and the Agent Host customization lookup no longer read the view state of ISessionsService. Shown sessions come from the session hosts, the main window's session from its window host, and the focused session from the focused host. The providers no longer depend on ISessionsService. Behaviour is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: treat sessions shown in any window as in use Worktree cleanup no longer offers the worktree of a session that any host shows, and pull request polling keeps polling draft CI checks and merged pull requests while any host shows their session, not only the focused one. Polling stays one per session and stops once no host shows it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: run host lookup tests on the real host service sessionHostServiceOf registers plain hosts for the state of ISessionsService in a real SessionHostService, so the tests of host lookups go through the real nesting, ownership and window rules instead of a parallel fake. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chatWindow: commands named for another window act on no chat window resolveChatWindow fell back to the chat window that has focus when its arguments named a group or window that is not a chat window's, such as a command run from the main window while a chat window had focus. Arguments that name where a command runs now resolve to that chat window or to none; only commands without them act on the focused chat window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: move the Run action to session hosts The Run actions act on the session and chat of the focused host, and the Run button of a title bar on those of the window host it shows in, instead of the active session and ISessionScope. Behaviour is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: resolve command targets through session hosts Commands that take a session, a chat, a session resource or nothing resolve what they act on with resolveSessionCommandTarget, and the chat-window tab entries, the Changes editor's changeset selection and Open in VS Code read session hosts. resolveSessionActionTarget, findSessionByResource, findSessionByChatOrResource, getFocusedWindowSession and getChatWindowSession are removed. A session that several windows show resolves to its host in the focused window, with the chat that host shows, as the old resolver did. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chatWindow: let a chat window show several chats A chat window shows a list of chats, each an editor of its chat part, in any group and grid shape of the part. The provider's content is window-level and resolves chats one at a time. The window's chat, chat editor and title are those of its active chat: the chat editor last active in the window. Closing or ending one chat removes only that chat, and the window closes with its last chat. Moving one of several chats out of the window takes only that chat out. Move to Main Window carries all its chats, and restoring keeps the list and the active chat, still reading the entries of one chat or session. The Agents window's provider still shows one chat per window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: show the chats of a chat window as chat editors A chat window now holds chats in plain editor groups, one chat editor per chat, rather than a session view of a copied window session. Each chat editor shows one chat, with no inner chat tabs, in a pane host nested in its window's host, which follows the active chat editor. - The chat editor moves to contrib/chatEditor, without depending on chat window services. - A chat a window shows stays out of the main window's grid through ISessionsService.hideChatFromGrid. - Opening a chat a window shows reveals it there, and a chat opened beside one it shows opens beside it, through IChatHostOpenerService. - Focusing a chat window no longer makes its session the active session. - Move to Main Window carries all chats of the window. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: drop the session copies of chat windows Chat windows show chats as chat editors, so the sessions service no longer shows sessions in windows of their own. Removes showSessionInWindow and the window sessions of the visibility model, with their activation on window focus, and the window session views of the sessions part. windowSessions stays empty, and mainWindowActiveSession is the active session, until the session API shrinks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: lay out the main window from its session host Main-window-only UI (the layout controller and its strategies, the sessions list, the sessions view, the mobile title bar and the comparison grid) reads what the main window's session host shows instead of the sessions service's active session. The grid exposes `activePaneId` and `focusActiveSession()` for its own pane identity and focus. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: route voice and tours to their owner hosts Voice reads the focused session host, so it follows the chat window the user talks to; new sessions still open in the main window, whose composer it checks. The new-session view tours read the main window host, which owns the new-session view they guide through. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: resolve command targets without the active session Commands that act on a session or chat resolve it with resolveSessionCommandTarget: their arguments, else the focused host. Commands of the main window's grid act on the grid's active pane through ISessionsPartService.getActiveSessionView(), and neither match their keybindings nor act while a chat window is the focused host, so its chat editors and editor groups keep their keys. Follow-ups after opening a new session, and the main window's Changes and sessions list, read the main window host. - Focus Chat Input focuses the input of the chat the focused chat window shows. - A side chat is sent in the background only when the window that shows its source chat navigates away from it. - Delegating to an agent host takes the folder of the focused host's session, and opens beside it when the grid shows it. - The chat input toolbar finds the session of a chat among the grid's panes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: give the grid its host and drop the active session from the sessions service SessionsService creates the main window's host on the grid's selection and exposes it as gridHost; the host lookups register that instance, and the main window's UI injects it, through a temporary alias that C10 removes. activeSession, mainWindowActiveSession and windowSessions leave ISessionsService: the grid's selection stays internal to the service, and others read the windows' hosts. Test mocks keep the grid state they model as test fields, typed by ITestSessionsGridState, from which the session host test helpers derive the hosts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: remove the session scope and context in favour of session hosts UI reads the session and chat of the host it is in. The Sync Changes button reads its host, so in a chat editor it shows the editor's chat rather than the grid's active session, and returns focus to its own surface. SESSIONS.md describes the session host contract. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: create the main window's parts with its own session host scope The root no longer provides a session host: the main window's parts (the sessions grid, custom views, panel, sidebar, auxiliary bar, editors and title bars) and window canvases are created from a child scope that provides the grid host, so a root singleton that injects a session host fails instead of silently getting the main window's. The focused host and the automation dialog look their hosts up. Items of workbench-wide chat input menus that apply in session hosts only show nothing elsewhere, such as in Quick Chat. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: tell the grid's panes apart through the grid, not their sessions A pane host's session is the pane's own view of the session: a slot of the grid and a detached pane of one of its chats have different views of it. Code outside the grid no longer reads the grid's detached-pane field off a host's session, nor compares hosts' sessions as objects to find the session's pane. - The grid answers for a pane's own session whether it is the active pane and whether it is detached (ISessionsService.isActivePane and isDetachedPane, backed by its detached panes). - getHostOfSession picks, of the panes of a window that show a session, the window's active pane (the grid's, or the one that shows the window's chat), else the one that is not detached. - The session a pane's toolbars pass still names that pane, detached or not. - The pin and close commands check the chat the passed pane shows, and the comparison grid asks the grid whether its Judge pane is detached. - Opening a session in a chat window no longer filters detached panes out of the grid's visible sessions, which never include them. A canonical session object shared by all hosts of a session is left to a follow-up that removes the grid's detached-pane field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: show the grid's session in the sessions workbench fixtures The fixtures model the grid with a test sessions service. Since the title bar and the grid commands read the main window's host, the focused host and the grid's pane queries, the fixtures give the main window's host and the focused host the grid's active session, and their sessions service answers the pane queries for its slots. The title bar shows the active session again, and Maximize and Pin act on their pane. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: let a chat window terminal test finish its main part move The test opens a terminal in the window's main part, which moves it to the part that holds the window's terminals on a timeout. The test waits for it, so the move does not outlive the test (it leaked on WebKit). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: give the component fixtures the session hosts their UI reads Components now read the window's session host, the host lookups or the focused host instead of the sessions service: the Changes view, the title bar, the input banners, the sessions list, the new chat widget, the automation dialog, artifact activities and session changes. Their fixtures only modelled the session on the sessions service, so they failed to construct. They now stub the main window's host showing the fixture's session, the host lookups and, where needed, the focused host. The title bar's mock session reports itself created, as a real host reads that. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Sandeep Somavarapu · a6172668 · 2026-11-05