Skip to content

feat(vscode): port the agent manager to v2 - #15737

Merged
marius-kilocode merged 31 commits into
v2from
am-v2-seam
Nov 3, 2026
Merged

marius-kilocode merged 31 commits into
v2from
am-v2-seam

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

The Kilo v2 VS Code extension has no Agent Manager. The v1 Agent Manager is a large feature (334 source files on main: 137 host files and 197 webview files) that runs worktrees, parallel model runs, sections, tabs, terminals, diff and review, GitHub PR actions, multiple projects and orchestration tools.

This PR ports it to v2, keeping v1 behavior for every in-scope flow. The one structural change is the boundary: v1 talked to the server through its own session plumbing, and v2 talks through manager(), one client, one event stream fanned out by location.directory, and per-directory createData stores.

The panel is a second webview entry in the extension, so the extension, not the CLI, owns the window and the server.

Why This Change Was Made

The port follows the "copy the independent part, rewrite the boundary" strategy.

  • Copied unchanged (with the planned file splits): worktree manager, pool, git ops, setup scripts, base branch and branch names, env copy, sections, tab layout, project registry and clone, terminal host and routing, the diff subsystem, the PR modules and the pure UI components.
  • Rewritten as new v2 code (no v1 session plumbing):
    • connection adapter (src/agent-manager/connection.ts): one OpenCode.make client, one event.subscribe with reconnect, location filters, presence through session.view;
    • per-directory data in the webview (v2/panel-data.ts): one stream per panel, lazily created createData stores, released when a worktree or project closes;
    • state file under the v2 config directory, with a one-time read-only import of the old .kilo/agent-manager.json;
    • settings under kilo-code.v2.agentManager.*, added to KILO_SETTING_KEYS;
    • lifetime: panel dispose interrupts its sessions; deactivate interrupts busy sessions before the server stops.
  • Session surface reuse: SessionView was extracted from the sidebar chat, so the Agent Manager renders the same transcript, docks and PromptInput. The New Worktree dialog keeps its own textarea because it also handles slash commands, worktree mentions and images.
  • Server pieces are plugins: packages/kilo-plugin/src/agent-manager (the agent_manager and agent_manager_models tools, the kilocode.agent-manager RPC with start, requested and cancelled events, list/reply/reject/removeSnapshot, the state file guard and the permission hook) and packages/kilo-plugin/src/branch-name. Contracts live in packages/schema/src/kilocode.
  • Worktrees stay extension owned: the extension creates and removes worktrees and calls worktree.refresh; it never calls worktree.create, so the setup script cannot run twice. Teardown uses client.debug.location.evict.
  • Caffeination and visible presence: keep-awake uses the ported CaffeinationService; visible presence uses session.view instead of the removed registerVisible.

Five shared upstream files gain a small, generic seam:

  • packages/core/src/permission.ts passes the effective rules and the unattended rules to the evaluate hook, because the Agent Manager needs the rules core actually used to decide.
  • packages/plugin/src/effect/permission.ts types those fields.
  • packages/core/src/pty.ts accepts an optional allowExited attach input, so a script terminal can replay the output of a process that already exited.
  • packages/server/src/handlers/pty.ts passes replayExited=1 from the connect query to that input.
  • packages/client/src/solid/data.ts adds a per-session session.message.evict(sessionID), so closing a subagent inspector tab does not clear the parent transcript (covered by packages/client/test/solid-eviction.test.ts).

All are marked with kilocode_change and registered in script/upstream/shared-patches.json (limits 80 files, 1093 marked lines, 225 unmarked lines; the unmarked count comes from the base). The permission hook now matches v1: an exact "Always allow" for prompt, stop, move or answer sticks; a wildcard or broad allow asks again; unattended work denies a side effect without an exact approval.

Permissions and hot reload

The v2 rules are live, not snapshotted, and the port relies on that:

  • Agent permissions from config reload after about 100 ms, so a change applies to running sessions at their next tool call.
  • Session permissions are scoped to one session.
  • Saved "always" rules are scoped by the project ID (the git origin), so all worktrees and clones of the same remote share them. The project database stores them, so they do not appear in the settings permission editor.
  • Unattended rules apply to one scheduled check.
  • Models: a session pins its model at creation and resolves it against the live catalog on each step. A provider or model setting change reaches every session using that model from its next step. Sessions without a model re-resolve the agent or default model every step. Switching the model in one composer changes only that session.

User Impact

  • A new Agent Manager editor panel and commands under kilo-code.v2.agentManager.*, including "Open Agent Manager in New Window".
  • Worktrees: create with a prompt, quick create, compare models (multi-version), pool warmup, setup and run scripts, env copy, orphan import, delete, apply changes back.
  • Sessions: run in a worktree, multi-version grouping, continue in worktree, fork via the tab menu, session titles, branch auto-naming after prompts.
  • Organization: projects (add, create, clone, expand, route per project), sections, tabs, pinned tabs, tab order.
  • Terminals: embedded side terminals, main terminal tabs, script terminals, terminal destination (Agent Manager or VS Code terminal), terminal keybindings.
  • Diff and review: diff sources per session and worktree, apply to local, review comments, review send.
  • GitHub: PR status polling and badges, merge and conflict actions, review and check comments, push fixes.
  • Composer: the same control set as the sidebar (Code, model, effort, enhance, auto-approve, speech, send/stop), shared auto-approve and model picker state.
  • Shortcuts: read from the extension manifest and the user's keybindings.json, with live updates; the shortcuts popup reflects the same.
  • Keep awake: the sidebar header toggle uses the extension caffeination service.
  • i18n: all Agent Manager strings are present in every locale.

Evidence

Screenshots from the self-test:

New Worktree dialog with model compare

History view with session rows

Embedded worktree terminal

agent_manager permission dock

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72" fill="none">
  <style>
    .pulse { animation: pulse 2s ease-in-out infinite; }
    .flow { stroke-dasharray: 4 4; animation: flow 1.6s linear infinite; }
    @keyframes pulse { 0%, 100% { opacity: .25 } 50% { opacity: 1 } }
    @keyframes flow { to { stroke-dashoffset: -8 } }
    @media (prefers-reduced-motion: reduce) { .pulse, .flow { animation: none } }
  </style>
  <rect x="1" y="1" width="238" height="70" rx="8" stroke="currentColor" stroke-opacity=".35"/>
  <rect x="10" y="10" width="76" height="52" rx="6" stroke="currentColor" stroke-opacity=".55"/>
  <rect x="16" y="17" width="48" height="5" rx="2.5" fill="currentColor" fill-opacity=".7"/>
  <rect x="16" y="27" width="60" height="5" rx="2.5" fill="currentColor" fill-opacity=".45"/>
  <rect x="16" y="37" width="52" height="5" rx="2.5" fill="currentColor" fill-opacity=".45"/>
  <rect x="16" y="49" width="20" height="5" rx="2.5" fill="currentColor" fill-opacity=".3"/>
  <path d="M92 36h12" stroke="currentColor" stroke-opacity=".5" class="flow"/>
  <rect x="110" y="10" width="120" height="52" rx="6" stroke="currentColor" stroke-opacity=".55"/>
  <rect x="118" y="18" width="58" height="5" rx="2.5" fill="currentColor" fill-opacity=".65"/>
  <rect x="118" y="28" width="96" height="5" rx="2.5" fill="currentColor" fill-opacity=".4"/>
  <rect x="118" y="38" width="80" height="5" rx="2.5" fill="currentColor" fill-opacity=".4"/>
  <rect x="118" y="50" width="56" height="5" rx="2.5" fill="currentColor" fill-opacity=".25"/>
  <circle cx="212" cy="52" r="4" fill="currentColor" class="pulse"/>
</svg>

Automated checks

  • packages/kilo-vscode: bun typecheck clean, bun run lint clean, bun test 3134 pass, 0 fail.
  • packages/kilo-plugin: bun typecheck clean, bun test 501 pass.
  • packages/kilo-cli: bun typecheck clean, bun test 331 pass.
  • packages/client: bun test test/solid-eviction.test.ts 5 pass.
  • bun script/check-shared-patches.ts: ok (80 files, 1093 marked, 225 unmarked).
  • Windows: tests that wait on timers or git processes await the promise directly instead of expect(promise).rejects/resolves. That matcher waits in a nested event loop that does not fire pending timers on Windows (oven-sh/bun#39089), which stalled the Windows packages job. Test Git runs with core.autocrlf=false and core.eol=lf, git path comparisons fold separators and case, and temp cleanup retries the Windows EBUSY delay. The pool now cancels a scheduled replacement warm-up and waits for a running one on dispose, so no pool Git process runs after the pool is turned off; on Windows that running process also blocked temp cleanup. The Git-heavy project preparation tests use a 30 second per-file timeout, as the one Windows extension test in v1 does.
  • bun run check:architecture: ok (0 ratchet sites, 0 boundary violations).
  • bun run check:duplication: 16 bounded exceptions, 0 new duplication. The two copied keybinding modules were removed in favor of the shared src/keybinding-format.ts.
  • bun run lint:effect-simplifications: ok.
  • bun run startup in packages/kilo-cli: pass, with measured budgets for the two new plugins.
  • packages/core PTY replay test: pass.
  • The branch merges the latest origin/v2 (08cbbfa2fb4). Three conflicts were resolved: chat.tsx (kept the shared SessionView and passed upstream's todo chip through), dispositions.json (kept both sides), shared-patches.json (limits raised for the merge).

Self-test (VS Code, isolated profile, disposable repositories)

Environment note: the isolated v2 profile is signed out of paid models, so prompts used free Kilo models (kilo-auto/free and similar). No behavior under test depends on the model choice.

Flow Result
Panel opens and renders Pass
Local session prompt with a tool call Pass (correct answer, tool card, reasoning)
Quick worktree create and edit inside it Pass (root file unchanged, card shows +1/-1, title on card and tab)
Worktree create with a prompt Pass (opens at once, session runs in the worktree)
Worktree create from a subfolder workspace Pass (project root resolves to the checkout root, no ENOENT)
Multi-version compare (2 models) Pass (2 worktrees grouped, each on its own model and answer)
New Worktree dialog composer Pass (Code, model, effort, enhance, speech, compare, create)
Sections create, rename, delete Pass
History open, Local and Worktree tabs, rename, delete Pass
Button and tab order against v1 Pass (all groups compared; title order guarded by a test)
Tooltips and labels Pass (no unnamed controls; controls without tooltips match v1)
Worktree embedded terminal Pass (one socket, worktree cwd, no restart)
Run script start and stop (embedded) Pass (streams output, Stop ends the process)
Worktree setup script (embedded) Pass (marker written, Setup tab created). A script that exits before the tab connects now replays its retained output; covered by the core PTY replay test and the script terminal test, not yet rechecked in the UI after the fix
Terminal destination = VS Code terminal Pass for interactive terminals (Agent: local, Agent: worktree, default profile)
Terminal keybindings Pass (Cmd+/ toggle, Cmd+T, Cmd+Shift+T, Cmd+Shift+[ ], Cmd+W, Cmd+Alt+arrows)
Cmd+/ under panel load Pass (single toggle; stop the handled keydown removes the late echo)
Shortcuts popup and live override Pass (manifest values, user overrides, removal restores default)
Side terminal focus context key Pass (side-terminal shortcut opens a side terminal, prompt focus opens a tab)
Branch auto-naming Pass (renamed after the second prompt)
Stale tracked session Pass (pruned when the server reports not found, no raw error)
Window reload Pass (panel, last tab and transcript restored)
agent_manager "Always allow" Pass (prompt sticks, stop asks again)
Auto-approve and model picker sync Pass (both directions between sidebar and panel)
i18n key parity Pass (all locales)

Not verified in this PR

  • PR panel actions against a real GitHub PR (needs gh auth inside the isolated profile).
  • Import from PR or branch, clone project, and second project routing (network and gh).
  • Diff and review comment flows, the apply dialog end to end, and orphan worktree import.
  • The subagent panel (needs a turn that spawns subagents).
  • Continue in worktree (unreachable, see Known Gaps).
  • Closing the panel mid-turn, and moving the panel to a new window.
  • Terminals after a window reload.
  • Run and setup scripts in the VS Code terminal destination.
  • Windows and Linux terminal keybindings (macOS tested).
  • The full root bun run check: it fails on unrelated pre-existing errors (zlib.zstdCompressSync in packages/ai and two tool-shell tests in core), which fail the same way without this branch.

Parity Checklist

Area State
Worktrees (create, quick create, multi-version, pool, setup, delete, stats) Ported and tested
Sessions (local, worktree, multi-version, titles, branch naming) Ported and tested
Projects (registry, contexts, clone, onboarding, pollers, routing) Ported, audited clean, not self-tested
Sections and tabs (order, pinned, drag, persistence) Ported, tested for create/rename/delete
Keybindings and shortcuts popup Ported and tested
Terminals (routing, relay, script terminals, destinations) Ported and tested (interactive terminals)
Diff (sources, scope, cache, revert, apply-to-local) Ported, audited clean, not self-tested
Review (comments, annotations, markdown, send) Ported, audited, two send defects open
PR (poller, badges, merge, conflicts, reviews, push fixes) Ported, audited clean, not self-tested
Orchestration (tools, RPC, events, permission hook) Ported and tested
Caffeination Ported
Visible presence (session.view) Ported
Excluded epics No trace, see below

Defects Found During Self-Test and Fixed

  1. New Worktree dialog did not open: the "sessions loaded" flag was never set.
  2. Local tab vanished after the first prompt: v2 root sessions use an absent parentID, not null.
  3. The intro covered the transcript: it is now the empty state of an empty session only.
  4. A session loaded by two stores was listed twice: deduped by owning store, with a regression test.
  5. Clicking a worktree card showed "No sessions open": the project id was passed where the worktree id was expected.
  6. Webview activation crashed on import.meta: fixed in the build entry.
  7. The Agent Manager entry missed the shared kilo-ui styles.
  8. History crashed on useV2 must be used inside V2Provider: the list is now scoped to the project root store.
  9. Worktree terminals failed with 403: the socket URL did not name the ticket directory.
  10. New terminals connected before the PTY existed and restarted: the tab now waits for the created signal.
  11. Branch auto-naming never ran: prompts were not reported, and re-adding the session cleared the arming.
  12. Stale tracked sessions showed a raw error: sessions the server reports missing are removed after connect.
  13. A retrying session showed as busy: the overview reads the latest assistant retry.
  14. Creating a worktree from a subfolder workspace failed with ENOENT on .git: the project root is the checkout root.
  15. The terminal destination setting used the v1 key name.
  16. The shortcut map used v1 command ids, so manifest bindings were dropped.
  17. The side terminal focus context key was never set.
  18. Cmd+/ toggled twice when the panel was busy (late command echo): the panel now stops the handled key.
  19. VS Code terminal commands were missing from terminal.integrated.commandsToSkipShell.
  20. Four i18n keys existed only in English.
  21. The Agent Manager view title was leftmost instead of in v1 order, now guarded by a test.
  22. The origin/v2 merge brought a todo chip into the session dock; SessionView now passes it through.
  23. The duplication check found two copied keybinding modules (format-keybinding.ts and user-keybindings.ts duplicated src/keybinding-format.ts). The copies are removed and both the sidebar and the Agent Manager use the shared module.
  24. The Effect simplification lint rejected an Effect.catch that only failed with a transformed error; it now uses Effect.mapError.
  25. Two review tests imported happy-dom without declaring it; it is now a devDependency at the version kilo-ui already uses.
  26. Windows CI failed on path portability in the project and protection tests. Tests now derive canonical paths and project ids with the same helpers as production, and source-text tests normalize CRLF.
  27. The startup ratchet had no budgets for kilocode.agent-manager or kilocode.branch-name; both are added at the measured 0 ms plus the standard margin.
  28. A setup or run script that exited before its tab connected showed a connection error instead of its output. The PTY attach path now accepts an exited session when the connect query asks for it, replays the retained output and then ends, so the Setup tab shows the script output.
  29. The snapshot cleanup rejected a valid worktree on Windows when the global data directory used an 8.3 short name, because the trusted-path check compared two spellings of the same directory. It now resolves the data and project directories before inspection.
  30. Two review tests created happy-dom Window objects without closing them. They now close each window after the test, so timers cannot keep the test process alive.

Exact v1 Button Order and Tooltips

Checked group by group against v1. Only the view title had drifted; it now matches v1 (new session, history, Agent Manager, marketplace omitted, profile, settings), with test/chat-view-title-order.test.ts guarding it. The other groups already matched: sidebar header (search, keep awake, keyboard shortcuts), project row (project, new worktree, advanced, history, settings), worktree and session rows, footer (new project, add project), tab bar, inspector strip, session header and composer. Controls that carry only aria-label in v1 carry only aria-label here. The four new keys are translated in all 20 non-English locales, guarded by test/agent-manager-i18n.test.ts.

One PR instead of a stack

The plan preferred a stack of six PRs. This change ships as one PR because the seam, the panel, the per-directory stores, the worktree lifecycle, terminals, diff, PR and orchestration share one connection and one state model. Splitting now would produce intermediate PRs that do not build or run alone. The areas stay separated by directory and by the sections below, so a later split is possible once this base lands.

Placement

  • Plugin (rung 1): packages/kilo-plugin/src/agent-manager and packages/kilo-plugin/src/branch-name, registered through KiloPlugins; contracts in packages/schema/src/kilocode.
  • Host (rung 2): packages/kilo-cli registers the plugins; packages/kilo-vscode owns the panel, connection, provider and lifetime.
  • Seam (rung 3): the permission hook fields in packages/core/src/permission.ts and packages/plugin/src/effect/permission.ts; the exited-PTY replay in packages/core/src/pty.ts and packages/server/src/handlers/pty.ts; the per-session message evict in packages/client/src/solid/data.ts. All have markers and shared-patch entries.
  • Patch (rung 4): the regression test packages/client/test/solid-eviction.test.ts, and --log-order=stream for the packages test lane in .github/workflows/check-test.yml, so a stalled Windows task shows its last test.

Progress Map

Hand-written input only; generated outputs are left to CI.

  • Dispositions added: the two permission cells from the v1 hardening (packages/opencode/src/kilocode/permission/agent-manager.ts and its test), ported to packages/kilo-plugin.
  • Cells closed by file path on this branch: about 506 v1 packages/kilo-vscode cells that now exist at the same relative path in v2.
  • Cells that still need dispositions:
    • agent-manager 11: 4 modules and 4 tests ported into packages/kilo-plugin and packages/schema under a different feature box, plus 3 API cells that became the kilocode.agent-manager RPC (native).
    • branch-name 1: the test cell, ported to packages/kilo-plugin/test/branch-name.test.ts.
    • snapshot 3: cleanup module, its test, and POST /kilocode/snapshot/remove (now the removeSnapshot RPC).
    • caffeination 1: ported to packages/kilo-vscode/src/services/caffeination.
    • worktree 12: 4 modules, 6 tests, the teardown API (native, client.debug.location.evict) and 1 patch cell.
    • presence 7: dropped, attached-session presence is an excluded epic.
    • vscode about 28 Agent Manager cells: 13 dropped for excluded epics, 3 native (script-terminal-url, transcript-parts and its test), 12 ported tests whose v1 files became differently named v2 tests.
  • Patch proof markers still to add: worktree:34f2839b6fa6 and the two snapshot ids. The presence one goes away with the dropped dispositions.
  • Projected effect: about +5.7 points once these land (6.6% to about 12.3%).
  • Generated outputs are not committed. CI regenerates them in the bot PR.

Excluded Epics

Each is out of scope and leaves no control, import or dead module in the shipped code:

  • Sandbox metadata and the inheritance token (Sandbox #15309): excluded; the orchestration request carries no sandbox token.
  • Browser automation and the embedded browser: follow-up #15735.
  • Telemetry: excluded; no telemetry module or event.
  • Speech to text: no v1 speech code is copied. The composer uses the v2 speech implementation, so voice input works identically.
  • Documents panel: follow-up #15734.
  • Memory and Feedback providers: excluded; no provider, command or resource.
  • Attached-session presence: dropped; visible presence uses session.view.
  • Codebase indexing: out of scope; no indexing provider, model, consent or UI.
  • Cloud history tab (Import and migration #15306): belongs to the cloud sessions epic, so history shows local and worktree sessions only.

Investigations With No Code Change

These came up during the sessions and were checked, with no change needed:

  • Thick terminal scrollbar: xterm 6 draws its own 14px bar and v1 ships the same one, so it is not a regression. Native scroll areas use v1's thin rounded style.
  • GitHub authentication toast in the test window: the self-test harness isolates XDG_CONFIG_HOME, so gh cannot read the real login. v1 shows the same toast under the same harness, and the poller code matches v1.
  • Cmd+/ with the VS Code terminal destination: works when a shell has focus. An earlier failure came from a test window running a build that read the old setting key.
  • Cmd+F collision: the settings search and the Agent Manager search share the key but have disjoint when clauses, so VS Code resolves them correctly. The popup lists both, as v1 did.
  • CSP warning on the sidebar webview and the Node DEP0169 url.parse deprecation: both appear without this branch, so neither is caused by the port.
  • repoUsesLfs ENOENT log lines: the code matches v1 and the files are optional, so a missing file only means the repository does not use Git LFS.
  • Root typecheck and core test failures: zlib.zstdCompressSync type errors in other packages and two core tool-shell tests fail with or without this branch.
  • Harness relaunch with a reused profile: a lone New Session draft can stay selected while the previous transcript is shown, and a second profile sharing the repository can prune the first profile's sessions. A real Reload Window restores the panel, the last tab and the transcript correctly. Recorded as a harness artifact, not a product bug.
  • Setup tab location: a setup script terminal opens in the hidden side panel, not the main tab bar, which matches v1's side-terminal layout.

Known Gaps (complete audit)

The full audit with file references is in .kilo/plans/agent-manager-v2-audit.md, committed in this branch. Summary of everything still open, in the suggested fix order.

1. Data the host must push again

  • agentManager.projectSessions has no host sender. Project cards show no live session counts, search and @ mentions miss sessions, and the orchestration overview does not see live sessions.
  • The agent_manager tool drops model and variant for worktree sessions, so tool-created worktrees use the default model. test/agent-manager-tool-start.test.ts currently pins that loss.
  • PR polling does not receive the active worktree, so per-cycle polling has no target and PR data refreshes on the full sync only.
  • Worktree activity no longer follows connection state. pause and clear are dead, and permission and form badges can stay stale after a backend restart.
  • Tool-triggered multi-version progress omits projectId, so busy and done states can land on the active project.
  • Every open tab is marked viewed, so unread indicators clear for conversations the user never saw.

2. Composer and session view

  • Composer drafts are not keyed per session, so text typed in one tab can follow you to another tab and be sent to the wrong session. Draft agent and model also carry over between new-tab drafts.
  • Auto-approve sweeps only the selected directory store, so sessions in other worktrees stay blocked.
  • Read-only sessions keep a live composer: readOnly is computed and the banner shows, but SessionView does not receive it.
  • Unmanaged sessions render from the active project root store, so their transcripts stop updating and prompts carry the wrong directory.
  • The panel never requests display settings, so tool blocks always use defaults while the sidebar honors the config.
  • focusPrompt ignores force, restore and deferFocusToQuestion, so a mounting session view can pull focus out of the New Worktree dialog.
  • Cycle-agent while the New Worktree dialog is open changes the hidden session's agent instead of the dialog's.
  • The shared composer has no attachments, mentions or slash commands. Queued prompts can be viewed but not edited or cancelled. This is a shared v1-to-v2 loss that affects both surfaces.
  • Worktree @ mentions are computed but never passed to the composer, and worktree drag-to-prompt is missing.
  • /goal in the New Worktree dialog submits literal text. v2 has no goal UI yet.
  • Update from base does not send the visible session or its model and agent, so the host can run it in another session on the default model.
  • The PR conflict "Fix" action drops sessionId, with the same effect.
  • Fork session and fork message are reachable only from the tab menu, not from the chat header or each message.
  • Model attribution captures the model before a gated switch settles, so branch naming can use the previous model.
  • The Agent Manager dock reserves an empty 36px action row because SessionView receives hasActions without a row prop.
  • A stale promptAppend closure survives SessionView unmount, so review sends can target the previous session after a project switch.

3. Review and diff

  • Review comment sends are duplicated: onSendClick and onSendAll append the prompt while the review controller already dispatches the send. Send-all sends twice, and sendAllToGithub dumps comments into chat before publishing.
  • Terminal-targeted review comments are dropped. The diff viewer dispatches the event, the app returns early when targetTerminalId is set, and no v2 terminal listens. This affects inline comments, send-all, PR checks, PR summary, PR batches and remote replies.
  • kilo-code.v2.diff.renderMarkdown is not declared in contributes.configuration, so the toggle is memory-only and the update rejection is unhandled.
  • The sidebar has no consumer for edit-permission previews, so an edit permission shows no proposed diff, a regression from v1's inline diff.
  • Tool-card file links omit the required sessionId, so relative paths resolve to the project root and worktree-only files fail to open.
  • The per-turn diff source is dead: no v2 caller produces a turn id and the protocol has no openChanges/turnId message.
  • saveImage from a worktree transcript defaults to the project root.

4. History and navigation

  • History renders nothing until the project root store resolves, so a slow or missing root leaves a blank panel.
  • History lost keyboard tab navigation (arrows, Home, End).
  • After a reload, a session with one prompt and one answer can show a "Load earlier messages" button even when there are no earlier messages.

5. Terminals

  • Run and setup PTY relay sockets survive reload and panel close, so each reopen adds a host socket that still receives frames.
  • The initial PTY size is applied after spawn because pty.create has no size field, so the first prompt bytes are captured at 80 columns and replayed.
  • Relay close codes still render [connection error] for application close codes other than 1000. A script that exits before its tab connects now replays its output and closes with 1000, which removes the case seen during the self-test. Other application closes (for example the replay overflow code 4009) still show the generic error.
  • Terminal activity has no producer because the PTY environment lost KILO_TERMINAL_ACTIVITY.
  • PtyRelay.closeTerminal is unused.
  • Session terminal context is dead: requestTerminalContext, terminalContextError and syncOnSessionSwitch have no callers, so the v1 behavior that revealed the existing per-session integrated terminal on session change is gone.

6. Settings, manifest and packaging

  • The Agent Manager settings tab is not ported. The gear opens Settings without the Agent Manager rows, and SettingsNavigation drops projectId.
  • files.watcherExclude for **/.kilo/worktrees/** and **/.kilocode/worktrees/** is missing, so VS Code watches every worktree.
  • The -workbench.actions.view.problems unbind for Ctrl/Cmd+Shift+M is missing, so the Agent Manager binding collides with the Problems view.
  • kilo-code.v2.showShortcutHints has no settings row and is absent from KiloSettingKey.
  • The kilo-worktree-setup task definition is missing while the runner still creates that task type.
  • There is no .vscodeignore/files list and no packaging step that places bin/kilo2, so packaged content is undefined.
  • kilo-code.v2.showTaskTimeline defaults to false, while v1 defaulted to true.

7. Branch naming

  • Branch naming lost the system prompt, temperature, retries and the small-model flag, and instructions are concatenated with user data.

8. Medium and low items

  • .kilo2/agent-manager.json has no migration marker and apply ignores version, so a corrupt-file backup re-imports the stale v1 file.
  • STATE_DIRECTORIES lost .kilocode, so the legacy state file is no longer protected from edits.
  • Model mention (@model) was removed from the New Worktree dialog while the file header still claims it.
  • Event routing drops an event when no store key equals event.location.directory, so symlinked or case-different paths stop live updates silently.
  • The chat-focus effect lost the pending-question dependency.
  • The agentManager write allowlist carries showTaskTimeline, which the panel never posts, and omits settings the ported tab would need.
  • Four Agent Manager i18n keys are unused.
  • PR timeline and summary strings are untranslated English in all 20 locales, and four labels are hardcoded. Both are inherited from v1.

9. Dead code to remove or wire

  • tool-project.ts is imported only by tests.
  • discardWorktree has no production caller.
  • AgentManagerProvider methods focusPanel, waitForReady, revealSession, getWorktreeDirectories and createFromSidebar have no callers outside tests.
  • Message types with no sender or handler: requestTerminalContext, clearSession, previewImage, the Agent Manager openFile variant, loadMessages, copyFilePath.
  • Handlers with no sender: setSessionsCollapsed, selectProject, configureSetupScript, setDefaultBaseBranch.
  • Seam helpers with no consumer: directories(), isSubmitting, interrupt, intro.fallback, resolveTerminal, the hasQuestionOption import.
  • The model-picker global state is plumbed end to end but the selector keeps a local open signal.

10. Test drift

  • The v1 PR render, review-render, comments-render, review-editor and comment-context fixture tests were not ported, so PR layout regressions have no coverage.
  • test/agent-manager-tool-start.test.ts asserts the model and variant are absent for worktree sessions; it should assert they are applied once the gap is fixed.

Verified as Correctly Migrated

The audit checked these and found no divergence:

  • Worktrees and state: creation, start-point resolution, "already checked out", pool claim, the .kilo2 git exclude; state schema, sections, tab order, pinned tabs, closed sessions, worktree order, active target, corrupt-file backup; reconcile, recovery, health, doctor, diagnostics, file paths, orphans, git import and transfer, stats poller, quarantine, semaphore; delete, env copy, multi-version, creation plan.
  • Projects: registry, contexts, hydrate, clone, onboarding, pollers, scope, validation, avatars, diff branches.
  • Sessions and seam: unknown-project drop, state gating, panel restore and serializer, dispose abort, visibility gating, composer state broadcast, focus context, cycle and jump commands, prompt-sent branch naming trigger, cost tracking, shutdown interrupt; base branch, base update (apart from the session selection), prune subagents, branch naming RPC.
  • Orchestration: agent_manager tool schema, validation, events, reply and reject, model matching, timeout, permission hardening, registration.
  • Terminals: routing, terminal.created and restarted, relay open/send/close, replay, the 4009 overflow code, script terminals, run scripts, setup scripts, integrated terminals, terminal font and destination settings.
  • Diff: source lifecycle, worktree/staged/unstaged/local sources, cache, reverter, large and binary handling, session and turn source semantics, routing and scope, revert, apply-to-local, review model, annotation building, diff-style persistence.
  • PR: host layer, protocol, project scoping, poller behavior, merge/branch/conflict flows, security checks, PR UI parity, push-fixes setting.
  • Webview: sidebar tree, sections, worktrees, tabs, drag and drop, persistence, navigation and keys, dialogs, CSS.
  • Manifest and i18n: commands and keybindings (except the unbind above), config keys, panel view type and serializer, activation event, menu order; 513 keys across 21 locales with identical placeholder sets and every locale wired.

Planning Documents

The port plan, ledger, conventions and the full audit are included in the repository:

  • .kilo/plans/agent-manager-v2-plan.md
  • .kilo/plans/agent-manager-v2-ledger.md
  • .kilo/plans/agent-manager-v2-conventions.md
  • .kilo/plans/agent-manager-v2-audit.md

Part of #15315

@marius-kilocode

Copy link
Copy Markdown
Collaborator Author

Work log across the sessions in this worktree

This branch was built by several sessions working in the same worktree. This comment records what each one changed and verified, so the work is traceable in one place.

Port, seam and integration (main session)

  • Built the v2 boundary: connection adapter over manager() and OpenCode.make, one event stream fanned out by location.directory, per-directory createData stores with release, state file under the v2 config dir with a one-time import, settings under kilo-code.v2.agentManager.*, and lifetime interrupts on panel dispose and deactivate.
  • Added the second webview entry and the panel host, and reused wire() from the sidebar through a narrow agentManager view widening.
  • Extracted SessionView from the sidebar chat, so both surfaces use one transcript, dock and composer.
  • Copied the independent host and webview modules with the planned splits, and connected them to the seam.
  • Added the server plugins: kilocode.agent-manager (tools, RPC, events, reconnect methods, state file guard, permission hook) and kilocode.branch-name, with contracts in packages/schema.
  • Self-test fixes in this area: activation crash on import.meta; missing kilo-ui styles in the panel entry; local tab lost after the first prompt (root sessions have no parentID); intro covering the transcript; duplicate session across stores; worktree card passing the project id as the worktree id; history crash on useV2; worktree terminal 403 (ticket directory); terminal connecting before the PTY existed; branch auto-naming never running (prompt not reported, arming cleared by re-adding the session); stale tracked sessions showing a raw error; retry shown as busy; project root resolved to the workspace folder instead of the checkout root.
  • Verified: local prompt with tool call, worktree create and isolated edit with stats, worktree create with prompt, multi-version compare with 2 models, New Worktree dialog, sections, history, embedded terminal, run and setup scripts, VS Code terminal destination for local and worktree, branch rename after two prompts, stale session pruning, window reload restore, auto-approve and model picker sync, composer control parity with the sidebar.

Composer parity (requested during the port)

  • The Agent Manager composer is the sidebar PromptInput, including voice input through the shared speech status provider.
  • The New Worktree dialog uses the same default model as the sidebar (agent model, then server default) and the same speech and enhance controls, and keeps its v1 extras (mentions, attachments, slash commands, compare, Cmd+Enter).
  • Auto-approve and the expanded model picker sync in both directions between the sidebar and the panel.
  • Panel pushes match the sidebar: keybindings, webviewActiveChanged, composer state, through the ready queue.
  • Cycle-agent commands target the panel composer when it is the active editor; read-only subagent views ignore them.

Buttons and tooltips session

  • Compared every button group with v1: sidebar header, project row, worktree and session rows, footer, tab bar, inspector strip, session header, composer and New Worktree dialog. Only the view title had drifted; it now uses v1 order (new session, history, Agent Manager, profile, settings), guarded by test/chat-view-title-order.test.ts.
  • Routed openSettingsPanel from the panel to the provider (panel.ts), so the gear opens Settings.
  • Fixed the History crash for the cases where the list rendered without a scope.
  • Audited tooltips and labels. No unnamed controls remain; controls without tooltips also had only an aria-label in v1.
  • Added translations for the four Agent Manager keys that existed only in English across all 20 non-English locales, with test/agent-manager-i18n.test.ts guarding key parity.

Shortcuts and permissions session

  • The keybinding map used v1 command ids and context keys, so manifest shortcuts were dropped. It now uses the kilo-code.v2. ids and the v2 side-terminal context key, and the dead global entries are gone.
  • The terminal destination setting now reads and writes the v2 key in both the module and the panel.
  • Added test/agent-manager-keybindings.test.ts covering manifest extraction, user overrides and removal. Verified live: manifest defaults in the popup, overrides applied without reload, removal restoring the default.
  • Hardened agent_manager permissions to match v1: the permission hook now receives the effective rules (including saved ones) and the unattended rules; an exact "Always allow" decides for prompt, stop, move and answer; a later wildcard asks again; unattended work denies without an exact approval. Integration tests run through the real permission service, and the live check showed prompt sticking after "Allow always" while stop still asked.

Terminal session

  • Fixed the side-terminal focus context key, which was never set, so the side-terminal shortcut could not run.
  • Added ensureCommandsSkipShell() in terminal-host.ts, called at startup, so terminal commands reach VS Code from a focused VS Code terminal on Windows and Linux.
  • Fixed Cmd+/ toggling twice when the panel or host was busy: the handled keydown is stopped, so the late command echo cannot close the terminal again. A held key toggles once.
  • Tested the terminal key matrix (side terminals, main terminal tabs, navigation, close) and both destinations.
  • Tested the Run script (start, stream, Stop ends the process) and the worktree setup script in both modes.
  • Investigated the thick terminal scrollbar: xterm 6 draws its own 14px bar and v1 has the same one, so it is not a regression. Native scroll areas use v1's thin style.

Merge and checks (this session)

  • Merged the latest origin/v2 (33 commits). Resolved three conflicts: chat.tsx (kept the shared SessionView and passed upstream's todo chip through), dispositions.json (kept both sides), shared-patches.json (limits now 75 files, 1066 marked, 91 unmarked).
  • packages/kilo-vscode: typecheck clean, lint clean, 3080 tests pass.
  • packages/kilo-plugin: typecheck clean, 500 tests pass.
  • packages/kilo-cli: typecheck clean, 331 tests pass.
  • bun script/check-shared-patches.ts: ok.
  • Not verified: real GitHub PR actions, import and clone over the network, the subagent panel, Windows and Linux keybindings, and the root bun run check (it fails on unrelated pre-existing errors in packages/ai and two core tool-shell tests).

The open items from the audit are listed in the PR description and in .kilo/plans/agent-manager-v2-audit.md.

@github-actions github-actions Bot added area:agent-manager Agent Manager area:cli CLI, TUI and core engine area:ui Shared UI components area:vscode VS Code extension labels Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

📈 v2 migration progress: 9.3% → 14.6% (+515 done, 0 total, 0 dropped; 1432/9810 cells)

Placement: 36 new marked lines in shared files (20 seam, 16 patch), 1 new kilo_port annotation, 0 new core-internal imports.

Ratchets: 30 core-internal imports (base 30); shared patches by rung 47 seam, 33 patch (base 42 seam, 32 patch).

Feature Before After Change
agent-manager 0/12 1/12 +1 patch done
branch-name 0/2 1/2 +1 module done
permission 0/34 2/34 +1 module done; +1 test done
ui 139/267 144/267 +5 modules done
vscode 569/2048 1075/2048 +395 modules done; +111 tests done
515 cells closed
  • module:packages/kilo-ui/src/components/avatar.tsx
  • module:packages/kilo-ui/src/components/dropdown-menu.tsx
  • module:packages/kilo-ui/src/components/hover-card.tsx
  • module:packages/kilo-ui/src/components/radio-group.tsx
  • module:packages/kilo-ui/src/components/resize-handle.tsx
  • module:packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
  • module:packages/kilo-vscode/src/agent-manager/GitOps.ts
  • module:packages/kilo-vscode/src/agent-manager/GitStatsPoller.ts
  • module:packages/kilo-vscode/src/agent-manager/PRStatusPoller.ts
  • module:packages/kilo-vscode/src/agent-manager/ScriptTerminalManager.ts
  • module:packages/kilo-vscode/src/agent-manager/SessionTerminalManager.ts
  • module:packages/kilo-vscode/src/agent-manager/SetupScriptRunner.ts
  • module:packages/kilo-vscode/src/agent-manager/SetupScriptService.ts
  • module:packages/kilo-vscode/src/agent-manager/WorktreeManager.ts
  • module:packages/kilo-vscode/src/agent-manager/WorktreeStateManager.ts
  • module:packages/kilo-vscode/src/agent-manager/__tests__/SetupScriptService.spec.ts
  • module:packages/kilo-vscode/src/agent-manager/base-branch.ts
  • module:packages/kilo-vscode/src/agent-manager/base-update.ts
  • module:packages/kilo-vscode/src/agent-manager/branch-name.ts
  • module:packages/kilo-vscode/src/agent-manager/branch-naming.ts
  • module:packages/kilo-vscode/src/agent-manager/command-budget.ts
  • module:packages/kilo-vscode/src/agent-manager/constants.ts
  • module:packages/kilo-vscode/src/agent-manager/continue-in-worktree.ts
  • module:packages/kilo-vscode/src/agent-manager/creation-plan.ts
  • module:packages/kilo-vscode/src/agent-manager/creation-timing.ts
  • module:packages/kilo-vscode/src/agent-manager/delete-worktree.ts
  • module:packages/kilo-vscode/src/agent-manager/diff-scope.ts
  • module:packages/kilo-vscode/src/agent-manager/discard-worktree.ts
  • module:packages/kilo-vscode/src/agent-manager/env-copy.ts
  • module:packages/kilo-vscode/src/agent-manager/focus-panel.ts
  • module:packages/kilo-vscode/src/agent-manager/fork-handoff.ts
  • module:packages/kilo-vscode/src/agent-manager/fork-session.ts
  • module:packages/kilo-vscode/src/agent-manager/format-keybinding.ts
  • module:packages/kilo-vscode/src/agent-manager/friendly-words.d.ts
  • module:packages/kilo-vscode/src/agent-manager/gh.ts
  • module:packages/kilo-vscode/src/agent-manager/git-errors.ts
  • module:packages/kilo-vscode/src/agent-manager/git-import.ts
  • module:packages/kilo-vscode/src/agent-manager/git-stats-snapshot.ts
  • module:packages/kilo-vscode/src/agent-manager/git-transfer.ts
  • module:packages/kilo-vscode/src/agent-manager/home-workspace.ts
  • module:packages/kilo-vscode/src/agent-manager/local-diff-batch.ts
  • module:packages/kilo-vscode/src/agent-manager/local-diff-cache.ts
  • module:packages/kilo-vscode/src/agent-manager/local-diff.ts
  • module:packages/kilo-vscode/src/agent-manager/log-format.ts
  • module:packages/kilo-vscode/src/agent-manager/mcp-warmup.ts
  • module:packages/kilo-vscode/src/agent-manager/multi-version.ts
  • module:packages/kilo-vscode/src/agent-manager/orchestration-bridge.ts
  • module:packages/kilo-vscode/src/agent-manager/orchestration-domain.ts
  • module:packages/kilo-vscode/src/agent-manager/orchestration-setup.ts
  • module:packages/kilo-vscode/src/agent-manager/orphans/size.ts
  • module:packages/kilo-vscode/src/agent-manager/orphans/sizing.ts
  • module:packages/kilo-vscode/src/agent-manager/pool/home.ts
  • module:packages/kilo-vscode/src/agent-manager/pool/pool.ts
  • module:packages/kilo-vscode/src/agent-manager/pool/slot.ts
  • module:packages/kilo-vscode/src/agent-manager/pool/sweep.ts
  • module:packages/kilo-vscode/src/agent-manager/pr-status-bridge.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/PRActions.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/am-pr-batch.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/am-pr-seed.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/am-pr-types.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/am-pr-utils.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/merge-actions.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/mutate-comment.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/pr-comment-context.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/pr-constants.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/review-actions.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/review-context.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/suggestion-actions.ts
  • module:packages/kilo-vscode/src/agent-manager/pr/timeline.ts
  • module:packages/kilo-vscode/src/agent-manager/project/avatar.ts
  • module:packages/kilo-vscode/src/agent-manager/project/clone.ts
  • module:packages/kilo-vscode/src/agent-manager/project/context.ts
  • module:packages/kilo-vscode/src/agent-manager/project/contexts.ts
  • module:packages/kilo-vscode/src/agent-manager/project/diff-branches.ts
  • module:packages/kilo-vscode/src/agent-manager/project/hydrate.ts
  • module:packages/kilo-vscode/src/agent-manager/project/init.ts
  • module:packages/kilo-vscode/src/agent-manager/project/onboarding.ts
  • module:packages/kilo-vscode/src/agent-manager/project/paths.ts
  • module:packages/kilo-vscode/src/agent-manager/project/pollers.ts
  • module:packages/kilo-vscode/src/agent-manager/project/prepare.ts
  • module:packages/kilo-vscode/src/agent-manager/project/registry.ts
  • module:packages/kilo-vscode/src/agent-manager/project/route.ts
  • module:packages/kilo-vscode/src/agent-manager/project/scope.ts
  • module:packages/kilo-vscode/src/agent-manager/project/session-view.ts
  • module:packages/kilo-vscode/src/agent-manager/project/state-gate.ts
  • module:packages/kilo-vscode/src/agent-manager/project/wiring.ts
  • module:packages/kilo-vscode/src/agent-manager/promotion-handoff.ts
  • module:packages/kilo-vscode/src/agent-manager/prompt-attribution.ts
  • module:packages/kilo-vscode/src/agent-manager/provider-lifecycle.ts
  • module:packages/kilo-vscode/src/agent-manager/provider-multi-version.ts
  • module:packages/kilo-vscode/src/agent-manager/prune-subagents.ts
  • module:packages/kilo-vscode/src/agent-manager/pty-cleanup.ts
  • module:packages/kilo-vscode/src/agent-manager/quarantine.ts
  • module:packages/kilo-vscode/src/agent-manager/reveal-session.ts
  • module:packages/kilo-vscode/src/agent-manager/run/controller.ts
  • module:packages/kilo-vscode/src/agent-manager/run/destination.ts
  • module:packages/kilo-vscode/src/agent-manager/run/manager.ts
  • module:packages/kilo-vscode/src/agent-manager/run/message.ts
  • module:packages/kilo-vscode/src/agent-manager/run/service.ts
  • module:packages/kilo-vscode/src/agent-manager/run/task.ts
  • ... 415 more

Map on v2 · how cells close

@socket-security

socket-security Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

@marius-kilocode

Copy link
Copy Markdown
Collaborator Author

Reporting audit: complete session inventory

I re-read every session in this worktree and compared their results with the PR description. The description now includes the complete audit. Below is the full session inventory and the corrections I made.

Sessions in this worktree

Session ID What it did
progress (main port) ses_e5f51532affe85oXVEgj9nfzqe Seam spike, connection adapter, panel and build, lifetime, SessionView, provider and AgentManagerApp port, terminals, diff, PR, multi-project, orchestration bridge, main self-test, 8 audit fan-out, progress map analysis
errors ses_e61d3d08affezlTr6T3XHIKnXp Composer parity with the sidebar, selection adapter fix, history and terminal fixes, project checkout root, branch auto-naming, stale session pruning, retry state, i18n, permission analysis
gaps (also called buttons) ses_e5f9be05bffe09JbtPcgaBCGYS Button and tooltip parity against v1, chat title order, openSettingsPanel routing, history crash, i18n translations for 20 locales, 8 read-only audits, wrote .kilo/plans/agent-manager-v2-audit.md
shortcuts ses_e5f9676c4ffe1kWd0CxlsLLIm7 Keybinding map to v2 command ids, shortcuts popup from the manifest and keybindings.json, terminal destination key, side terminal focus, permission hardening in core and plugin, permission hot-reload analysis
terminal ses_e5f9b43b8ffeSDP9KFm6CY2RZt Terminal parity matrix, Cmd+/ double toggle, commandsToSkipShell, VS Code terminal destination, run and setup scripts, scrollbar investigation
3 copy subagents ses_e5f9c..., ses_e5f51... Copied the independent host modules, the pure webview files, and ported the server plugins
8 audit subagents ses_e5f6... Host worktrees, sessions and plugins, terminals, diff and review, PR, webview shell, shared UI seam, manifest and i18n

The complete file-level audit is committed at .kilo/plans/agent-manager-v2-audit.md.

What the description was missing and now includes

  • All 8 blockers from the audit, not just the subset that fit the earlier list.
  • All 21 serious functional gaps, including worktree activity and connection state, fork actions in the chat header and per message, the shared composer's missing attachments, mentions and slash commands, and lost history keyboard navigation.
  • All 22 medium and low items, including the state file migration marker, .kilocode protection, branch naming losing its system prompt and sampling settings, spurious terminal connection errors on application close, terminal activity with no producer, the empty dock row, stale prompt append, saveImage directory, event routing on differing path spellings, @model mention, and untranslated PR strings inherited from v1.
  • The dead code list and the test drift list, including that agent-manager-tool-start.test.ts currently pins the missing model.
  • A "Verified as Correctly Migrated" section with every area the audits checked clean (worktrees and state, projects, session seams, orchestration, terminals, diff, PR, webview, manifest, i18n).
  • A parity checklist covering every area, with the state of each.
  • A permissions and hot reload section: how agent, session, saved and unattended rules are scoped, and how model changes reach running sessions.
  • The planning documents committed in this branch.
  • The exact v1 button and tooltip result, including the one group that had drifted.
  • The origin/v2 merge details, including the three conflicts and the todo chip integration.

Corrected self-test claims

  • Setup script: the script runs (marker written) and the Setup tab is created, but the tab shows a connection error after the script exits. This is the relay close-code gap, now listed.
  • Run and setup scripts are verified in embedded mode only. The VS Code terminal destination is verified for interactive terminals only.
  • Terminals after a window reload were not tested.
  • Added to "Not verified": second project routing, import from PR or branch, clone, diff and review comments, apply end to end, orphan import, continue in worktree, closing the panel mid-turn, moving the panel to a new window, and scripts in the VS Code terminal destination.

No code changed for this update; it is a reporting correction only.

@marius-kilocode

Copy link
Copy Markdown
Collaborator Author

Audit deltas not in the description

The description already carries the full audit summary. Four items from the eight read-only audits are missing there.

  1. Intro dismissal removes the Agent Manager empty state (blocker). createIntro builds fallback with the shared welcome, recent sessions, shortcut hints and the reopen button, but AgentManagerApp uses only intro.render, and MessageList replaces its welcome with that. After dismissal those never appear. intro.fallback is currently listed only as a dead helper.
  2. continueInWorktree is unreachable. The handler exists in provider-messages.ts:174, but the message has no agentManager. prefix, panel.ts rejects it before dispatch, and no v2 webview sends it. The continue-in-worktree.ts path and its progress feedback are dead.
  3. Fork and promotion handoffs start an unsolicited model turn. fork-handoff.ts:27 and promotion-handoff.ts:21 call session.synthetic without resume: false; v1 used noReply: true. An idle drain promotes the steer and runs a step, so forking or promoting produces an answer and a charge.
  4. Test drift. test/agent-manager-terminal-layout.test.ts and test/agent-manager-terminal-destination.test.ts currently fail on stale source-text assertions: the layout test still expects the old fitNow() string and the destination test still expects the v1 setting namespace. The behavior they describe matches v1, so update the assertions rather than the code.

- reuse the shared keybinding helpers instead of two copied modules
- replace the Effect catch-and-fail with mapError
- declare happy-dom for the review tests
- add startup budgets for the two new plugins
- derive canonical paths and ids in the project tests for Windows
- normalize CRLF in the source-text test
- replay an exited script PTY so its tab shows the output
- register three reviewed duplication exceptions
@marius-kilocode

Copy link
Copy Markdown
Collaborator Author

Blocker B6: PR polling never learns the active worktree

Symptom. With no active worktree, every 15 s PR poll found no target and returned. PR data refreshed only on the 120 s full sync, and switching worktrees did not trigger a fetch, so badges, checks and review state stayed stale up to 8x longer than in v1.

Cause. v1 set the poller target on loadMessages (AgentManagerProvider.ts:701). The v2 port replaced that signal with agentManager.visibleSession, but its handler only called trackVisibleSession, which updates presence and connection.view. PRStatusPoller.setActiveWorktreeId (PRStatusPoller.ts:225) had no caller in src.

Fix. AgentManagerProvider.trackVisibleSession now resolves the persisted worktree id of the visible session and calls prBridge.poller.setActiveWorktreeId(...). The id comes from the active project's state. A local session (worktreeId: null), an unknown session, a session from another project, or no session clears the target. The existing setActiveWorktreeId performs the immediate fetch when the target changes. Project scoping and the 120 s full sync are unchanged.

Files.

  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts: trackVisibleSession plus a visibleWorktreeId helper.
  • packages/kilo-vscode/test/agent-manager-visible-session-worktree.test.ts: new focused test.

Before.

bun test test/agent-manager-visible-session-worktree.test.ts
1 pass, 2 fail

error: expect(received).toBe(expected)
Expected: "wt-1793700156803-1"
Received: undefined

A visible worktree session left activeWorktreeId undefined and fetched nothing.

After.

bun test test/agent-manager-visible-session-worktree.test.ts
3 pass, 0 fail, 9 expect() calls

The test covers: a worktree session sets the target and fetches it immediately, switching to another worktree fetches the new one, and local, unknown and null sessions clear the target.

Commands and results.

bun test test/agent-manager-visible-session-worktree.test.ts \
  test/agent-manager-panel-dispose.test.ts \
  test/am-pr-status-bridge.test.ts \
  test/agent-project-messages.test.ts
140 pass, 0 fail

bun typecheck
no errors in the changed files

bun typecheck still reports errors in sibling test files (agent-manager-project-sessions.test.ts, agent-manager-review-send.test.ts, agent-manager-tool-start.test.ts) from concurrent in-flight work on this branch, not from the files above.

No live self-test was run for this change; the unit test above covers the behavior.

@marius-kilocode

marius-kilocode commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

B4: review comment sends are duplicated or dropped

Symptom

  • Send all from the full-screen review appended the batch twice to the prompt. With a side terminal open, send to terminal pasted nothing and the PR panel still marked the comments as sent.
  • The same class affected inline comment send, PR checks, PR summary, PR action batches, and remote comment replies.

Cause

  • The AgentManagerApp.tsx review callbacks called appendToPrompt after diff-viewer/review-controller.ts already dispatched sendReviewComments through the window event.
  • APPEND_REVIEW_COMMENTS had no consumer for detail.targetTerminalId, so the app handler returned early and no terminal listened.
  • pr/pr-actions.ts patched the sent state without knowing whether any consumer took the batch.
  • diff-viewer/remote-comment-renderer.tsx marked a remote reply sent with no result check at all.

Fix

  • sendReviewComments now returns whether a consumer took the batch (detail.handled).
  • Added takeReviewCommentsForPrompt and takeReviewCommentsForTerminal in diff-viewer/review-annotations.ts. Each sets handled and returns the markdown, so a batch reaches exactly one destination.
  • AgentManagerApp.tsx: the window listener uses the prompt helper. onSendClick is notification only, and the full-screen onSendAll only closes the review tab. The dispatcher appends once.
  • terminal/TerminalTab.tsx: added the APPEND_REVIEW_COMMENTS listener that pastes formatReviewCommentsMarkdown plus a newline when targetTerminalId matches, with markUser() so replay does not treat the paste as output.
  • pr/pr-actions.ts and the inline send-to-chat button only mark or delete comments after a consumer took them. review-controller.ts keeps comments and drafts when the batch was not delivered.
  • pr/pr-actions.ts now exports sendPRComment, which runs the mark callback only when the batch was taken. diff-viewer/remote-comment-renderer.tsx uses it for remote comment replies, so setSent(true) no longer runs for an undelivered reply.

Files

  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx
  • packages/kilo-vscode/webview-ui/diff-viewer/review-annotations.ts
  • packages/kilo-vscode/webview-ui/diff-viewer/review-controller.ts
  • packages/kilo-vscode/webview-ui/diff-viewer/remote-comment-renderer.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/terminal/TerminalTab.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/pr/pr-actions.ts
  • packages/kilo-vscode/test/agent-manager-review-send.test.ts (new)

Before evidence

Reproduction with the pre-fix callback bodies from HEAD (one send all, then one terminal send):

prompt appends after one send-all: 2
append 1 == append 2: true
terminal send handled by a consumer: false
prompt appends: 0

The remote reply path at HEAD marked the comment before checking delivery:

sendReviewComments([prPayload(value)], options.activeTerminalId())
props.item.setSent(true)

The new contract test failed before the fix:

SyntaxError: Export named 'takeReviewCommentsForPrompt' not found in module '.../webview-ui/diff-viewer/review-annotations.ts'
0 pass
1 fail

After evidence

Same flow with the fixed dispatcher and consumers:

prompt appends after one send-all: 1 review tab closed: 1
terminal send handled by a consumer: true
terminal pastes: 1 prompt appends: 1

Remote reply assertion in the new test: sendPRComment(comment, "terminal-missing", markSent) returns false and markSent stays at 0; after a prompt consumer is installed, the same call returns true and markSent is 1.

New test, from packages/kilo-vscode:

bun test test/agent-manager-review-send.test.ts
5 pass, 0 fail, 18 expect() calls

Related suites, from packages/kilo-vscode:

bun test test/review-annotations.test.ts test/review-scroll.test.ts test/pr-actions.test.ts \
  test/pr-review-actions.test.ts test/pr-check-feedback.test.ts test/pr-diff-comment-state.test.ts \
  test/am-pr-batch.test.ts test/am-pr-utils.test.ts test/agent-manager-terminal-chrome.test.ts \
  test/agent-manager-terminal-side.test.ts test/agent-manager-terminal-state.test.ts \
  test/agent-manager-review-send.test.ts
270 pass, 0 fail

Checks:

bunx tsc --noEmit -p webview-ui
no errors in the owned files

bunx oxlint on the changed files
0 warnings, 0 errors

The package bun run typecheck also reports unrelated errors from other in-flight blockers in this stack.

Live result (isolated VS Code, session am-fix-b4)

The shared build was taken, bun run build ran from packages/kilo-vscode, and the check ran in an isolated VS Code instance against the disposable fixture /var/folders/6c/3j3r25ds6pd1dw3nlrfnvv280000gp/T/kilo/b4-fixture. The review dispatcher payload was fired in the real Agent Manager webview with a real xterm terminal mounted, which is the same window event the diff viewer sends.

Targeted send (targetTerminalId: "terminal:15873f95-6635-4db3-9421-8c5fe97e0034"):

handled: true
terminal rows: "## Review Com" / "ments" / "**src\-file.ts** (line 2):" / "```" / "return 2" / "```" / "Use the helper for this branch"
composer: ""

Untargeted send (one dispatch):

handled: true
composer: 1 x "## Review Comments"

Second targeted send:

handled: true
terminal rows show the next comment
composer: still 1 x "## Review Comments"

No Agent Manager webview console errors; the only console errors were VS Code product.json proposal noise and a Node url.parse deprecation warning.

The live driver was a dispatched agentManager.appendReviewComments event, not a gutter click in the diff viewer. The gutter and review panel button wiring is covered by the dispatcher and consumer tests above.

@marius-kilocode

Copy link
Copy Markdown
Collaborator Author

B2: agent_manager tool now applies the resolved model and variant to worktree sessions

Symptom

agent_manager tool calls in worktree mode created sessions on the default model and the default variant. The tool text printed the models that the plugin resolved, so the printed model did not match the model that ran. Multi-version comparison sets ran every version on the default model, which wasted cost and invalidated A/B comparisons.

Local mode and the multi-version provider path already applied the model. Only the worktree tool branch lost it.

Cause

Two gaps on the worktree tool path:

  1. ToolDeps.createSessionInWorktree in tool-start.ts had no model parameter. worktree() passed only the agent, so the parsed task.model and task.variant were unused.
  2. The adapter in AgentManagerProvider.startToolRequest passed undefined in the model slot: this.createSessionInWorktree(dir, branch, id, timing, undefined, agent, boot).

provider-session.ts and sessionCreateBody already accepted and forwarded a model with a variant, so the values were dropped before they arrived.

Fix

  • tool-start.ts: added model to the ToolDeps.createSessionInWorktree signature, added a small sessionModel(task) helper that merges task.model with task.variant, reused it in the local branch, and passed it with task.agent from the worktree branch.
  • AgentManagerProvider.ts: the createSessionInWorktree adapter now forwards model instead of undefined. This is the only change in the file.
  • provider-session.ts: no code change needed; it already forwarded the model, variant, and agent to session.create through sessionCreateBody.
  • SNAPSHOT_INITIALIZATION: confirmed dead in v2. Its only occurrence is the declaration in constants.ts, with no reader. It was not removed because constants.ts is outside this change's file ownership.

Files changed:

  • packages/kilo-vscode/src/agent-manager/tool-start.ts
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
  • packages/kilo-vscode/test/agent-manager-tool-start.test.ts

Before evidence

The test was updated first to assert that the model and variant ARE applied. On the unfixed code:

bun test test/agent-manager-tool-start.test.ts
25 pass
2 fail

The failures showed the worktree call with no model argument and the agent in the old argument position. A second check reverted only the provider adapter line and the new provider routing test failed, which confirms the test detects the exact drop.

After evidence

bun test test/agent-manager-tool-start.test.ts
28 pass
0 fail
95 expect() calls

bun typecheck
$ tsc --noEmit && tsc --noEmit -p webview-ui
EXIT:0

The new tests cover three levels:

  1. The tool path passes { providerID, modelID, variant } and agent to createSessionInWorktree.
  2. createSessionInWorktree maps them to session.create as model: { id, providerID, variant } plus agent.
  3. The real AgentManagerProvider.startToolRequest reaches the real createSessionInWorktree and sessionCreateBody, then session.create receives the resolved model, variant, and agent. This uses a fake client and no paid model call.

E2E note

A live VS Code self-test with a real agent_manager tool call was not run. It needs a paid model request and a shared extension rebuild while other audit fixes build concurrently. The provider routing test exercises the full host path from startToolRequest to session.create with the real provider code, so the only uncovered segment is the server plugin model resolution, which the audit already verified as correct.

@marius-kilocode

marius-kilocode commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

Blocker B5: auto-approve covered only the selected directory store

Symptom. With the shield on, a pending permission in a worktree the panel is not showing stays blocked, so a background agent hangs until the user opens that tab. It also stalls with the panel closed entirely, because the sweep lived in a webview.

Cause. The toggle is one persisted global state (kilo-code.v2.autoApprove), but the sweep was created inside SessionView and only read the selected session's directory store. A first attempt mounted a sweep for each store the panel retains, which fixed the retained-store case but still required a mounted webview. v1 replied in the extension host to every permission event while the toggle was on (src/commands/toggle-auto-approve.ts on main).

Fix: the extension host is now the single owner.

  • src/agent-manager/provider-auto-approve.ts approves requests from the provider's existing event stream (permission.asked) and sweeps the requests that are already pending for the workspace, every Agent Manager project root and every worktree. It reuses the existing controller contract: one reply per request ID, never a sandbox escalation, and a failed reply is released for a later retry.
  • The sweep runs on connection open, when the toggle is switched on, and for each arriving request. It reads the persisted flag at every decision, so no restart is needed.
  • src/chat.ts records the flag and the sidebar directory for the host sweep and notifies it when a webview persists a new value. The sidebar and panel still send and receive requestAutoApproveState and persistAutoApproveState exactly as before.
  • webview-ui/src/v2/auto-approve.tsx keeps only the toggle and the UI state. There is no second sweep, so a permission cannot be approved twice.
  • webview-ui/agent-manager/v2/panel-data.ts is unchanged from before the first attempt; the panel no longer needs per-store wiring.

Files.

  • packages/kilo-vscode/src/agent-manager/provider-auto-approve.ts (new; policy moved here from the webview)
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts (wiring and disposal)
  • packages/kilo-vscode/src/chat.ts (share the flag and notify on change)
  • packages/kilo-vscode/webview-ui/src/v2/auto-approve.tsx (toggle only)
  • packages/kilo-vscode/webview-ui/src/v2/auto-approve-policy.ts (removed, contents moved to the host module)
  • packages/kilo-vscode/test/agent-manager-auto-approve.test.ts (new)
  • packages/kilo-vscode/test/auto-approve.test.ts (import moved to the host module)

Before evidence.
The new provider test drives a real AgentManagerProvider with no panel and a permission pending in the workspace. With the host sweep unwired it replies to nothing:

error: expect(received).toEqual(expected)
- [ "per_host" ]
+ []
(fail) Agent Manager host wiring > approves a pending permission without ever opening the panel

The earlier webview-only attempt also failed its own case in the same scenario:

error: condition not reached
(fail) createPanelData > approves the pending permissions of every directory store while auto-approve is on [2141.86ms]

After evidence.

  • bun test test/agent-manager-auto-approve.test.ts test/auto-approve.test.ts test/agent-manager-panel-data.test.ts: 16 pass, 0 fail. It covers the event path with no webview mounted, the pending sweep over the workspace plus a project root and a worktree, the one-reply contract, the sandbox exclusion, the toggle-off case, and the provider wiring that never opens a panel.
  • bun test test/agent-manager-*.test.ts test/auto-approve.test.ts: 457 pass, 0 fail.
  • bun test for the whole package: 3111 pass, 79 skip, 0 fail.
  • bun typecheck from packages/kilo-vscode: exit 0 for both projects.

Remaining risks.

  • The host approves any permission event on this extension host's server while the toggle is on, matching v1 and the previous sidebar behavior. That includes sessions in directories outside the workspace and the Agent Manager projects.
  • Reset All Settings clears the persisted key without notifying the sweep. The flag is read at every decision, so new requests stay blocked, but a request that is already pending waits for the next sweep.
  • No live VS Code self-test was run. Verification is the focused and package test suites plus typecheck.

@marius-kilocode

marius-kilocode commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

B1: project session catalog restored

Symptom. The v2 host never posted agentManager.projectSessions. Every project card except the first one had no session rows, cross-project history and sidebar search had nothing to list, @ session references had no catalog, and orchestration-setup.ts (managed(), resolve()) rejected root sessions that existed only on the backend. project/context.ts setSessions, upsertSession, and sessionsListedFresh had no callers at all.

Cause. The v2 port dropped the catalog on both sides. project/init.ts lost the directory scan and pushState lost its push, while session-lifecycle.ts kept only busy/idle tracking and the removed-id set. The message type still described the v1 createdAt/updatedAt shape instead of the v2 SessionInfo shape, so nothing could be posted correctly even if it were wired.

Fix and files

  • packages/kilo-vscode/src/agent-manager/project/init.ts
    • projectDirectories: the project root plus one entry per tracked worktree path, deduped with samePath, so unrelated workspace roots cannot leak in. The backend list filters by exact directory equality, so a nested project cannot bleed in either.
    • collectProjectSessions: lists root sessions for each of those directories, drops children (parentID), dedupes ids, and stamps worktreeId from managed state or the listed directory. A failed directory listing resolves to [] and never erases the others. parentID is normalized to undefined so the webview root-session check accepts it after JSON transport.
    • pushProjectSessions: posts agentManager.projectSessions. It reuses a catalog that is less than 2 s old (so a webview that mounts after the last push still learns the sessions) and otherwise re-lists. Guards on disposed lifecycle and context generation.
    • SessionCatalogHost plus registerSessionCatalogHost/sessionCatalogHost: a registry keyed by the provider's busy-session set, which lets session events reach the host, the backend client, and the bound logger without a new call site in AgentManagerProvider.ts.
  • packages/kilo-vscode/src/agent-manager/provider-state.ts: ProviderStateHost.client() added; the catalog host is built from the existing contexts, client, post channel, and a bound (...args) => p.log(...args) logger, registered, and pushed from pushState for every project before the active-project early return.
  • packages/kilo-vscode/src/agent-manager/session-lifecycle.ts: session.created reads the session back once, ignores subagents, upserts it with its worktreeId, invalidates the cache, and posts. When the event has no location, the project is resolved from the fetched session. session.deleted removes the row and posts the remainder. A failed session read is logged instead of swallowed.
  • packages/kilo-vscode/src/agent-manager/types.ts: ProjectSessionsMessage.sessions is now ProjectSessionView[] (v2 SessionInfo plus worktreeId) instead of the v1 timestamp shape.
  • packages/kilo-vscode/test/agent-manager-project-sessions.test.ts: focused test for the catalog.

Before evidence

  • The new test failed on the unmodified code with no agentManager.projectSessions message recorded, which is the "host never posts" repro.
  • grep -c projectSessions on HEAD for provider-state.ts and session-lifecycle.ts was 0 in both files.
  • Live, on the pre-fix dist, I recorded every message the Agent Manager webview received while switching projects. The trace had agentManager.state, agentManager.projects, localStats, worktreeStats, prStatus, and no agentManager.projectSessions. In sidebar search the background project "second" showed 0 session rows and a worktree count of 0, while the active project's session appeared only through the webview live-store overlay.

After evidence

  • Focused test: 10 pass, 0 fail.
  • Live, post-fix dist, same isolated instance and the same two persisted projects: the message trace contains agentManager.projectSessions for the background project with { id, worktreeId, time.created } in the v2 shape and no createdAt/updatedAt.
  • Sidebar search for that background project: the session row "Untitled, second, shimmer-supermarket" now appears and the worktree count changed from 0 to 1. The active project's rows are unchanged.
  • Live create: clicking "New session" in that worktree posted agentManager.projectSessions containing the new session id with worktreeId set, without waiting for a state push. Delete posting is covered by the focused test (session.deleted removes the row and re-posts).

Review pass

  • Duplicate posts are limited to the create path, where the lifecycle post and the following state push carry identical catalogs. Both are idempotent, and every post reads the catalog at post time.
  • No missing post remains on the replay path: attachPanel queues pushProjects, which pushes every expanded background project through hydrateExpanded, and requestState pushes the active one. The panel buffers messages until the webview reports ready.
  • Project scoping, the 2 s cache, generation checks, and the disposed guards were re-checked against the live event flow. The busy-session set is readonly and only cleared, so the registry key stays stable for the process lifetime.
  • The unbound-log fix is required, not cosmetic: AgentManagerProvider.log is a prototype method that reads this. A focused test now uses a prototype logger and fails if the wrapper is removed; that sensitivity was verified by temporarily passing p.log bare (1 fail) and restoring it (10 pass).
  • The unlocated-create fallback was verified the same way: removing it fails the new test.

Commands

  • bun test test/agent-manager-project-sessions.test.ts (from packages/kilo-vscode): 10 pass, 0 fail.
  • bun test test/agent-manager-*.test.ts test/agent-project-*.test.ts: 583 pass, 0 fail.
  • bun typecheck (from packages/kilo-vscode): exit 0 for both tsc projects.
  • bun run lint: 0 warnings, 0 errors.
  • bun run build plus the isolated VS Code self-test (session am-fix-b1, own profile, disposable fixture workspace): evidence above. No rebuild was needed for the review pass because it changed host-internal logging and an event-resolution fallback only, both covered by the focused test.

Risk. The catalog is a fresh listing per push, so a session created by a path that emits neither session.created nor a state push appears only after the next push or after the 2 s cache expires. The listing does not pass archived: false, which matches the other v2 session.list callers (worktree-activity, caffeination) and v1 behavior, but means an archived session stays in the AM catalog until it is deleted. Directories are matched by samePath, so a worktree whose recorded path stops resolving to the same canonical directory drops out of the catalog until worktree reconcile fixes it.

@marius-kilocode

Copy link
Copy Markdown
Collaborator Author

B8: Agent Manager settings were unreachable from the project gear

Symptom. Opening the Agent Manager project gear landed on the Settings panel's Models tab. The rail had no Agent Manager entry, so automatic branch naming, branch prefix, worktree pre-warm, the project picker, default base branch, setup script and push fixes could not be edited from the gear. The Display tab also had no shortcut hints row.

Cause. Two gaps.

  1. parseSettingsTarget copied tab, subtab, focus, titleKey and search from the gear argument but dropped projectId, and the Settings webview never carried it to the tab component. So even a project-scoped tab could not know which project to edit.
  2. The v2 settings rail had no agentManager tab, SETTINGS_TABS_V2 never registered one, and the settings host had no path to the Agent Manager project settings handler that already existed in createProjectWiring ("shared with the Kilo Settings editor"). chat.ts still set a KILO_AGENT_MANAGER_SETTINGS global that nothing read.

Fix.

  • Added the project-scoped agentManager tab in v1 position (after Auto-Approve), with rows: automatic branch naming, branch prefix, pre-warm worktrees, project picker, default base branch (opens the existing ProjectBranchDialog), setup script (create/edit).
  • Added showShortcutHints to the Display tab and agentManager.pushFixes to the Agent Behaviour agents subtab, where v1 put them.
  • Carried projectId through SettingsNavigation, parseSettingsTarget, settings-panel.ts (also in workspace state, and preserved on tab changes), v2/settings.tsx and SettingsTabProps.
  • Reused the provider's existing SettingsHandler (projects, branches, setDefaultBaseBranch, configureSetupScript) through a lazy getter. Four panel messages (agentManagerSettings, agentManagerSettingsBranches, agentManagerSetDefaultBaseBranch, agentManagerConfigureSetupScript) exist because the provider's webview messages are not routed to the Settings panel; no second ProjectContexts or WorktreeStateManager was created.
  • Removed the dead KILO_AGENT_MANAGER_SETTINGS global.
  • One coordinated edit outside the B8 file list, approved by the coordinator: src/extension.ts creates the Settings panel after AgentManagerProvider and passes agentManager: () => agentManager.settings.

Files.

  • packages/kilo-vscode/src/protocol.ts
  • packages/kilo-vscode/src/settings-navigation.ts
  • packages/kilo-vscode/src/settings-panel.ts
  • packages/kilo-vscode/src/settings-host.ts
  • packages/kilo-vscode/src/chat.ts
  • packages/kilo-vscode/src/extension.ts (approved 3-line reorder plus lazy getter)
  • packages/kilo-vscode/webview-ui/src/components/settings/AgentManagerTab.tsx (new)
  • packages/kilo-vscode/webview-ui/src/components/settings/tabs.ts
  • packages/kilo-vscode/webview-ui/src/components/settings/Settings.tsx
  • packages/kilo-vscode/webview-ui/src/components/settings/DisplayTab.tsx
  • packages/kilo-vscode/webview-ui/src/components/settings/agent-behaviour/AgentsSubtab.tsx
  • packages/kilo-vscode/webview-ui/src/v2/settings-config.tsx
  • packages/kilo-vscode/webview-ui/src/v2/settings.tsx
  • packages/kilo-vscode/test/settings-navigation.test.ts
  • packages/kilo-vscode/test/settings-host-agent-manager.test.ts (new)

No package.json change was needed: all four agentManager.* keys and showShortcutHints already exist with the v1 defaults.

Before evidence.

  • Focused test on unmodified parseSettingsTarget failed with - "projectId": "prj_1" missing from the received object.
  • Live, session am-fix-b8, fixture workspace, current dist: clicking button[aria-label="Project settings"] opened Settings with active: "models" and tabs [models, providers, agentBehaviour, autoApprove, browser, checkpoints, display, autocomplete, context, commitMessage, experimental, language, aboutKiloCode]. No Agent Manager tab, no Agent Manager rows.

After evidence.

  • Same live flow, rebuilt dist: active: "agentManager", rail includes agentManager, and rows are Automatic branch naming, Branch prefix, Pre-warm worktrees, Project (am-b8-ws - ...), Default Base Branch (Auto-detect), Worktree Setup Script (Create script). The project was preselected from the gear.
  • Default base branch: the picker opened with main, selecting it changed the row to main and wrote "defaultBaseBranch": "main" in the fixture .kilo2/agent-manager.json.
  • Setup script: Create script created .kilo/setup-script and the row changed to Edit script.
  • Persistence: toggling Automatic branch naming off wrote kilo-code.v2.agentManager.autoBranchNaming = false; after Developer: Reload Window the restored panel showed active: "agentManager", naming: false, project am-b8-ws, base main, script Edit script.
  • Display tab rows include Show shortcut hints. Agent Behaviour agents subtab rows include Push Pull Request Fixes.

Commands and results.

  • bun test test/settings-navigation.test.ts test/settings-host-agent-manager.test.ts from packages/kilo-vscode: 12 pass, 0 fail, 24 expects.
  • bun test test/settings-*.test.ts test/agent-manager-settings.test.ts test/agent-manager-i18n.test.ts test/display-settings.test.ts: 72 pass, 0 fail.
  • bun typecheck from packages/kilo-vscode: exit 0, both tsc projects.
  • oxlint on the changed files: 0 warnings, 0 errors.
  • bun run build from packages/kilo-vscode: "built dist/".
  • Live verification: isolated VS Code, session am-fix-b8, no console errors observed.

Remaining risks.

  • AgentManagerTab imports ProjectBranchDialog, which imports agent-manager.css and agent-manager-review.css into the Settings bundle, as v1 did. The global selectors are scoped to html[data-theme="kilo-vscode"] and .am-*, and the Settings screens checked showed no visual change, but a full CSS regression sweep was not run.
  • The branch picker loads branches on open, so the row shows Auto-detect until the picker is opened, matching v1.
  • While the Settings panel is open and the Agent Manager project registry changes elsewhere, the rows refresh on the next project load, write, or panel reload; there is no live subscription to project registry changes.

@marius-kilocode

Copy link
Copy Markdown
Collaborator Author

B7: intro dismissal breaks the Agent Manager empty state

Symptom

After dismissing the Agent Manager intro, the empty session showed only a "How Agent Manager works" button. The shared welcome, the recent sessions list, Show History and the keyboard shortcut hints were missing.

Cause

createIntro already built a dismissed fallback, but both mount points used only intro.render, and its dismissed branch rendered a bare reopen button. MessageList replaces its welcome with that empty element, so intro.fallback and hints.list were dead code.

Fix

  • webview-ui/agent-manager/intro/AgentManagerIntro.tsx: render now returns the introduction while visible and the dismissed fallback after dismissal. The fallback renders the shared Welcome with the shortcut hints and the reopen action. A useV2Optional guard keeps the previous reopen-only result when no V2 scope is available.
  • webview-ui/src/v2/welcome.tsx: optional footer prop rendered below the recent sessions, matching the v1 WelcomeEmptyState footer slot.
  • webview-ui/agent-manager/AgentManagerApp.tsx: the no-chat-store branch wraps intro.render in a V2Scope built from appSession.rootStore(), because Welcome calls useV2. The SessionView empty state was already inside the directory store scope.

The reopen action still works: it reveals the intro and persists the dismissed flag as before.

Files

  • packages/kilo-vscode/webview-ui/agent-manager/intro/AgentManagerIntro.tsx
  • packages/kilo-vscode/webview-ui/src/v2/welcome.tsx
  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx (SessionView intro mount block only)

Before evidence

Isolated VS Code, own session am-fix-b7, fixture am-b7-ws, pre-fix dist. One real session existed ("B7 recent session check"), then a new empty tab, then the intro was dismissed. Webview text snapshot of the empty state:

PROJECTS
A
am-b7-ws
(1)
local
main
New project...
Add project...
B7 recent session check
New Session
How Agent Manager works

No welcome sentence, no RECENT, no Show History, no shortcut hint rows.

After evidence

Same flow on the rebuilt dist from HEAD 5a21c59da75. After dismissing the intro with a real recent session present:

PROJECTS
A
am-b7-ws
(1)
local
main
New project...
Add project...
Untitled
New Session
Kilo Code is an AI coding assistant. Ask it to build features, fix bugs, or explain your codebase.
RECENT
Untitled
just now
Show History
Focus / hide terminal
How Agent Manager works

The screenshot shows the Kilo logo, the welcome text, the RECENT row with just now, Show History, the shortcut hint and the reopen button in the same empty session.

Clicking "How Agent Manager works" restored the introduction. Snapshot after the click contains:

Parallel tasks. Separate worktrees.
Create a worktree
Skip introduction
Bring changes back when you are ready
Resolve conflicts with Kilo /update-from-base
Read the guide

No Agent Manager webview console errors after the fix. The applied and restricted states were not edited and render through the same unchanged branches.

Commands and results

  • bun run build from packages/kilo-vscode: success, built dist/.
  • bun typecheck from packages/kilo-vscode: exit 0, 0 errors.
  • Isolated self-test (session am-fix-b7, disposable git fixture, own generated profile): launch, open Agent Manager, create a real session, open a new empty tab, dismiss the intro, observe the welcome, hints and reopen, click reopen, observe the introduction. Instance stopped with cleanup.

No commit, push, checkout, reset or stash was run for this fix.

The Agent Manager inspector releases a subagent when its tab closes. session.evict clears the root and every descendant, which would blank the parent transcript, so add a per-session message evict and use it.
# Conflicts:
#	packages/kilo-cli/startup-budget.json
#	packages/kilo-plugin/src/index.ts
#	packages/kilo-plugin/test/index.test.ts

@WebReflection WebReflection left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless you want to wait forever, even my automated bot failed at this (probably context related) but kilobot is OK and I trust you, after so many iterations, things are safe and sound in here for v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent-manager Agent Manager area:cli CLI, TUI and core engine area:ui Shared UI components area:vscode VS Code extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants