Skip to content

[Bug]: INACTIVITY_TIMEOUT never stops an AWS machine (agent daemon crash-loops, and globs the wrong workspace.json path) #1238

Description

@teimatinimarin

Before submitting

  • I have searched existing issues to confirm this is not a duplicate
  • I am running the latest version of Devsy

What happened?

Version

devsy v1.18.0 (also v1.17.1), AWS provider, AWS_DEPLOYMENT_MODE=docker, macOS arm64 host.

What happens

INACTIVITY_TIMEOUT=10m is set on the provider and reaches the host correctly
(agent.inactivityTimeout: "10m" in the machine's workspace.json), but the
instance never stops. It runs until stopped by hand.

Two independent causes, both on the machine:

1. devsy.service crash-loops. The AWS provider's provider.json defines no
agent.dataPath, so InstallDaemon passes an empty agentDir, buildDaemonArgs
(pkg/daemon/agent/daemon.go:194) omits --agent-dir, and IsHostAgentInvocation
then rejects the invocation:

devsy internal agent daemon is only valid inside the workspace container or machine

systemd restarts it every 5s indefinitely (NRestarts=250 after 23 min on a fresh
machine; over 8200 on a long-lived one). The agent home is /home/devsy/.devsy.

2. Even when started, it sees no workspaces. workspaceConfigs()
(cmd/internal/agent_daemon.go:110) globs

/contexts//workspaces//workspace.json

but the AWS provider writes that file one level deeper:

/contexts/default/workspaces//agent/workspace.json

Zero matches, so the timeout is never evaluated.

Workaround

A systemd drop-in supplying --agent-dir, plus an ExecStartPre that symlinks the
globbed path to agent/workspace.json. A drop-in rather than a unit edit, because
installOrUpdateUnit rewrites devsy.service whenever its content differs.

With both in place the instance stops itself as configured (Client.InstanceInitiatedShutdown).

What did you expect to happen instead?

Expected

An idle AWS machine stops after INACTIVITY_TIMEOUT.

Steps to reproduce

Reproduce

  1. devsy provider set aws -o INACTIVITY_TIMEOUT=10m
  2. devsy up . --provider aws
  3. On the host: systemctl show devsy -p ExecStart -p NRestarts — no --agent-dir, restarts climbing.
  4. ls <agentHome>/contexts/*/workspaces/*/workspace.json — no match; the file is under agent/.

devcontainer.json

Error output / logs

How often does this happen?

Every time

Operating system

Linux

Linux distribution (if applicable)

No response

Architecture

ARM64

Desktop app or CLI?

Both

Devsy version

v1.18.0

Devsy provider

AWS

Provider version

v1.4.33

Screenshots

No response

Anything else?

No response

Activity

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