From 4548471dba07820272772fa1871570d7add5c782 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Tue, 6 Oct 2026 17:03:50 +0200 Subject: [PATCH] fix(up): apply the plan deadline regardless of --wait The previous commit gated the deadline on options.Start.Wait && WaitTimeout > 0, describing it as matching start()'s own gating -- it doesn't. start()'s InDependencyOrder passes options.WaitTimeout into every startService call unconditionally, not only when options.Wait is set, and the CLI never requires --wait alongside --wait-timeout (`up -d --wait-timeout 30` with no --wait is accepted as-is). Under the previous gating, that exact combination would still hang on a stuck OpWaitCondition node -- the same bug the deadline was just added to fix, reintroduced for one flag combination. Drop the options.Start.Wait condition: the deadline now applies whenever WaitTimeout > 0, matching start()'s actual unconditional behavior. Signed-off-by: Nicolas De Loof --- pkg/compose/up.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pkg/compose/up.go b/pkg/compose/up.go index 0062c7823..9e46b9eeb 100644 --- a/pkg/compose/up.go +++ b/pkg/compose/up.go @@ -82,21 +82,23 @@ func (s *composeService) upDetached(ctx context.Context, project *types.Project, // The plan's own OpWaitCondition nodes (service_healthy / // service_completed_successfully dependency waits) block on ctx with no // timeout of their own -- unlike start()'s per-dependency - // waitDependencies call, which already threaded WaitTimeout through - // every wait, not just the final one below. Establish the deadline - // before executing the plan, not after, or a condition that's never - // satisfied hangs the whole command instead of failing after - // WaitTimeout. preparePlan above is deliberately left out of it: image - // pulls and the rest of create()'s own work were never bounded by - // --wait-timeout either, in the old create()+start() sequence. - if options.Start.Wait && options.Start.WaitTimeout > 0 { + // waitDependencies call, which already threads WaitTimeout through every + // wait unconditionally (InDependencyOrder passes it to startService + // regardless of options.Wait -- --wait-timeout alone, with no --wait, is + // a legal CLI combination nothing rejects). Establish the same + // unconditional deadline before executing the plan, not after, or a + // condition that's never satisfied hangs the whole command instead of + // failing after WaitTimeout. preparePlan above is deliberately left out + // of it: image pulls and the rest of create()'s own work were never + // bounded by --wait-timeout either, in the old create()+start() sequence. + if options.Start.WaitTimeout > 0 { withTimeout, cancel := context.WithTimeout(ctx, options.Start.WaitTimeout) defer cancel() ctx = withTimeout } if err := s.executePlan(ctx, project, observed, plan); err != nil { - if options.Start.Wait && errors.Is(ctx.Err(), context.DeadlineExceeded) { + if options.Start.WaitTimeout > 0 && errors.Is(ctx.Err(), context.DeadlineExceeded) { return fmt.Errorf("application not healthy after %s", options.Start.WaitTimeout) } return err