Skip to content

fix(vscode): resolve subagent permission cards after replies - #13704

Merged
marius-kilocode merged 2 commits into
mainfrom
investigate-stuck-subagent-permission-requests
Sep 2, 2026
Merged

marius-kilocode merged 2 commits into
mainfrom
investigate-stuck-subagent-permission-requests

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

A background subagent can successfully receive approval while its parent still shows a disabled Permission required (subagent) card. Collapsing the task releases the child event subscription, so the parent can miss permission.replied. The reply handler previously relied only on that event to clear the card.

Why This Change Was Made

A successful permission reply now sends the existing resolution message directly and clears its cached route. Permission recovery also uses the same revision-counter pattern as question recovery, so an older permission.list response cannot restore a resolved request.

This is limited to the extension reply/recovery path. It does not change permission policy, retain hidden subagent streams, or refactor CLI task cancellation.

User Impact

Allowing or denying a subagent permission clears the card even after its task view is collapsed. The normal expanded-view flow continues to work. Failed replies still leave the request available for retry.

Evidence

Reproduced before editing production code in isolated VS Code with the real extension/backend and a local scripted model, without real credentials or paid model calls:

  1. Launch a background child that calls agent_manager prompt.
  2. Expand its task, wait for the permission card, then collapse the task.
  3. Click Allow once.

Before: the prompt was accepted, but one permission card remained with both buttons disabled.

Before: the Agent Manager prompt completed but the subagent permission card remains disabled

After rebuilding: the same flow leaves zero permission cards and clears the waiting indicator. Also verified denial with the task collapsed, reopening the child after denial, and approval with the task expanded.

After: the collapsed subagent completes and the permission card is removed

  • Full extension unit suite: 4,591 passed, 1 skipped, 0 failed.
  • Added regression tests for successful once/always/reject replies without SSE, stale recovery responses, and revision invalidation. The three reply tests failed on the original handler before the fix.
  • bun run compile, bun run typecheck, bun run knip, and bun run check-kilocode-change passed. Compile includes lint.
  • Isolated VS Code and the scripted provider were stopped after testing.

Manual check: repeat steps 1–3, then repeat with Deny. The card must disappear without reopening the child or reloading VS Code.

@kilo-code-bot

kilo-code-bot Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (6 files)
  • .changeset/fix-subagent-permission-replies.md
  • packages/kilo-vscode/src/KiloProvider.ts
  • packages/kilo-vscode/src/kilo-provider/handlers/permission-handler.ts
  • packages/kilo-vscode/src/services/cli-backend/connection-service.ts
  • packages/kilo-vscode/tests/unit/connection-service-question.test.ts
  • packages/kilo-vscode/tests/unit/permission-recovery.test.ts

Reviewed by grok-4.6 · Input: 157K · Output: 14.7K · Cached: 472.2K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit d232c49 into main Sep 2, 2026
24 checks passed
@marius-kilocode
marius-kilocode deleted the investigate-stuck-subagent-permission-requests branch September 2, 2026 18:54
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