Skip to content

ax local: atenet-router stays unready after its container restarts #754

Done

Description

@rakyll

On the local cluster (ax local start, Kind), new workspaces stay in Preparing forever after Substrate's atenet-router container restarts once. Its Envoy sidecar is left in the DRAINING state, so the pod never becomes ready again and the atenet-router Service has no endpoints until someone restarts the pod. It has happened several times; this report is from one occurrence, and it is likely a Substrate bug that ax local hits often.

Symptoms

  • ax get workspaces shows new workspaces stuck in Preparing, and ax describe workspace shows no conditions. Tasks that need a fresh setup hang the same way.
  • ax-server keeps retrying setup with a new actor, and every push times out:
    workspace setup attempt failed, retrying with a fresh setup actor ... error: running workspace setup: pushing /runner/v1alpha1/setup to actor default/ax-ws-setup-...: context deadline exceeded (last error: Post "https://atenet-router.ate-system.svc.cluster.local:443/runner/v1alpha1/setup": context deadline exceeded (Client.Timeout exceeded while awaiting headers))
    
  • kubectl -n ate-system get pods shows atenet-router at 1/2 with 1 restart; envoy is the container that is not ready, and it has 0 restarts.
  • kubectl -n ate-system get endpoints atenet-router is empty.
  • The envoy readiness probe (GET :9901/ready) returns 503 with body DRAINING. /server_info reports state: DRAINING and /stats has server.state: 1. The new atenet-router container logs Router dataplane health check failed ... unexpected status code 503 every second, indefinitely.
  • Connections opened before the restart (e.g. a long-lived ax ssh stream) keep working, which hides the problem until something opens a new connection.

What happened (timeline, UTC)

  1. 09:16–09:20: the whole node stalled. The router's health checks against the ATE API, the Kubernetes API (https://10.96.0.1:443/version) and Envoy (localhost:9901/ready) all time out. Around the same time, postgres-0 (09:16:57) and ate-idp-server (09:20:39) in ate-system also exit and restart, and Postgres logs terminating connection due to administrator command (SQLSTATE 57P01).
  2. 09:20:36: the atenet-router container gets SIGTERM (Shutdown signal received; draining), most likely from kubelet after the /healthz liveness probe (timeout 1s, period 10s, 3 failures) failed during the stall.
  3. 09:20:49: during graceful shutdown it drains the dataplane (Draining dataplane window=15s → Dataplane drained → Drain-complete marker written path=/var/run/atenet/drain-complete → Shutdown complete, exit 0).
  4. kubelet restarts only the atenet-router container. envoy has no liveness probe, so it is never restarted and stays DRAINING (uptime 139093s, hot_restart_generation: 1). The new router container does not take Envoy out of drain, and nothing else recovers it.

So the trigger is a temporary stall (likely the host VM being starved or paused, e.g. the laptop sleeping), but the bug is that it never recovers: draining is meant for pod shutdown, yet it runs on every router container restart, and the restarted router never undoes it.

How to reproduce (hints, not yet verified)

  • Restart only the router container while Envoy keeps running, e.g. from the Kind node: docker exec ax-local-control-plane crictl ps --name atenet-router -q | xargs docker exec ax-local-control-plane crictl stop. Then watch kubectl -n ate-system get pod -l <router selector> -w and ax get workspaces after ax applying a new Workspace.
  • Or stall the node long enough for the /healthz liveness probe to fail: docker pause ax-local-control-plane, wait 2–3 minutes, docker unpause ax-local-control-plane. Sleeping the laptop with the cluster running is likely the most common real-world trigger.
  • Check with kubectl -n ate-system port-forward pod/<atenet-router pod> 9901 and curl localhost:9901/ready (expect DRAINING).

Workaround

kubectl -n ate-system rollout restart deploy/atenet-router. Workspaces stuck in Preparing recover on ax-server's next setup retry or have to be re-created.

Possible fixes

  • Substrate: don't drain Envoy on a router container restart (only on pod termination), or have the router call Envoy's /healthcheck/ok and clear the drain marker on startup; or give the envoy container a liveness probe that fails while it is DRAINING without a router shutdown in progress.
  • AX: have ax local status / ax local start detect an unready atenet-router and say how to fix it, and have workspace setup report the router's unreachability as a condition on the Workspace rather than leaving it silently in Preparing.

Environment

  • ax version dev+3ec184a (ax local start), Kind v0.33.0, Kubernetes v1.36.1, single node ax-local-control-plane, macOS arm64 host with a 4 CPU / 8 GB VM.
  • Substrate images ghcr.io/agent-substrate/substrate/atenet:v1.0.0 and envoy-dataplane:v1.0.0.

Activity

  1. rakyll commented on Nov 25, 2026

    @rakyll
    MemberAuthor

    Duplicate of #755.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions