Skip to content

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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions