coder / coder/terraform-provider-coder
Deprecating `dir` leaves no way to configure where helper apps open
- Dominant language
- Go
- Stars
- 60
- Forks
- 27
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 2
Description
## 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](https://registry.coder.com/modules/coder/vscode-desktop) with `folder`:
```terraform
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:
```terraform
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
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the `dir` deprecation in #507 and the migration-guidance discussion, then trace how `coder_agent` helper apps and the VS Code extension choose their directory. The scope needs agreement before implementation: done should provide a first-class directory configuration without breaking Coder Desktop file sync, with a documented migration path for the web terminal and VS Code workflows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, terraform, vscode
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100