Skip to content

Deprecating dir leaves no way to configure where helper apps open #523

Closed

Description

@bpmct

Problem

dir on coder_agent was deprecated in #507 (to avoid breaking Coder Desktop file sync). But dir was also how templates controlled where the helper apps open:

  • the built-in vscode display app opens the folder from dir
  • the web terminal starts sessions in dir

With dir deprecated, there's no first-class replacement for either. A community member flagged this — most of their users only ever interact with the directory their code is cloned into.

Workarounds today

VS Code Desktop: hide vscode in display_apps and use the vscode-desktop module with folder:

resource "coder_agent" "main" {
  os   = "linux"
  arch = "amd64"

  display_apps {
    vscode = false
  }
}

module "vscode" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/vscode-desktop/coder"
  version  = "1.2.1"
  agent_id = coder_agent.main.id
  folder   = "/home/coder/project"
}

⚠️ This only works via the dashboard button. If users open the workspace directly from the VS Code extension sidebar (which is how the community member expects it to work, and how many of our own engineers connect), the extension reads the agent's expanded directory — i.e. dir — so there's no workaround at all for that path.

Web terminal: hide web_terminal in display_apps and add a coder_app with a command that cd's first:

resource "coder_agent" "main" {
  os   = "linux"
  arch = "amd64"

  display_apps {
    vscode       = false
    web_terminal = false
  }
}

resource "coder_app" "terminal" {
  agent_id     = coder_agent.main.id
  slug         = "terminal"
  display_name = "Terminal"
  icon         = "/icon/terminal.svg"
  command      = "cd /home/coder/project && exec $SHELL"
}

Neither is obvious, and neither is documented as the migration path.

Suggestion

  1. Document this better — e.g. discourage use of the helper apps and point to coder_app / registry modules with explicit folder/command properties. Not ideal on its own though: people connecting directly from the VS Code extension never touch the dashboard buttons, so better docs don't help them at all.
  2. Add a proper way for helper apps (and the VS Code extension) to open in a directory, without the file sync breakage that dir caused.
  3. Other ideas welcome!

cc @matifali @mafredri — related to the migration-guidance discussion on #507

Generated by Coder Agents

Activity

  1. linear-code commented on Jul 8, 2026

    @linear-code
  2. mafredri commented on Jul 9, 2026

    @mafredri
    Member

    Add a proper way for helper apps (and the VS Code extension) to open in a directory, without the file sync breakage that dir caused.

    I think the deprecation of dir is an opportune moment for us to re-consider how folder selection happens. Here at coder/coder we basically have one template, but we work on multiple projects. Having this folder be defined at the template level makes sense for some apps, but not for others. Take the VS Code Desktop button, for example, as a user I'd love to choose which folder is actually opened up.

    Some kind of file explorer is one option, another would be automatic project discovery (e.g. find all .git repos in home).

    For the VS Code extension, and when connecting through it, we could also utilize the automatic project discovery there to give options when connecting to a workspace.

  3. 35C4n0r commented on Jul 17, 2026

    @35C4n0r

    Some kind of file explorer is one option

    I'm in favour of this, we can add a new params in coder_app: enable_file_picker & file_picker_output_env

    coder_app {
      enable_file_picker = true
      file_picker_output_env = "OPEN_VSCODE_IN_FOLDER"
      command = <<-EOF
       ...
       ARG_FOLDER=$${OPEN_VSCODE_IN_FOLDER:-/home/coder/coder} \
       ...
    }

    User gets a dropdown arrow on the rightmost side of the app if enable_file_picker is enabled where they get a vscode like file picker (we can come up with a better UX)

    Image
  4. coder commented on Oct 9, 2026

    @coder

    Closing, since the premise no longer holds: coder_agent.dir is no longer deprecated. The only reason for the deprecation was Coder Desktop file sync, which is now fixed by bundling Mutagen v0.18.5 (macOS v0.8.4+, Windows v0.8.5+). The deprecation and plan-time warning were reverted in #549 and will ship in the next provider release, so dir remains the way to set where helper apps and the VS Code extension open.

    If the per-user folder picker idea discussed above is still wanted, please open a new issue for it.

    Posted on behalf of @matifali

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions