Fix wait command to always check replica count - #106
Merged
Conversation
firecow
force-pushed
the
fix/wait-cmd-replica-check
branch
from
January 31, 2026 17:55
e6a7d88 to
efc81b0
Compare
Previously, the wait command had two issues: 1. It would trust UpdateStatus.State when present without verifying that all replicas were actually running. 2. The desired-state:running filter excluded tasks being scheduled (which have DesiredState:"ready"), causing the command to see 0 tasks and incorrectly exit with success. Now we: - Remove the desired-state filter to see all tasks - Compare running task count against the service's configured replica count (Spec.Mode.Replicated.Replicas) This matches the behavior of docker-stack-wait.
firecow
force-pushed
the
fix/wait-cmd-replica-check
branch
from
January 31, 2026 18:38
efc81b0 to
6f51cf4
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes critical bugs in the Docker stack wait command that could cause premature success when services weren't ready. The fix ensures accurate service readiness detection by properly checking replica counts and task states.
Changes:
- Removed the
desired-state: ["running"]filter from task listing to capture all task states - Changed logic to always verify running task count matches the configured replica count before considering a service ready
- Reordered checks to prioritize replica count verification over UpdateStatus state
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Instead of checking for states that are NOT completed, explicitly check for known in-progress states (updating, paused, rollback_started, rollback_paused). This makes the code clearer about which states it's looking for.
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
Fixes two bugs in the wait command that could cause it to exit successfully when services weren't actually ready:
Trusted UpdateStatus.State without verification - When
UpdateStatus.Statewas "completed", the command assumed all replicas were running without checking.Task filter excluded starting tasks - The
desired-state: ["running"]filter excluded tasks being scheduled (which haveDesiredState: "ready"), causing the command to see 0 tasks and exit with success.Changes
desired-statefilter fromlistTasksto see all tasksSpec.Mode.Replicated.Replicas)Test plan