fix(vscode): route permission replies through request directories - #11133
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (9 files)
Incremental review notesNew commits since last review (
Reviewed by claude-4.6-sonnet-20260217 · 247,001 tokens Review guidance: REVIEW.md from base branch |
|
This also follows up #9283 and fixes #11132. #9450 addressed the stale prompt case from #9283, but kept the permission request-to-directory mapping inside each provider. #10787 captured the directory earlier, but retained that provider-local lifecycle gap. Centralizing the mapping in the shared connection service here covers both the original multi-panel hang and the current continued/Agent Manager session failure. |
|
Follow-up pushed in b0d643c. Pending-permission recovery now distinguishes a successful empty list from a failed directory query. If one worktree temporarily fails to list permissions, we keep its cached request-to-directory routes instead of pruning them and risking the same wrong-instance reply failure. Successfully queried directories are still pruned normally. The commit also adds regression coverage for that partial-failure case and the missing patch changeset. |
|
Tested this, fixes now all cases. Thanks @kirillk I will merge it |
…lo-Org#11133) * fix(vscode): route permission replies through request directories * fix(vscode): preserve permission routes during recovery --------- Co-authored-by: marius-kilocode <marius@kilocode.ai>
Issue
Fixes #11132.
Symptoms
KiloProvider: Failed to respond to permission: Error: Permission request not found: per_....Why This Happens
Permission requests are stored by the CLI backend in directory-scoped
InstanceState. The permission reply endpoint routes only byrequestIDanddirectory, not by session ID. If the extension replies with the correct permission ID but falls back to the workspace root or another stale directory, the backend looks in the wrong pending-permission map and returnsPermission request not found.The backend already includes the authoritative instance directory on
permission.askedSSE events. The bug was that VS Code stored that request-directory mapping inside individualKiloProviderinstances. Provider filtering, webview recreation, Agent Manager registration races, or global auto-approve handling could miss that provider-local state and reply from the wrong directory.Fix
KiloConnectionServicebefore SSE events are filtered to individual providers.permission.askedevents are found in the correct backend instance.Why This Approach
KiloConnectionServiceowns the single shared CLI backend connection used by the sidebar, editor tabs, and Agent Manager, so it is the one place that sees all SSE events before provider-specific filtering. Keeping the request-directory map there makes permission replies independent of which provider saw the original event or which provider later handles the response. It also keeps the fix entirely in the VS Code extension without changing the CLI, SDK, or backend permission API.Validation
bun test tests/unit/permission-recovery.test.ts tests/unit/auto-approve.test.tsbun run typecheckbun run lint(passes with existingeqeqeqwarning insrc/kilo-provider-utils.ts:721)bun turbo typechecksuccessfully.