Repository navigation
Description
Before submitting
- I have searched existing issues to confirm this is not a duplicate
- I am running the latest version of Devsy
What happened?
When devsy runs inside another application's Flatpak sandbox (not Devsy's own sh.devsy.app), ReexecOnHost() in pkg/flatpak/flatpak.go re-executes the command on the host with flatpak-spawn --host <host-binary> ... and no --directory. flatpak-spawn then asks the portal to start the host process in the caller's working directory. If that directory exists only inside the sandbox, the portal fails and devsy exits 1 before doing anything.
Real-world trigger: Claude Desktop (Flatpak com.anthropic.ClaudeDesktop) connects to a dev container through the SSH host that Devsy writes to ~/.ssh/config:
Host <workspace>.devsy
ProxyCommand "/tmp/.mount_Devsy.../resources/bin/devsy" workspace ssh --stdio --context default --user vscode <workspace> --workdir "/workspaces/<workspace>"
The app's launcher does cd /app/extra/claude-desktop (a path that exists only inside that Flatpak) and then runs ssh, which runs the ProxyCommand, which runs devsy. devsy sees /.flatpak-info, takes the re-exec path, and the portal call fails. The app sees only ssh: Connection closed by UNKNOWN port 65535.
The same ssh <workspace>.devsy from a normal host shell works. Running ssh inside the sandbox from a directory that exists on the host (for example /tmp) also works.
What did you expect to happen instead?
devsy should start the host process in a directory that exists on the host (for example $HOME), or skip the re-exec when it is not running inside Devsy's own Flatpak. The ProxyCommand should connect to the dev container.
Steps to reproduce
From inside any Flatpak sandbox that has /tmp shared with the host (so the Devsy AppImage mount is visible) and a working directory that exists only in the sandbox:
- Use a workspace created with a Docker/Podman provider and let Devsy write its SSH host entry.
- Inside the sandbox:
cd /app/extra/claude-desktop(any sandbox-only directory works). - Run
devsy workspace ssh --stdio --context default --user vscode <workspace> --debug
(orssh <workspace>.devsy true). - See the error below.
Minimal check of the portal behaviour, without Devsy:
cd /app/extra/claude-desktop
flatpak-spawn --host truedevcontainer.json
No response
Error output / logs
{"level":"debug","msg":"re-executing on host via flatpak-spawn: args=[workspace ssh --stdio --context default --user vscode <workspace> --debug]"}
Portal call failed: Failed to start command: Falló al cambiar a la carpeta «/app/extra/claude-desktop» (No existe el fichero o el directorio)
{"kind":"error","outcome":"error","code":"UNKNOWN","message":"command failed with exit code 1"}From the SSH client (ssh -vv):
debug1: Executing proxy command: exec "/tmp/.mount_Devsy.../resources/bin/devsy" workspace ssh --stdio ...
Portal call failed: Failed to start command: Falló al cambiar a la carpeta «/app/extra/claude-desktop» ...
Connection closed by UNKNOWN port 65535
How often does this happen?
Every time
Operating system
Linux
Linux distribution (if applicable)
Bluefin (Fedora 44 Silverblue base), kernel 7.x
Architecture
AMD64
Desktop app or CLI?
CLI only
Devsy version
v1.24.0
Devsy provider
Docker
Provider version
Podman provider (PODMAN_PATH=podman)
Screenshots
No response
Anything else?
Suggested fix in pkg/flatpak/flatpak.go:
- Pass a valid directory to
flatpak-spawn. Use--directory=$HOME, or the current directory only if it exists on the host. This is a one-line change tospawnArgs. - Only re-execute when running inside Devsy's own Flatpak.
InSandbox()only checks that/.flatpak-infoexists, so it is also true in any other app's sandbox. Compare thename=key in/.flatpak-infowithsh.devsy.app. - Optionally, retry once with
--directory=$HOMEif the portal call fails on the directory.
Workaround until fixed: make the ProxyCommand change to a host-valid directory first. ssh adds its own exec, so the cd has to be inside sh -c:
ProxyCommand sh -c 'cd "$HOME" && exec /tmp/.mount_Devsy.../resources/bin/devsy workspace ssh --stdio --context default --user vscode <workspace> --workdir /workspaces/<workspace>'
I tested this from /app/extra/claude-desktop and it connects. Devsy owns the # Devsy Start/End block in ~/.ssh/config, so the edit is lost when Devsy rewrites it. The /tmp/.mount_... path in that block also changes on every AppImage start.
Related, but a different bug: #634 (closed).
Activity
skevetter commentedon Nov 13, 2026
OpenSpec change: flatpak-host-spawn-directory
Classification: bug, code change required.
proposal.md
Why
ReexecOnHostinpkg/flatpak/flatpak.gorunsflatpak-spawn --host <binary> <args>without--directory. The portal starts the host process in the caller's working directory. When devsy runs inside another application's Flatpak sandbox and the working directory exists only in that sandbox (for example/app/extra/claude-desktop), the portal fails with "Failed to start command" and devsy exits 1 before doing any work.Root cause
flatpak-spawnforwards the sandbox cwd to the host portal. Sandbox-only paths do not exist on the host.cmd.Diris unset and no--directoryflag is passed.What changes
ReexecOnHostpasses--directory=<dir>toflatpak-spawn.<dir>is the current working directory unless it lies under/app(a path that exists only inside a sandbox). In that case<dir>is$HOME.$HOMEis used. If$HOMEis empty the flag is omitted.Out of scope
Restricting re-exec to Devsy's own Flatpak (
sh.devsy.app). Re-exec is also needed from other apps' sandboxes to reach the host container runtime. A retry on portal failure.design.md
Relative path arguments (for example
devsy up .) keep their meaning because the real cwd is forwarded whenever it can exist on the host. Only sandbox-only roots fall back to$HOME. The directory choice is a pure function so it is unit tested without a Flatpak runtime.tasks.md
1. Implementation
hostSpawnDirectory(cwd, home string) stringinpkg/flatpak/flatpak.go--directory=<dir>before--hostargs inReexecOnHost2. Tests
hostSpawnDirectoryfor host-visible cwd,/appcwd,/app/xcwd,/applicationcwd, empty cwd, empty homespecs/flatpak-host-reexec/spec.md
ADDED Requirements
Requirement: Host re-exec uses a host-valid working directory
ReexecOnHostSHALL start the host process in a directory that exists on the host.Scenario: Working directory exists on the host
/home/user/projectflatpak-spawnis invoked with--directory=/home/user/projectScenario: Working directory exists only in the sandbox
/app/extra/claude-desktopor/appflatpak-spawnis invoked with--directory=$HOMEScenario: Path prefix is not a sandbox root
/application/dataScenario: No usable directory
$HOMEis empty--directoryflag is passed