Fix Agent Manager session selector state#9922
Conversation
| const pendingAgent = draftID ? store.agentSelections[draftID] : pendingAgentSelection() | ||
| const pendingModel = draftID ? store.sessionOverrides[draftID] : undefined | ||
| if (draftID) { | ||
| const entries = transferVariants(store.variantSelections, draftID, session.id) |
There was a problem hiding this comment.
WARNING: Pending session preferences are copied but never cleared
transferVariants copies the pending tab's variant keys into the real session, but the original session/<draftID>/... entries remain in variantSelections; the same block also leaves agentSelections[draftID] and sessionOverrides[draftID] behind after copying them. Creating/sending many pending tabs will accumulate stale per-tab state for the lifetime of the webview. Clear the draft-scoped agent, model, and variant entries after transferring them to the real session.
| @@ -1744,7 +1767,7 @@ export const SessionProvider: ParentComponent = (props) => { | |||
| providerID, | |||
| modelID, | |||
| agent, | |||
There was a problem hiding this comment.
WARNING: Pending-tab mode selection is not used when sending
The mode selector now stores pending-tab choices under store.agentSelections[draftID], but sendMessage still builds agent from selectedAgentName(), which only reflects the current real session or global pending selection. For a pending Agent Manager tab with a non-default mode, the request can be sent with the default/old agent even though the UI shows the scoped mode. Use the same draft-aware scope as model/variant selection (for example agentForScope(draftID ?? sid)) when constructing this payload.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Resolved Previous Findings
Files Reviewed (5 files)
Reviewed by gpt-5.5-20260423 · 799,379 tokens |
Summary
packages/kilo-vscode/docs/agent-manager-session-preferences.md.Architecture Decisions
agent-manager.jsonremains topology-only: worktrees, sessions, tab order, and layout state. It does not store model, mode, or reasoning preferences.agent,model.providerID,model.modelID, andmodel.varianton the user message. On reload, the webview scans message history and restores the selectors from the latest user message.Validation