Skip to content

Handle graceful termination in microvm ateom - #893

Merged
Benjamin Elder (BenTheElder) merged 1 commit into
agent-substrate:mainfrom
sfunkenhauser:ateom_gt_mvm
Aug 17, 2026
Merged

Handle graceful termination in microvm ateom#893
Benjamin Elder (BenTheElder) merged 1 commit into
agent-substrate:mainfrom
sfunkenhauser:ateom_gt_mvm

Conversation

@sfunkenhauser

Copy link
Copy Markdown
Collaborator

Part of #23

Trap SIGTERM in the ateom, and forward SIGTERM to all application containers.
Once all application containers exit, ateom will exit itself.

@sfunkenhauser
sfunkenhauser force-pushed the ateom_gt_mvm branch 3 times, most recently from a584eb0 to d674bb8 Compare August 12, 2026 20:21
@sfunkenhauser
sfunkenhauser marked this pull request as ready for review August 12, 2026 20:41
@sfunkenhauser

Copy link
Copy Markdown
Collaborator Author

Benjamin Elder (@BenTheElder) PTAL

I've patched the e2e test fixes from #904 just to get a passing run, but will submit and rebase once that lands.

@BenTheElder

Copy link
Copy Markdown
Collaborator

that's in, taking a look at the other commit

Comment thread cmd/ateom-microvm/shutdown.go Outdated
@sfunkenhauser

Copy link
Copy Markdown
Collaborator Author

Benjamin Elder (@BenTheElder) PTAL

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.

generally LGTM, will need a rebase

Comment thread cmd/ateom-microvm/run.go
@sfunkenhauser

Copy link
Copy Markdown
Collaborator Author

Benjamin Elder (@BenTheElder) PTAL

@BenTheElder
Benjamin Elder (BenTheElder) merged commit ea29390 into agent-substrate:main Aug 17, 2026
11 checks passed
Benjamin Elder (BenTheElder) added a commit to BenTheElder/substrate that referenced this pull request Aug 17, 2026
…ASHED

The test deletes the worker pod, sleeps a fixed 2s, then suspends the actor,
which is meant to land while the graceful shutdown is under way. On micro-VM it
lands after the actor has already reached CRASHED, so the suspend is rejected
and the test fails on every run since agent-substrate#893 enabled it there - on main as well as
on unrelated PRs:

  termination_test.go: failed to suspend Actor: rpc error:
  code = FailedPrecondition desc = MarkSuspending prerequisite not met for
  Actor: demo/graceful-term-suspend-... (got: STATUS_CRASHED, want
  STATUS_RUNNING or STATUS_PAUSED)

A duration is the wrong thing to wait on: how quickly the drain starts, and how
long the actor survives it, differ by sandbox class. Wait for the state the test
actually depends on instead - the control plane marking the worker DRAINING when
it sees the pod's DeletionTimestamp - and suspend as soon as that is observable
rather than 2s later.

Measured against a kind cluster running this branch's main, micro-VM demo:

  before   0/3 pass, every failure the MarkSuspending rejection above
  after   14/15 pass; the one failure was elsewhere in the test (a resume
          readyz timeout, the pre-existing flake) and never the suspend

The three termination tests also pass together, twice, with no skips.

This keeps what the test is for. ateom's graceful shutdown deliberately releases
its lock so 'a suspend arriving mid-drain' is still served, and that is what is
being exercised; only the way the test finds that window changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants