Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use primary agent for the remote authority when opening a workspace#552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

EhabY
Copy link
Collaborator

#121

This change updates the behavior when opening a workspace from the sidebar: the first agent is now opened automatically using the same remote authority URI as when opening the agent directly.

If a workspace has multiple agents, we always open the first one, skipping the agent selection QuickPick when the folder is opened. I implemented it this way since we're already opening thefolderPath of the first agent by default.

If this behavior should only apply when there's a single agent, it's easy to adjust. But in that case, should we also avoid passing thefolderPath when multiple agents are present?

@code-asher
Copy link
Member

I think it is reasonable to open the first agent when you click on the workspace. I could see an argument for making it pop open the agent select dialog, but if a user wants a different agent they could just click the right one directly on the sidebar instead. But, idk if users feel differently. We could always change it if we get feedback, this is already an improvement IMO.

That said, I think we should make an additional fix, inopenWorkspace we should makeworkspaceAgent non-undefined so we always have to pass one in, and we always get a consistent remote authority, no matter what calls the function.

@code-asher
Copy link
Member

Also forgot to say, thank you for the contribution!

@matifalimatifali requested a review frommafredriJuly 16, 2025 07:23
@EhabY
Copy link
CollaboratorAuthor

EhabY commentedJul 16, 2025
edited
Loading

Happy to contribute to this project :)!

I could see an argument for making it pop open the agent select dialog

This is the current behavior if a workspace is opened with no agent in the remote authority, and there are multiple agents in the workspace.

Should I then get rid of this QuickPick? Or offer it when trying to open the workspace and there are multiple agents?

in openWorkspace we should make workspaceAgent non-undefined so we always have to pass one in

The issue there is thatcommands.ts#open can sometimes be called without an agent, I can instead offer a QuickPick when there are multiple agents so we always pass an agent as you indicated or else never even callopen.

code-asher reacted with heart emoji

@code-asher
Copy link
Member

code-asher commentedJul 16, 2025
edited
Loading

This is the current behavior if a workspace is opened with no agent in the remote authority, and there are multiple agents in the workspace.

True, but it happens after we open with that remote authority, which can cause the issue in#121. Ideally we do it before, so we are guaranteed one stable remote authority per agent.

Should I then get rid of this QuickPick

I think we should keep it in case someone uses the open command from the command palette. When going that route, I think it makes sense to show the agent picker still.

The issue there is that commands.ts#open can sometimes be called without an agent, I can instead offer a QuickPick when there are multiple agents

Exactly my thinking, we refactor this function just a bit so we always callmaybeAskAgent() (instead of only whenargs.length === 0) and abort if the user declines to pick one.

@EhabY
Copy link
CollaboratorAuthor

Ideally we do it before, so we are guaranteed one stable remote authority per agent.

It is now done when callingopen(...) so it happens before we open the workspace folder.

I think we should keep it in case someone uses the open command from the command palette. When going that route, I think it makes sense to show the agent picker still.

Actually for line 410 inremote.ts#setup:const gotAgent = await this.commands.maybeAskAgent(workspace, parts.agent); seems useless now because we never open without an agent (from the tree view or the command palette). I guess it's useful to keep if users manually input their remote authority (or use one from an older version)

@code-asher
Copy link
Member

code-asher commentedJul 17, 2025
edited
Loading

Actually for line 410 in remote.ts#setup: const gotAgent = await this.commands.maybeAskAgent(workspace, parts.agent); seems useless now because we never open without an agent (from the tree view or the command palette). I guess it's useful to keep if users manually input their remote authority (or use one from an older version)

I was thinking the same thing, it would be nice to remove it but I guess we need it for existing connections from the recents menu which might lack the agent. I think we do not need it for the manual input case though, because that would trigger the URI handler which callsopen which now ensures it gets an agent.

Possibly we could rewrite these entries to add the agent, then we could delete that code, but not sure how hard that would be.

@code-asher
Copy link
Member

code-asher commentedJul 17, 2025
edited
Loading

I just realized you were talking about the quick pick inremote.ts this whole time; I thought the first mention was the one incommands.ts which is why I was talking about the command palette, my bad 🤦 (well, they both use the same picker/code but you know what I mean)

So:

  • remote.ts picker: now only used when opening a recent connection that has no agent in the host name, possibly we can remove this one day
  • commands.ts picker: used when handling a URI that lacks an agent or when launching from the command palette, will stick around

@EhabY
Copy link
CollaboratorAuthor

Indeed, I was talking about the one in theremote.ts but it seems like it'll have to stay (for now)

code-asher reacted with thumbs up emoji

@EhabYEhabYforce-pushed theopen-primary-agent-for-workspace branch from234672b to730ada9CompareJuly 18, 2025 17:30
Copy link
Member

@code-ashercode-asher left a comment

Choose a reason for hiding this comment

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

🎉

@code-ashercode-asher merged commit0e9fb55 intocoder:mainJul 24, 2025
2 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@code-ashercode-ashercode-asher approved these changes

@DanielleMaywoodDanielleMaywoodAwaiting requested review from DanielleMaywood

@ethanndicksonethanndicksonAwaiting requested review from ethanndickson

@mafredrimafredriAwaiting requested review from mafredri

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Opening workspace or agent opens two different workspaces (even for a single-agent workspace)
2 participants
@EhabY@code-asher

[8]ページ先頭

©2009-2025 Movatter.jp