Skip to content

runner: reply to a push only when the pushed work is complete, and delete the pushes channel #741

Backlog

Description

@rakyll

Today

ax-server hands work to a runner in two steps.

  1. It POSTs a Task to /runner/v1alpha1/task, or a Workspace to /runner/v1alpha1/setup (pushToRunner in internal/controller/actorhttp.go). The handler in internal/metadata/server.go (handleTaskPush, handleSetupPush) puts the work on an internal channel, pushes, and replies 202 at once.
  2. runPushed in runner/runner.go receives the work from Pushes(), sets up the workspace and starts the task, and records the result with SetWorkspaceCheckReady or SetSetupFailed. ax-server learns the result by polling GET /readyz?check=workspace every 500 ms (waitWorkspaceReady): 503 while the work is pending, 200 once it is done, and 500 with the reason when it failed.

So the reply to a push says only that the work was queued. Its result travels through a second endpoint, and through extra state in the metadata server.

Proposal

A push should not return until the pushed work is complete: the workspace is set up and, for a task, its command has started. The reply is the result: 200 on success and 500 with the reason on failure, with 409 and 400 as they are today.

The metadata server then has no work to queue:

  • Delete the pushes channel, Pushes() and the Push type. The handler runs the work itself, through a function the runner gives the server, or the runner serves these two endpoints.
  • runPushed loses its receive loop.
  • ax-server stops polling /readyz?check=workspace after a push. waitWorkspaceReady can go, and so can workspaceCheckReady, setupFailure, SetWorkspaceCheckReady and SetSetupFailed in the metadata server, if nothing else needs them.

To decide

  • Timeouts. ax-server's HTTP client for these calls times out after 2 seconds (newProbeHTTPClient in internal/controller/task.go). Resume waits WorkspaceReadyTimeout, 15 seconds by default, and does not treat a runner that is still setting up as an error. Workspace setup can take minutes (git clones, setup.commands). A push that blocks needs a longer request timeout, and Resume needs a rule for a push that outlives its wait. Check also whether atenet-router limits how long a request may take.
  • Repeated pushes. ax-server retries a push until the runner answers, and pushes the task again on every resume. A push of work that is still in progress should wait for that work's result, not answer 200 at once.
  • The runner contract. docs/runner.md documents the 202 reply and the /readyz?check=workspace polling for custom runners, so it changes with this.
  • assignmentCh. The metadata server also holds a guest gRPC call for up to 10 seconds until a task is assigned. Check whether that is still needed once a resume returns only after the push is complete.

Related: #688 (the push protocol), #739 (its other follow-ups).

Activity

  1. added this to the v0.5.0 milestone on Nov 24, 2026
  2. ghchinoy commented on Nov 25, 2026

    @ghchinoy

    I checked go.ate.dev/[email protected] regarding the atenet-router timeout question under To decide:

    • Workload route timeout: cmd/atenet/internal/router/xds.go sets defaultRouteTimeout = 5 * time.Minute (configurable via --route-timeout, left at the 5m default in manifests/ate-install/atenet-router.yaml).
    • Stream idle timeout: envoyDefaultStreamIdleTimeout is also 5m, and routeIdleTimeout() automatically keeps it at max(5m, routeTimeout + 30s) so Envoy will not reset a quiet synchronous POST before --route-timeout fires.
    • Rollout/drain + retry caveat (drainRouteBudget = 10s, internal/metadata/server.go:356,385): As noted in manifests/ate-install/atenet-router.yaml:248-253, graceful shutdown drain deliberately does not scale with --route-timeout. If a router pod rolls out mid-git clone or setup.commands, the client POST fails after ~10s while the runner is still executing setup inside the sandbox. Today handleSetupPush / handleTaskPush return 200 OK immediately on a sameObject retry, which only works because ax-server polls /readyz?check=workspace next; once 200 OK means setup is complete, a sameObject retry needs to wait on the in-flight setup's completion result rather than returning 200 OK early (or 409).
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions