Skip to content

ateworker: report ready only after sandbox runtimes are registered - #3414

Draft
shrutiyam-glitch wants to merge 2 commits into
agent-substrate:mainfrom
shrutiyam-glitch:issue-3276
Draft

shrutiyam-glitch wants to merge 2 commits into
agent-substrate:mainfrom
shrutiyam-glitch:issue-3276

Conversation

@shrutiyam-glitch

@shrutiyam-glitch shrutiyam-glitch commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #3276

register.Report stored the worker epoch immediately after RegisterWorker returned, before reconciler.sync read sandbox-runtimes.json and reported runtimes via SetWorkerSandboxRuntimes. When atelet could not write sandbox-runtimes.json (for example, when a SandboxConfig version failed to sync), /readyz still returned 200 OK, Kubernetes marked the Pod Ready, and ate-controller marked the Worker WORKER_STATE_ACTIVE even though scheduling.Registered treated the Worker as unregistered (SandboxClasses empty). During a Deployment rollout, the new replica counted as available before it had a usable runtime, allowing Kubernetes to terminate healthy old replicas.

Store the registered epoch inside the SetWorkerSandboxRuntimes wrapper in run after the RPC succeeds so Epoch.Registered and Epoch.Require stay unready until the control plane holds both the worker's capacity and its sandbox runtimes.

AI-assisted, I reviewed and tested it.

  • Tests pass
  • Docs updated

run stored the worker epoch as soon as RegisterWorker returned, before reconciler.sync read sandbox-runtimes.json and called SetWorkerSandboxRuntimes. When atelet had not written sandbox-runtimes.json yet or SetWorkerSandboxRuntimes failed, Epoch.Registered still returned nil, so /readyz served 200 OK and the Worker moved to WORKER_STATE_ACTIVE with no SandboxClasses recorded on the control plane.
Store the epoch in the SetWorkerSandboxRuntimes callback after the first report succeeds. Epoch.Registered and Epoch.Require then hold the pod unready and refuse workloads with Unavailable until the control plane holds both capacity and sandbox runtimes.

Signed-off-by: Shrutiya <shrutiyam@google.com>
Signed-off-by: Shrutiya <shrutiyam@google.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

1 participant