Skip to content

URI handler falls back to agent expanded_directory when folder is absent #843

@blinkagent

Description

@blinkagent

Description

Since v1.10.0, when the vscode://coder.coder-remote/open URI handler is invoked without a folder query parameter, the extension now falls back to agent.expanded_directory (i.e. the coder_agent dir attribute from the template). Previously, an absent folder parameter would result in opening a bare VS Code window connected to the workspace (no folder opened), or deferring to recently opened workspaces.

This behavior was introduced as a side effect of the stable-session work in #552 and commit e335ced, which ensured the agent name is always included in the remote authority. The folder fallback at openWorkspace() (src/commands.ts line ~765) applies uniformly to all callers:

if (!folderPath) {
  folderPath = agent.expanded_directory;
}

This means the URI handler and the sidebar "Open" action now converge on the same behavior, but it changes the semantics of the URI handler — there is no way to express "open a workspace without a folder" via the URI when the agent has expanded_directory set.

Expected behavior

An absent folder parameter in the URI should mean "don't open any specific folder" — i.e. open a bare VS Code window connected to the workspace, letting the user decide what to open. This was the behavior prior to v1.10.0.

Possible solutions

  • Differentiate between "folder not specified" (absent from URI) and "use default folder" in the URI handler path, so the expanded_directory fallback only applies to sidebar opens, not URI-based opens.
  • Support an explicit empty folder= parameter to signal "no folder" while keeping the current default fallback for absent folder.

Created on behalf of @davo-canva

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions