-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Current Behavior
File sync fails to install the Mutagen agent on workspaces where the coder_agent resource has a dir property set to a directory other than $HOME.
The error:
I can see the agent was scp'd to $HOME/coder (repo location):
coder@upload-code-pastebin-dcbe:~$ grep -r mutagen-agent /home/coder/*
grep: /home/coder/coder/.mutagen-agentc8a65917-9e3a-40b6-9af9-947bfd9e27ac: binary file matches
Root Cause Investigation
This seems to be caused by an interaction between Coder Desktop's bundled Mutagen binary and the breaking change in coder/coder#21194, which made SFTP/SCP respect coder_agent.dir.
Prior to that PR, SCP landed files in $HOME while SSH sessions used dir. Mutagen's agent installation relied on SCP landing the binary in $HOME and then SSH executing it from $HOME. The original mismatch between SCP and SSH working directories was tracked in coder/coder#16568.
After the PR, both SCP and SSH now use dir. However, Mutagen appears to use an absolute $HOME-based path (/home/coder/.mutagen-agent<UUID>) when SCPing the binary, bypassing the dir setting. The SSH execution step then looks for the binary relative to dir (/home/coder/coder/), and the file isn't there.
SSHing into the workspace and running ls -la ~/.mutagen-agent* shows no files, confirming the binary never lands in $HOME.
Steps to Reproduce
- Use a Coder deployment running v2.30+ (which includes the SFTP/SCP dir change from PR #21194)
- Use a template that sets
dironcoder_agentto a non-home directory, e.g.:
resource "coder_agent" "dev" {
arch = "amd64"
os = "linux"
dir = "/home/coder/coder"
}
(The dogfood "Write Coder on Coder" template does this)
- Open Coder Desktop -> File Sync
- Configure a sync session to the workspace
- Observe the error on "Installing agent..."
Expected Behavior
Mutagen installs its agent and file sync begins successfully, regardless of the coder_agent.dir setting.
Environment
- Coder Desktop: v0.8.0 (macOS)
- Coder deployment: v2.30.1+ (dogfood, running main)
- Template: dogfood "Write Coder on Coder"
(dir = local.repo_dir -> /home/coder/coder) - Workspace: Linux (amd64)
Additional Context
- Original SCP/SSH mismatch issue: coder_agent dir property breaks Mutagen file sync from Windows coder#16568
- Breaking SFTP/SCP change: fix(agent/agentssh)!: use configured directory for SFTP connections coder#21194