Skip to content

Overlay feature postStartCommand lost when existing Compose workspace restarts through SSH #1500

Closed

Description

@davzucky

Summary

A workspace started with an extra devcontainer configuration containing an auto-start feature loses that feature's postStartCommand when restarted through devsy workspace ssh. The container and SSH port-forwarding service run, but the application is not started.

Observed with Devsy v1.23.2, Docker Compose, Linux, after a host reboot. Source inspection below is against checkout f0f0d7c01; it is not a claim that this checkout exactly matches the installed binary.

Configuration

Base configuration: .devcontainer/hawk-monorepo/devcontainer.json.

Extra configuration:

{
  "features": {
    "ghcr.io/davzucky/devcontainers-features-wolfi/codex:1": {},
    "ghcr.io/davzucky/devcontainers-features-wolfi/t3code:2.0.1": {
      "autoStart": true,
      "baseDir": "/home/vscode/.t3/hawk-monorepo",
      "host": "0.0.0.0",
      "port": "3774"
    }
  }
}

A user service reconnects after boot with:

devsy workspace ssh hawk-monorepo \
  --forward-ports 127.0.0.1:3774:127.0.0.1:3774 \
  --command "sleep infinity"

Observed evidence

  • The earlier host-side workspace_result.json includes the T3 feature and /usr/local/share/t3code-devpod-start.sh in MergedConfig.postStartCommand.
  • The installed startup script still exists and contains the correct auto-start, base-directory, host, and port settings.
  • The existing container's devcontainer.metadata label does not include the T3 startup hook.
  • After restart, /var/run/devsy/result.json inside the container contains neither the T3 feature nor its startup hook. Other feature startup hooks and the base configuration's startup command remain.
  • /var/devsy/postStartCommands.marker matches the current container StartedAt timestamp. Lifecycle processing occurred, but with T3 absent from the effective command list.
  • Nothing listens on container port 3774. Direct curl http://127.0.0.1:3774 inside the container fails with connection refused; the host-side forwarded connection resets.

This is an observed existing-workspace failure; a clean-room minimal reproduction has not yet been performed. The original creation invocation was not recovered.

Suspected code path

  1. cmd/internal/container_tunnel.go, startContainer, invokes runner.Up with UpOptions{NoBuild: true} and no extra configuration path.
  2. pkg/devcontainer/config.go, getSubstitutedConfigWithContext, loads the overlay from options.ExtraDevContainerPath. An empty invocation option does not load the original overlay.
  3. pkg/devcontainer/compose.go, finalizeComposeContainer, reconstructs configuration from container metadata and the supplied extra configuration. For this container, neither source restores the T3 hook.

This explains the restart-time configuration loss. Why the original container metadata omitted the overlay feature hook remains unconfirmed and should be investigated before selecting a fix. Persisting an overlay path may not be the intended design; preserving the effective feature metadata could be the appropriate solution.

Expected behavior

Starting an existing workspace through SSH should preserve the effective feature lifecycle commands from its creation and execute the applicable postStartCommand hooks for the new container start.

The Dev Container specification defines postStartCommand as:

A command to run each time the container is successfully started.

Earlier lifecycle failures can prevent subsequent hooks; this report concerns a hook missing from reconstructed configuration, not an expectation that Docker itself executes devcontainer hooks.

Suggested regression coverage

Create a Compose workspace with an overlay-only feature declaring postStartCommand, then restart it through the SSH/container-tunnel path without repeating creation flags. Assert that the effective command list retains the feature hook and that the hook runs for the new start, without requiring a rebuild.

Activity

  1. skevetter commented on Oct 19, 2026

    @skevetter
    Contributor

    fix included with latest release

  2. davzucky commented on Oct 19, 2026

    @davzucky
    ContributorAuthor

    thank you very much,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions