Skip to content

feat(agent-manager): stop managed sessions from tool - #12271

Merged
marius-kilocode merged 4 commits into
mainfrom
agent-manager-stop-session
Jul 17, 2026
Merged

feat(agent-manager): stop managed sessions from tool#12271
marius-kilocode merged 4 commits into
mainfrom
agent-manager-stop-session

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

Agents can inspect and prompt existing Agent Manager sessions, but they cannot currently stop a session that is no longer useful or is still running unwanted work. That leaves cleanup dependent on manually pressing the session tab close button.

Add a targeted action: "stop" operation that requires the existing Agent Manager permission with a dedicated stop pattern. The extension only accepts sessions owned by the current Agent Manager workspace, including live panel sessions that have not reached persisted state yet, while continuing to reject unrelated sidebar sessions. A successful stop reuses the same close path as the UI: it aborts active work, stops session background processes, clears Agent Manager routing and state, and removes the tab from the panel. Duplicate host delivery remains idempotent, so an acknowledgement retry cannot stop the session twice.

This extends the provider-facing schema introduced in #12244 rather than exposing the runtime union directly. The tool schema remains a plain object root without top-level anyOf, oneOf, or allOf, with stop added to the flat action enum so Anthropic and Bedrock routes retain the compatibility fixed there.

Comment thread packages/opencode/src/kilocode/tool/agent-manager.ts
Comment thread packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Both previously reported warnings are resolved in this update:

  • AgentManagerPermission.harden now covers the stop pattern alongside prompt, so a broad agent_manager: allow rule is correctly downgraded to ask for stop requests too.
  • The sessionClosed webview notification was moved out of onCloseSession (used by UI-initiated closes) into the orchestration bridge's close callback (used by the tool-initiated stop path), so UI closes no longer trigger a redundant round-trip.
Files Reviewed (4 files)
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
  • packages/kilo-vscode/tests/unit/agent-manager-close-session.test.ts
  • packages/opencode/src/kilocode/permission/agent-manager.ts
  • packages/opencode/test/kilocode/permission/agent-manager-prompt.test.ts
Previous Review Summary (commit c012826)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit c012826)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/tool/agent-manager.ts 309 New stop permission pattern isn't covered by AgentManagerPermission.harden, which only downgrades broad allow rules to ask for prompt
packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts 1239 sessionClosed notification fires unconditionally, including for UI-initiated closes, causing a redundant handleCloseTab round-trip that can steal focus later
Files Reviewed (15 files)
  • .changeset/agent-manager-stop-session.md
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts - 1 issue
  • packages/kilo-vscode/src/agent-manager/orchestration-bridge.ts
  • packages/kilo-vscode/src/agent-manager/types.ts
  • packages/kilo-vscode/tests/unit/agent-manager-close-session.test.ts
  • packages/kilo-vscode/tests/unit/agent-manager-orchestration-bridge.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx
  • packages/kilo-vscode/webview-ui/src/types/messages/extension-messages.ts
  • packages/opencode/src/kilocode/agent-manager/protocol.ts
  • packages/opencode/src/kilocode/agent-manager/service.ts
  • packages/opencode/src/kilocode/tool/agent-manager.ts - 1 issue
  • packages/opencode/src/kilocode/tool/agent-manager.txt
  • packages/opencode/test/kilocode/agent-manager-tool.test.ts
  • packages/sdk/js/src/v2/gen/types.gen.ts
  • packages/sdk/openapi.json

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-5 · Input: 34 · Output: 7.1K · Cached: 732.8K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit f2eb57a into main Jul 17, 2026
30 checks passed
@marius-kilocode
marius-kilocode deleted the agent-manager-stop-session branch July 17, 2026 09:01
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…ssion

feat(agent-manager): stop managed sessions from tool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants