Skip to content

make sure agents new sessions page respects selected picker#315586

Draft
justschen wants to merge 8 commits into
mainfrom
justin/pikipek
Draft

make sure agents new sessions page respects selected picker#315586
justschen wants to merge 8 commits into
mainfrom
justin/pikipek

Conversation

@justschen
Copy link
Copy Markdown
Collaborator

@justschen justschen commented May 11, 2026

Fixes TypeScript errors in copilotChatSessionsProvider.test.ts that caused the "Compile & Hygiene" CI job to fail.

Description

The test code incorrectly used disposables.add() on ICopilotChatSession objects returned by provider.getSession(). Since ICopilotChatSession does not extend IDisposable (it lacks a dispose method), this caused two TypeScript errors per test:

  • TS2741: Property 'dispose' is missing in type 'ICopilotChatSession' but required in type 'IDisposable'
  • TS2339: Property 'permissionLevel' does not exist on type 'IDisposable' (because disposables.add() returns IDisposable, losing the ICopilotChatSession type)

The fix reverts those calls back to the original pattern of directly using provider.getSession(sessionInfo.sessionId) with optional chaining (session?.permissionLevel.get()). Sessions are owned and managed by the provider, which is itself tracked by the test's DisposableStore, so no separate disposal of the session is needed.

Testing

  • ✅ TypeScript compilation errors resolved
  • ✅ No functional changes to session lifecycle or test coverage

Copilot AI review requested due to automatic review settings May 11, 2026 01:21
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

Base: 56bb9f5d Current: f22daf18

No screenshot changes.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a regression in the Agents/Sessions “new session” flow where the permission mode picker could reset/lose the user’s chosen permission level while the session is starting.

Changes:

  • Avoid resetting permission level on empty chat input state unless the model has no permission level set.
  • Make the sessions permission picker’s trigger label follow the active session’s permission level via an observable.
  • Seed newly created Copilot (CLI/Local) sessions with the configured default permission level, clamped when enterprise policy disables auto-approval.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts Changes empty-state initialization so permission level isn’t overwritten when a non-default value is already present.
src/vs/sessions/contrib/copilotChatSessions/browser/permissionPicker.ts Adds a derived observable on the Copilot delegate so the picker label stays in sync with the active session’s permission level.
src/vs/sessions/contrib/copilotChatSessions/browser/copilotChatSessionsProvider.ts Seeds new sessions’ permission level from chat.permissions.default with enterprise-policy clamping and reuses that logic across creation paths.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Comment thread src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts Outdated
roblourens
roblourens previously approved these changes May 11, 2026
roblourens
roblourens previously approved these changes May 11, 2026
@justschen
Copy link
Copy Markdown
Collaborator Author

@copilot i'm seeing the following error:

"after each" hook for "CLI session seeds permission level from chat.permissions.default":

Error: There are 1 undisposed disposables!

here are the logs:
==================== Leaking disposable 1/1: CopilotCLISession ====================
(shared with 1/1 leaks) at new Disposable (http://localhost:34013/410daf979332fc894a851e0283909425/out/vs/base/common/lifecycle.js:368:5)
(shared with 1/1 leaks) at new CopilotCLISession (http://localhost:34013/410daf979332fc894a851e0283909425/out/vs/sessions/contrib/copilotChatSessions/browser/copilotChatSessionsProvider.js:64:5)
(shared with 1/1 leaks) at TestInstantiationService._createInstance (http://localhost:34013/410daf979332fc894a851e0283909425/out/vs/platform/instantiation/common/instantiationService.js:118:20)
(shared with 1/1 leaks) at TestInstantiationService.createInstance (http://localhost:34013/410daf979332fc894a851e0283909425/out/vs/platform/instantiation/common/instantiationService.js:93:21)
(shared with 1/1 leaks) at TestInstantiationService.createInstance (http://localhost:34013/410daf979332fc894a851e0283909425/out/vs/platform/instantiation/test/common/instantiationServiceMock.js:38:18)
(shared with 1/1 leaks) at CopilotChatSessionsProvider.createNewSession (http://localhost:34013/410daf979332fc894a851e0283909425/out/vs/sessions/contrib/copilotChatSessions/browser/copilotChatSessionsProvider.js:1170:47)
(shared with 1/1 leaks) at Context. (http://localhost:34013/410daf979332fc894a851e0283909425/out/vs/sessions/contrib/copilotChatSessions/test/browser/copilotChatSessionsProvider.test.js:1010:36)

Co-authored-by: justschen <54879025+justschen@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 11, 2026

@copilot i'm seeing the following error:

"after each" hook for "CLI session seeds permission level from chat.permissions.default":
...

The temp CLI session created by createNewSession isn't tracked by _sessionCache until commit, so deleteSession doesn't dispose it. Fixed in dd3f560 by adding the returned session to the test's disposable store.

Co-authored-by: justschen <54879025+justschen@users.noreply.github.com>
Copilot AI changed the title make sure agents new sessions page respects selected picker Fix TypeScript compile errors in copilotChatSessionsProvider tests May 11, 2026
@justschen justschen marked this pull request as draft May 11, 2026 04:23
auto-merge was automatically disabled May 11, 2026 04:23

Pull request was converted to draft

@justschen justschen changed the title Fix TypeScript compile errors in copilotChatSessionsProvider tests make sure agents new sessions page respects selected picker May 12, 2026
@justschen justschen requested a review from Copilot May 12, 2026 04:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 5

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.

4 participants