Skip to content

Detect worker restarts by an epoch the worker process registers - #2988

Merged
Julian Gutierrez Oschmann (juli4n) merged 1 commit into
agent-substrate:mainfrom
sfunkenhauser:worker-restart-epoch
Oct 22, 2026
Merged

Julian Gutierrez Oschmann (juli4n) merged 1 commit into
agent-substrate:mainfrom
sfunkenhauser:worker-restart-epoch

Conversation

@sfunkenhauser

@sfunkenhauser Scott Funkenhauser (sfunkenhauser) commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Restart detection relied on the worker container's restartCount, which can restart from zero or stay the same. It was also recorded at bind time, so a resume whose Restore reached the restarted process was later crashed as if its sandbox had been lost.

Each worker process now acquires an epoch from ateapi and activates it with RegisterWorker, once, along with its pod IPs and capacity. Sandbox runtimes move to SetWorkerSandboxRuntimes. Run and Restore return the worker's epoch, and finalizeRunning records it, or returns Unavailable. A worker refuses workloads with Unavailable until it registers, and atelet passes a worker's Unavailable on, so the resume is retried rather than the actor crashed. The reconciler crashes actors recorded below the active epoch, and leaves RESUMING actors and claims never committed to an actor alone. A worker reports ready only once registered. Worker.ips moves to status.ips and follows a recreated pod sandbox.

Not handled yet: a worker that crashes before registering leaves its lost actors RUNNING.

Fixes #2692
Fixes #1837

AI use: AI-assisted, I reviewed and tested it.

  • Tests pass
  • Docs updated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first pass is an agent-bug hunt and an overview on my part, I think this high level design makes sense, attaching findings.

also I think we have credible options to close the remaining gaps.

need to put more time on the APIs, poked Julian Gutierrez Oschmann (@juli4n) Tim Hockin (@thockin)

Comment thread cmd/atelet/main.go Resolved
@sfunkenhauser
Scott Funkenhauser (sfunkenhauser) force-pushed the worker-restart-epoch branch 2 times, most recently from ced4928 to 1587d9f Compare October 21, 2026 15:59

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rebase

Restart detection relied on the worker container's restartCount, which
can restart from zero or stay the same. It was also recorded at bind
time, so a resume whose Restore reached the restarted process was later
crashed as if its sandbox had been lost.

Each worker process now acquires an epoch from ateapi and activates it
with RegisterWorker, once, along with its pod IPs and capacity. Sandbox
runtimes move to SetWorkerSandboxRuntimes. Run and Restore return the
worker's epoch, and finalizeRunning records it, or returns Unavailable.
A worker refuses workloads with Unavailable until it registers, and
atelet passes a worker's Unavailable on, so the resume is retried
rather than the actor crashed. The reconciler crashes actors recorded
below the active epoch, and leaves RESUMING actors and claims never
committed to an actor alone. A worker reports ready only once
registered. Worker.ips moves to status.ips and follows a recreated pod
sandbox.

Not handled yet: a worker that crashes before registering leaves its
lost actors RUNNING.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

3 participants