Fix workflow being skipped and marked as failed when agent starts before server#6361
Merged
Merged
Conversation
3 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6361 +/- ##
==========================================
- Coverage 34.20% 34.19% -0.01%
==========================================
Files 426 426
Lines 28537 28541 +4
==========================================
Hits 9760 9760
- Misses 17889 17893 +4
Partials 888 888 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
xoxys
approved these changes
Mar 31, 2026
This was referenced Mar 31, 2026
Merged
Merged
Member
Author
|
one of the bugs was actually a regression of #6021 ... b.t.w. ... but with this refactoring we did more fixing and preventing :) |
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.
reported at #6355 (comment)
When the agent started before the server was available, it retried the connection as expected. However, once the server came up and a workflow was picked up, the pipeline would immediately fail without running any steps — the agent logs showed
workflow context donefiring instantly afterreceived execution.The root cause was a package-level
shutdownCtxshared across retry iterations. On each failed attempt,stopAgentFuncstamped it with a 5-second timeout — starting the clock immediately. By the time the agent successfully connected and received a workflow,workflowCtxwas derived from this already-expired context, so execution failed before Docker even started a container.The fix removes the global mutable shutdown context and the
stopAgentFuncindirection. Instead,runner.Run()no longer accepts ashutdownCtxparameter — it creates a fresh one locally only when needed for theDone()fallback call. The healthcheck server shutdown does the same. This makes the lifetime of each shutdown window explicit and local.