Skip to content

Seed new chat-input sessions from the remembered session-config picks - #334814

Open
Ryan Ewen (RyanEwen) wants to merge 1 commit into
microsoft:mainfrom
RyanEwen:fix/panel-remembers-approvals
Open

Seed new chat-input sessions from the remembered session-config picks#334814
Ryan Ewen (RyanEwen) wants to merge 1 commit into
microsoft:mainfrom
RyanEwen:fix/panel-remembers-approvals

Conversation

@RyanEwen

Copy link
Copy Markdown
Contributor

A new session's config is seeded from two different places depending on which surface starts it.

The Agents window replays the user's last picks from profile storage:

// baseAgentHostSessionsProvider.ts
const rememberedValues = this._storageService.getObject<...>(STORAGE_KEY_REMEMBERED_SESSION_CONFIG_VALUES, StorageScope.PROFILE, {});
for (const [property, value] of Object.entries(rememberedValues)) {
    if (typeof value === 'string' && isRememberedSessionConfigKey(property)) {
        config[property] = value;
    }
}

The chat input does not. AgentHostUntitledProvisionalSessionService._getInitialConfig reads only chat.defaultConfiguration, which writes the autoApprove and mode axes. Every other session-config property falls back to its schema default, no matter how many times the user changes it.

What a user sees

Claude's Approvals chip is the visible case. It reads permissionMode (default / acceptEdits / plan / auto), and chat.defaultConfiguration never writes that property. So the Agents window keeps whatever approvals level was last chosen, while every new chat in the panel opens on Default. Setting chat.defaultConfiguration.approvals does not help, because it lands on autoApprove instead.

It is not specific to Claude. Any agent-advertised config property outside those two axes has the same asymmetry; permissionMode is simply the one with a chip in front of it.

What this changes

REMEMBERED_SESSION_CONFIG_STORAGE_KEY and isRememberedSessionConfigKey move into sessionConfigKeys.ts, which both layers already import, so there is one definition instead of a copy in the sessions provider. The chat input then seeds its initial config from that same store.

Deliberately conservative in two ways. SessionConfigKey.Isolation is spread last so it stays host-owned rather than being restorable from a remembered pick. And the existing chat.defaultConfiguration handling is untouched, so autoApprove and mode keep the precedence they have in this path today; only properties the setting never wrote are affected. Bringing those two axes in line with the Agents window's policy > remembered > effective order would be a separate, more visible change.

AI disclosure: this comment and the related code were written with the assistance of AI.

The Agents window and the chat input seed a new session's config from two
different places. The Agents window replays the user's last picks from profile
storage; the chat input reads only `chat.defaultConfiguration`, which covers the
`autoApprove` and `mode` axes and nothing else.

Any other property therefore falls back to its schema default in the chat input
however many times the user changes it. Claude's `permissionMode` is the visible
case: the Approvals chip reads that property, `chat.defaultConfiguration` does
not write it, so every new chat starts on Default while the Agents window keeps
whatever was last chosen.

Move the storage key and the remembered-key predicate into
`sessionConfigKeys.ts` so both surfaces share one definition rather than a copy,
and seed the chat input's initial config from the same store. Isolation is
spread last so it stays host-owned, and the existing `chat.defaultConfiguration`
handling is left in place, so the two axes it already governs keep their current
precedence in this path.
Copilot AI balanced review requested due to automatic review settings September 6, 2026 16:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new storage dependency breaks the existing unit-test setup, and the new behavior lacks regression coverage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Seeds chat-input sessions from the Agents window’s remembered configuration.

Changes:

  • Shares remembered-config storage helpers.
  • Applies remembered values while preserving existing overrides.
File summaries
File Description
agentHostUntitledProvisionalSessionService.ts Seeds chat sessions from stored picks.
baseAgentHostSessionsProvider.ts Uses shared storage helpers.
sessionConfigKeys.ts Defines shared key and validation helper.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@IAgentHostImportConversationStore private readonly _importConversationStore: IAgentHostImportConversationStore,
@IAgentHostActiveClientService private readonly _activeClientService: IAgentHostActiveClientService,
@IUriIdentityService private readonly _uriIdentityService: IUriIdentityService,
@IStorageService private readonly _storageService: IStorageService,
Comment on lines +1069 to +1075
const rememberedValues = this._storageService.getObject<Record<string, unknown>>(REMEMBERED_SESSION_CONFIG_STORAGE_KEY, StorageScope.PROFILE, {});
for (const [property, value] of Object.entries(rememberedValues)) {
if (typeof value === 'string' && isRememberedSessionConfigKey(property)) {
remembered[property] = value;
}
}
const config: Record<string, unknown> = { ...remembered, [SessionConfigKey.Isolation]: 'folder' };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants