Repository navigation
Conversation
This was referenced Oct 15, 2026
Contributor
Author
|
Heads-up: this adds a new spored notification event, |
scttfrdmn
added a commit
that referenced
this pull request
Oct 16, 2026
) TestSporedNotifyEventsHandledBySporeBot parses every non-test Go file of the root module, finds each Notifier.Notify call and resolves its event argument (string literals, consts, locals assigned in the function such as idle_stopped/idle_hibernated, and struct fields such as #1005's stopAttempt.failEvent). It fails on an event missing from spore-bot's list, on an argument it cannot resolve, on a Notify method value, on a second Notify method, and on empty discovery. spore-bot's list is vendored at testdata/spore-bot/spored_events.txt so the unit test is offline; TestSporeBotEventsVendoredCopyIsCurrent runs in CI with SPORE_BOT_EVENTS_SYNC=1, fetches spore-host main and fails on drift. (#1004)
scttfrdmn
added a commit
that referenced
this pull request
Oct 16, 2026
) TestSporedNotifyEventsHandledBySporeBot parses every non-test Go file of the root module, finds each Notifier.Notify call and resolves its event argument (string literals, consts, locals assigned in the function such as idle_stopped/idle_hibernated, and struct fields such as #1005's stopAttempt.failEvent). It fails on an event missing from spore-bot's list, on an argument it cannot resolve, on a Notify method value, on a second Notify method, and on empty discovery. spore-bot's list is vendored at testdata/spore-bot/spored_events.txt so the unit test is offline; TestSporeBotEventsVendoredCopyIsCurrent runs in CI with SPORE_BOT_EVENTS_SYNC=1, fetches spore-host main and fails on drift. (#1004)
scttfrdmn
added a commit
that referenced
this pull request
Oct 16, 2026
) (#1011) * Gate that every spored notification event is handled by spore-bot (#1004) TestSporedNotifyEventsHandledBySporeBot parses every non-test Go file of the root module, finds each Notifier.Notify call and resolves its event argument (string literals, consts, locals assigned in the function such as idle_stopped/idle_hibernated, and struct fields such as #1005's stopAttempt.failEvent). It fails on an event missing from spore-bot's list, on an argument it cannot resolve, on a Notify method value, on a second Notify method, and on empty discovery. spore-bot's list is vendored at testdata/spore-bot/spored_events.txt so the unit test is offline; TestSporeBotEventsVendoredCopyIsCurrent runs in CI with SPORE_BOT_EVENTS_SYNC=1, fetches spore-host main and fails on drift. (#1004) * Run the spore-bot event gate under the hermetic wrapper; put the network sync check behind -tags=spore_bot_sync (#1004) * Re-vendor spore-bot's event list (completion_stop_failed, spot_replacement_retired) (#1004)
scttfrdmn
force-pushed
the
fix/954
branch
2 times, most recently
from
October 17, 2026 01:57
8fdcffe to
77d3562
Compare
…the idle stop's backoff (#978) checkCompletion runs whenever the completion file exists, and the file stays on disk after a stop or hibernate that EC2 refused. So every one-minute tick sent another `completion` notification, POSTed the completion webhook again, copied the command log to the console again, slept the grace period again (holding up the TTL and cost-limit checks) and tried the stop again. - The announcement (log, console copy of a failed job's log, `completion` notification, webhook, user warning, grace period) moves into announceCompletion and runs once per spored. - #948's idle backoff becomes a shared mechanism: stopRetry (failures, retryAt) and stopWithBackoff, which runs a stop/hibernate closure, records a failure with the 5/10/20/40-minute-then-hourly delay, and sends the trigger's failure notification on the first failure only. The closure keeps each a.stop/a.hibernate call, and its taskproto.Exit* token, at the call site. - One stopRetry per agent, shared by both triggers: whether EC2 will stop the instance does not depend on why spored asked, so a refused on-complete stop also holds off the idle stop and the failure is reported once. - While backing off, checkCompletion returns false so the TTL and cost-limit checks run; they are the backstop for an instance that cannot be stopped. - A failed on-complete stop sends `completion_stop_failed` once. - on-complete terminate is unchanged: retried every tick. (#978)
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Fixes #978. Stacked on #986 (fix/954) → #977 → #969 → #960 → #955 → #936. The base is
fix/954, so the diff shows only #978.What was wrong
checkCompletionruns whenever the completion file exists. After--on-complete stoporhibernatefails (a one-time Spot instance, a role withoutec2:StopInstances), the file is still there, so every one-minute tick repeated all of it:completionnotification and another POST to the completion webhook, which a caller can treat as "done" each time;What changed (
pkg/agent/agent.go)completionnotification, the webhook, the user warning and the grace period move intoannounceCompletion, behindcompletionAnnounced.stopRetryholds the failure count andretryAt.stopWithBackoffruns a stop/hibernate closure, sets the 5/10/20/40-minute-then-hourly delay (stopRetryDelay, renamed fromidleActionRetryDelay), and sends the trigger's failure notification on the first failure only.idleTimeoutReachedandcheckCompletionboth use it. Because the closure keeps eacha.stop/a.hibernatecall at its call site,TestEveryLifecycleExitPathCarriesAReasonTokenstill sees eachtaskproto.Exit*token.checkCompletionreturns false, so the TTL and cost-limit checks still run. They are the backstop for an instance that cannot be stopped.completion_stop_failedonce.--on-complete terminateis unchanged and still retries every tick, as the issue scopes.Tests (
pkg/agent/completion_stop_retry_test.go)TestFailedCompletionStopIsAnnouncedOnceAndBacksOff(stop and hibernate): over 5 ticks there is 1completionnotification, 1 webhook POST, 1 grace sleep (timed against a 300 ms grace period), 1 attempt and 1completion_stop_failed. When the backoff runs out it retries without announcing again.TestTTLStillEnforcedWhileCompletionStopBacksOff: throughcheckAndAct, an expired TTL terminates while the on-complete stop is backing off.TestIdleStopSharesTheCompletionStopBackoff: an idle stop inside the on-complete backoff makes no call, and only one failure notification is sent.TestSuccessfulCompletionStop.Revert checks. Each revert compiled, and the test ran and failed:
FailedCompletionStopIsAnnouncedOnceAndBacksOff(both subtests: 5 notifications, 5 webhooks, 1.5 s of grace sleep, 5 attempts),TTLStillEnforcedWhileCompletionStopBacksOffIdleStopSharesTheCompletionStopBackoff(2 calls, 2 failure notifications)Checks
make check: green except the known Docker-onlyTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker.make check-nested: all 9 nested modules clean.go test -race ./pkg/agent: ok.Caveat
After a successful on-complete hibernate and a resume, the completion file is still on disk, so the next tick hibernates again. That was already the case before this PR, and the announcement is no longer repeated. It belongs to the resume fix (#987, stacked on this one).