Repository navigation
test: pin that a stop mid-upload finishes the task result post - #28
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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=3sunit 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 undertaskShutdownGrace(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-serverfix/agent-update-reconcile.Change
TestTaskWorkerShutdownFinishesResultUploadInFlightpins 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.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 vetclean.