Skip to content

fix(vscode): apply the selected agent instead of the stale session agent - #13142

Merged
marius-kilocode merged 1 commit into
Kilo-Org:mainfrom
hdcodedev:fix/resolve-prompt-agent-draft-pending-fallback
Aug 17, 2026
Merged

fix(vscode): apply the selected agent instead of the stale session agent#13142
marius-kilocode merged 1 commit into
Kilo-Org:mainfrom
hdcodedev:fix/resolve-prompt-agent-draft-pending-fallback

Conversation

@hdcodedev

@hdcodedev hdcodedev commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Issue

After switching Ask→Code, new draft/cloud-import sessions could get stuck in the old mode (#13102, partially fixed by #13121). Now the explicit mode selection is honored for them too.

Implementation

resolvePromptAgent now falls back to the pending selection only for draft/cloud-import scopes (IDs that are not real server sessions). For a real server session with no stored selection it returns undefined, so the backend keeps that session's own agent instead of flipping it to the stale/default pending agent. Covered by unit tests for both the draft-scope-with-no-entry case and the server-session-must-not-flip case.

Screenshots / Video

Bug

bug.mp4

Fix

fix.mp4

How to Test

Manual/local verification

  • In the development extension, start a new draft/cloud-import session, select an agent (e.g. Ask), then switch and send in another mode; confirm the turn runs in the explicitly selected agent rather than the previously persisted one.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

@hdcodedev hdcodedev changed the title fix(vscode): fall back to pending agent for draft sessions without se… fix(vscode): fall back to pending agent for draft sessions without selection Aug 15, 2026
@hdcodedev hdcodedev changed the title fix(vscode): fall back to pending agent for draft sessions without selection fix(vscode): apply the selected agent instead of the stale session agent Aug 15, 2026
@hdcodedev
hdcodedev force-pushed the fix/resolve-prompt-agent-draft-pending-fallback branch from 07a98fe to 6602229 Compare August 15, 2026 18:36
Comment thread packages/kilo-vscode/webview-ui/src/context/session-agent.ts
@kilo-code-bot

kilo-code-bot Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental review at f8dce5b: the previous warning on resolvePromptAgent is resolved — the pending fallback is now gated to draft/cloud-import scopes (non-ses_ IDs), real server sessions with no stored selection return undefined, and a unit test covers the new case. No new issues found in the changed lines.

Files Reviewed (2 files)
  • packages/kilo-vscode/webview-ui/src/context/session-agent.ts
  • packages/kilo-vscode/tests/unit/session-agent.test.ts
Previous Review Summary (commit 6602229)

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

Previous review (commit 6602229)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/src/context/session-agent.ts 38 pending fallback now applies to any sessionID lacking a per-session entry — including real existing sessions — so a stale/default pending agent can override the server-side session agent; gate the fallback to draft/cloud-import scopes
Files Reviewed (3 files)
  • .changeset/selected-agent-over-stale-session.md
  • packages/kilo-vscode/tests/unit/session-agent.test.ts
  • packages/kilo-vscode/webview-ui/src/context/session-agent.ts - 1 issue

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 139.6K · Output: 5.1K · Cached: 459.3K

Review guidance: REVIEW.md from base branch main

@hdcodedev
hdcodedev marked this pull request as draft August 15, 2026 19:16
@hdcodedev
hdcodedev force-pushed the fix/resolve-prompt-agent-draft-pending-fallback branch from 6602229 to f8dce5b Compare August 15, 2026 19:18
@hdcodedev
hdcodedev marked this pull request as ready for review August 15, 2026 19:24
@marius-kilocode

Copy link
Copy Markdown
Collaborator

@hdcodedev thanks, looks like the right regression fix.

@marius-kilocode
marius-kilocode merged commit 2b6c8b6 into Kilo-Org:main Aug 17, 2026
24 checks passed
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