Skip to content

fix(agent-env): support Linux / Podman hosts for create and restart - #114

Merged
johnzook merged 1 commit into
mainfrom
fix/linux-podman-devcontainer
Jun 4, 2026
Merged

fix(agent-env): support Linux / Podman hosts for create and restart#114
johnzook merged 1 commit into
mainfrom
fix/linux-podman-devcontainer

Conversation

@zook-bot

@zook-bot zook-bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes agent-env create on Linux / Podman hosts (previously macOS + Docker Desktop only):

  • Cross-platform SSH agent forwarding — the SSH agent socket mount was hardcoded to /run/host-services/ssh-auth.sock (a path only Docker Desktop/OrbStack inject on macOS), causing docker run to fail on Linux. Moved it out of the static image LABEL into a platform-aware resolver (resolveSshAgentMount) that forwards the host agent on Linux as ${localEnv:SSH_AUTH_SOCK} — substituted by the devcontainer CLI at each devcontainer up, so attach/code restarts survive ephemeral agent socket path changes across logout/reboot — keeps the fixed path on macOS, and omits the mount entirely when no agent is available.
  • pnpm 11 compatibility — the post-create CLI install used pnpm link --global, a form pnpm 11 removed, so it failed with ERR_PNPM_LINK_BAD_PARAMS and aborted container creation. Switched the dev-mount install (post-create.sh) and the setup:agent-env script to pnpm add -g <dir>.
  • Actionable error when the devcontainer CLI is missing — a missing devcontainer binary spawned with ENOENT and surfaced as an empty "No error details available" message. Added a pre-flight check that returns a clear DEVCONTAINER_CLI_MISSING error pointing to npm install -g @devcontainers/cli or VS Code's bundled CLI. The CLI remains a soft dependency.

init-host.sh's pre-flight SSH agent warning runs as initializeCommand on every up, so on Linux it now checks the host's real $SSH_AUTH_SOCK and prints actionable ssh-agent/ssh-add guidance exactly when the mount would fail.

Test plan

  • pnpm vitest run in packages/agent-env — 47 files, 1053 tests pass
  • tsc --noEmit clean
  • New unit tests for resolveSshAgentMount (macOS fixed path, Linux ${localEnv:SSH_AUTH_SOCK} variable, null when no agent) and buildManagedConfig SSH mount injection

- Forward the host SSH agent via ${localEnv:SSH_AUTH_SOCK} on Linux,
  resolved at each devcontainer up so restarts survive ephemeral agent
  socket path changes; keep the fixed Docker Desktop/OrbStack path on
  macOS, and omit the mount when no agent is available
- Switch dev-mount CLI install to pnpm add -g (pnpm 11 removed
  pnpm link --global)
- Add a pre-flight check surfacing an actionable DEVCONTAINER_CLI_MISSING
  error instead of an empty ENOENT when the devcontainer CLI is absent
@changeset-bot

changeset-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ad3dd59

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@zookanalytics/agent-env Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@johnzook
johnzook merged commit 95f48f9 into main Jun 4, 2026
4 checks passed
@johnzook
johnzook deleted the fix/linux-podman-devcontainer branch June 4, 2026 05:21
@github-actions github-actions Bot mentioned this pull request Jun 4, 2026
johnzook added a commit that referenced this pull request Aug 2, 2026
* feat(agent-env): pin managed image tag to agent-env version

Image is requested as :<version> instead of :latest so upgrading the npm
package reliably picks up the matching container image on next rebuild.
Adds image-drift banner in the interactive menu, an actionable
IMAGE_VERSION_NOT_PUBLISHED error for the post-release lag window, a
dogfood pin sync script wired into the Changesets version step, and a CI
check verifying the pin matches the package version.

* fix(ci): keep dogfood pin diagnostics reachable under bash -e

Failed grep/jq extractions previously aborted the step before the
actionable error messages could print.

* chore(devcontainer): sync dogfood image pin to 1.1.1

* test(agent-env): add isDevcontainerCliAvailable to container mock

Upstream Podman support (#114) added the method to ContainerLifecycle
after this branch's mock was written.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants