Skip to content

fix setting repo uri for new session#298735

Merged
sandy081 merged 1 commit intomainfrom
sandy081/grumpy-urial
Mar 2, 2026
Merged

fix setting repo uri for new session#298735
sandy081 merged 1 commit intomainfrom
sandy081/grumpy-urial

Conversation

@sandy081
Copy link
Member

@sandy081 sandy081 commented Mar 2, 2026

No description provided.

Copy link
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

This PR aims to ensure that when a new pending session is assigned to the local folder picker, the session’s repository URI is initialized from the picker’s already-selected folder (e.g., restored from storage), so the new session starts with the correct repo context.

Changes:

  • Update FolderPicker.setNewSession to call session.setRepoUri(...) when a folder is already selected.
  • Ensure repo selection is propagated even if the folder was chosen before the new session object existed.

setNewSession(session: INewSession | undefined): void {
this._newSession = session;
if (session && this._selectedFolderUri) {
session.setRepoUri(this._selectedFolderUri);
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

Calling session.setRepoUri(this._selectedFolderUri) here will run INewSession.setRepoUri, which for LocalNewSession also forces isolationMode to 'workspace' and clears branch. Since new sessions are already created with defaultRepoUri (see createNewSessionForTarget(..., defaultRepoUri)), this can unnecessarily overwrite the session’s initial state and duplicate option notifications. Consider guarding this call (e.g., only set when session.repoUri is undefined or different) so wiring the picker doesn’t mutate the session when it’s already initialized.

Suggested change
session.setRepoUri(this._selectedFolderUri);
const currentRepoUri = session.repoUri;
if (!currentRepoUri || !isEqual(currentRepoUri, this._selectedFolderUri)) {
session.setRepoUri(this._selectedFolderUri);
}

Copilot uses AI. Check for mistakes.
@sandy081 sandy081 merged commit b36e69a into main Mar 2, 2026
24 checks passed
@sandy081 sandy081 deleted the sandy081/grumpy-urial branch March 2, 2026 16:39
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