From 0dd258e037f21d4d7287f695eeed459add0afb0a Mon Sep 17 00:00:00 2001 From: Andrew Aquino Date: Fri, 25 Sep 2026 19:00:30 +0000 Subject: [PATCH] fix: remove "dir breaks Coder Desktop file sync" warning The coder_agent.dir plan/apply-time warning claimed that setting dir to a value other than $HOME breaks Coder Desktop file sync. That is no longer accurate now that the Mutagen fix (coder/mutagen#10) is released and bundled into the macOS and Windows Desktop clients, which resolve the agent's absolute home directory and use it for both the scp copy and the ssh exec. Remove the file-sync sentence from WarnDirNotHome and from the dir field description, and regenerate docs. The dir deprecation itself is unchanged and still steers users to $HOME, so no min-version/adoption gate is needed. Tracked in DESK-2. Opened by Coder Agents on behalf of @aqandrew. --- docs/resources/agent.md | 2 +- provider/agent.go | 4 +--- provider/helpers/validation.go | 5 ++--- provider/helpers/validation_test.go | 6 +++--- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/docs/resources/agent.md b/docs/resources/agent.md index d12146c2..fdba1883 100644 --- a/docs/resources/agent.md +++ b/docs/resources/agent.md @@ -77,7 +77,7 @@ resource "kubernetes_pod" "dev" { - `connection_timeout` (Number) Time in seconds until the agent is marked as timed out when a connection with the server cannot be established. A value of zero never marks the agent as timed out. - `dir` (String, Deprecated) The starting directory when a user creates a shell session. Defaults to `"$HOME"`. -~> **Warning:** This attribute is deprecated and will be removed in a future release. Setting `dir` to a value other than `$HOME` will break [Coder Desktop file sync](https://coder.com/docs/user-guides/desktop/desktop-connect-sync). +~> **Warning:** This attribute is deprecated and will be removed in a future release. - `display_apps` (Block Set, Max: 1) The list of built-in apps to display in the agent bar. (see [below for nested schema](#nestedblock--display_apps)) - `env` (Map of String) A mapping of environment variables to set inside the workspace. - `metadata` (Block List) Each `metadata` block defines a single item consisting of a key/value pair. This feature is in alpha and may break in future releases. (see [below for nested schema](#nestedblock--metadata)) diff --git a/provider/agent.go b/provider/agent.go index dc662e4a..356912fd 100644 --- a/provider/agent.go +++ b/provider/agent.go @@ -118,9 +118,7 @@ func agentResource() *schema.Resource { Optional: true, Deprecated: "dir has been deprecated and will be removed in a future release.", Description: "The starting directory when a user creates a shell session. Defaults to `\"$HOME\"`." + - "\n\n~> **Warning:** This attribute is deprecated and will be removed in a future release. " + - "Setting `dir` to a value other than `$HOME` will break " + - "[Coder Desktop file sync](https://coder.com/docs/user-guides/desktop/desktop-connect-sync).", + "\n\n~> **Warning:** This attribute is deprecated and will be removed in a future release.", ValidateFunc: helpers.WarnDirNotHome, }, diff --git a/provider/helpers/validation.go b/provider/helpers/validation.go index 0167877a..ce13257e 100644 --- a/provider/helpers/validation.go +++ b/provider/helpers/validation.go @@ -22,8 +22,8 @@ func ValidateURL(value any, label string) ([]string, []error) { } // WarnDirNotHome returns a warning if dir is set to a value other -// than $HOME, because this breaks Coder Desktop file sync. The dir -// attribute is deprecated and will be removed in a future release. +// than $HOME. The dir attribute is deprecated and will be removed in +// a future release. func WarnDirNotHome(val interface{}, _ string) ([]string, []error) { d, ok := val.(string) if !ok || d == "" || d == "$HOME" || d == "~" { @@ -31,7 +31,6 @@ func WarnDirNotHome(val interface{}, _ string) ([]string, []error) { } return []string{ `"dir" is deprecated and will be removed in a future release.`, - `Setting "dir" to a value other than $HOME will break Coder Desktop file sync.`, }, nil } diff --git a/provider/helpers/validation_test.go b/provider/helpers/validation_test.go index 41ac35e1..79208fbc 100644 --- a/provider/helpers/validation_test.go +++ b/provider/helpers/validation_test.go @@ -181,17 +181,17 @@ func TestWarnDirNotHome(t *testing.T) { { name: "absolute path", value: "/workspace", - warnCount: 2, + warnCount: 1, }, { name: "relative path", value: "projects/foo", - warnCount: 2, + warnCount: 1, }, { name: "tilde subdir", value: "~/projects", - warnCount: 2, + warnCount: 1, }, }