Repository navigation
fix(spored): act on a short task's completion before the on-complete tag was visible (#270) - #1195
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…complete is known (#270) A short task could write its completion file before spawn:on-complete was visible (EC2 tag eventual consistency); spored only re-read tags on tick 1 and every 5th tick, so on_complete waited up to 5 minutes or fell back to the TTL. A completion signal with no known on-complete now triggers a tag refresh on that tick (default path checked when completion-file is also invisible), capped at 5 such refreshes. Fixes #270
scttfrdmn
force-pushed
the
fix/270-short-task-completion
branch
from
October 19, 2026 21:53
ed581c6 to
8cf367e
Compare
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.
Summary
spored learns
on-completefrom EC2 tags. Tags are eventually consistent, and spored re-read them only on tick 1 and then every 5th tick. A short task that wrote/tmp/SPAWN_COMPLETEbeforespawn:on-completewas readable was ignored until the next scheduled refresh. If the tick-1 refresh had already happened, the instance ran on toward its TTL.This implements fix direction 1 in signal-driven form, rather than refreshing every tick on every instance:
checkAndAct, on a tick with no scheduled refresh,refreshForEarlyCompletionchecks for the completion file when no on-complete action is known. It looks at the configured path or, when the completion-file tag is invisible too,provider.DefaultCompletionFile(new constant, now also used byprovider/ec2.go). If the file exists, it re-reads the tags right away, so step 1 acts on the same tick.maxEarlyCompletionRefreshes). A workload that writes the file with no on-complete configured falls back to the normal cadence instead of costing one DescribeTags call a minute forever.refreshConfigFromTags, which behaves the same as before.Known limit: a custom
--completion-filewhose tag is also not yet visible is still only picked up at the next scheduled refresh. spored cannot know that path without the tag.Gates (counted ticks and refreshes, no wall clock; each watched failing against a revert that compiles)
TestCompletionBeforeOnCompleteTagIsVisibleStillActsNextTick: the fake provider hides on-complete from refresh Feature request: --tag / --tags flag for custom EC2 instance tags #1 and shows it from feat: Discord chat integration (alongside Slack and Teams) #2 on. Tick 1 does nothing; the file is written; tick 2 (not a scheduled refresh tick) must terminate, with exactly 2 refreshes. Revert (call replaced with_ = refreshed): FAIL. Revert (default-path fallback disabled): FAIL.TestEarlyCompletionRefreshesAreCapped: 20 ticks with the file present and the tag never visible must give exactly 5 scheduled + 5 early = 10 refreshes. Revert (cap removed): FAIL, with 20.TestNoCompletionSignalKeepsTheRefreshCadence: no file means no extra refreshes.Checks
make check: everything passes exceptcheck-build-tags, which fails identically on unmodified main on this machine (/private/tmp paths).semgrep --config=auto --error: clean.make check-docs: clean.pkg/provider is not in the api-snapshot set. Not validated on a real instance.
Fixes #270