Skip to content

test: pin that a stop mid-upload finishes the task result post - #28

Merged
lr00rl merged 1 commit into
integrationfrom
fix/update-detach-restart
Sep 5, 2026
Merged

lr00rl merged 1 commit into
integrationfrom
fix/update-detach-restart

Conversation

@lr00rl

@lr00rl lr00rl commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Why

The 2026-09-05 fleet upgrade left approvals reading as stuck. The hypothesis was that the update's restart kills the agent before it posts the task result. Reading the code and the live audit trail says otherwise: the server-rendered update script hands the restart to a transient systemd-run --on-active=3s unit after the script exits (so it survives the task's cgroup), the worker posts the result right after the script returns, and a stop that lands mid-upload waits for it under taskShutdownGrace (10 s, then 45 s of report grace). All 30 results in the rollout landed. The fault was on the control plane and is fixed in lattice-server fix/agent-update-reconcile.

Change

  • TestTaskWorkerShutdownFinishesResultUploadInFlight pins the contract the restart timer relies on: a generic (non-durable) task, the kind an agent update is, finishes; its result post is held while shutdown begins; shutdown returns once the upload completes and the server holds the one successful result, with nothing interrupted.
  • README documents the update sequence (result first, detached restart, confirmation from the new agent's first report).

No runtime change, so the version constant stays at 0.3.9-alpha.9 and no binary ships from this PR.

go test -race ./... green; go vet clean.

A server-managed update replaces the binary and hands the restart to a
transient systemd timer that fires 3 s after the script exits, so the agent
being replaced posts the task result while its own stop signal is on the way.
The worker already lets an in-flight upload finish under taskShutdownGrace;
this pins that contract with a generic (non-durable) task whose result post
is held while shutdown begins, and documents the update sequence in the
README. No runtime change, so the version constant stays at 0.3.9-alpha.9.
@lr00rl
lr00rl merged commit 6faf3d1 into integration Sep 5, 2026
1 check passed
@lr00rl
lr00rl deleted the fix/update-detach-restart branch September 5, 2026 11:10
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.

1 participant