Commit graph

6274 commits

Author SHA1 Message Date
Nicolas De Loof
97943ec9fb fix(executor): record a dependency wait canceled by its phase as a failure
A node that leaves its dependency wait because its phase was canceled
closes its done channel (deferred) without recording any failure. In
X -> A -> B with X failing, B could select done[A] before it saw the
cancellation, find no failure recorded for A, emit its "Starting" event
and enter executeNode on a canceled context, leaving the row never
finalized.

Record the cancellation as the node's failure at that exit, so a
dependent that wins the race is skipped like any other dependent of a
failed node. The regression test pins GOMAXPROCS to 1, which makes the
bad interleaving the usual one.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
cdbfe54617 test(executor): bound the phase-cancellation test with its own deadline
Copilot review finding on #14300: if a sibling Create-phase failure ever
stopped canceling the other node, VolumeCreate's mock blocks on its ctx
while exec.run waits for it, so the test's own five-second guard could
never fire and the regression would hang until the suite-wide timeout.
Give run a deadline of its own and assert the cancellation is the
sibling's (context.Canceled), not that fallback.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
d713d6543c fix(reconcile): still visit a scale: 0 service in the start phase
Copilot review finding on #14296: planServiceStart returned before any
dependency planning for every service whose scale is zero. The imperative
startService only treats deploy.replicas: 0 as an unconditional no-op: a
service with scale: 0 still has its depends_on conditions evaluated first,
so an unhealthy or missing required dependency fails `up`/`start`, and
whatever is ordered after the service stays ordered after those
prerequisites. It is simply never an error for it to have no container to
start, and under scope Start the replicas it already owns are started
(CreateStart removes them all in the create phase).

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
23d3081f55 fix(up): report a depends_on wait timeout as a dependency timeout, with --wait too
Copilot review finding on #14296: a wait node's own timeout is a
depends_on condition that did not become satisfied during the plan, not
the final --wait readiness check, which runs after the plan and has its
own "application not healthy" translation. The imperative path reported
"timeout waiting for dependencies" for the former regardless of --wait,
but translateWaitTimeout rewrote it as "application not healthy" when
--wait was set. It now always reports the dependency timeout.

Also mark the test nodes that stand for the Start phase as PhaseStart
(the recreate-then-start plan and the wait whose timeout survives a
skipped dependent), so they exercise the Create->Start barrier the way
the reconciler's plans do instead of running everything in one phase.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
9a4983a34a fix(executor): mark a wait node's own timeout instead of guessing from DeadlineExceeded
up translated any DeadlineExceeded surfacing from the plan into "timeout
waiting for dependencies" or "application not healthy" whenever
--wait-timeout was set, even one coming from an engine call, a hook or
the secret injection, none of which is a dependency-readiness failure.

A wait node whose own --wait-timeout window expired now returns
errWaitTimeout (still satisfying DeadlineExceeded), and up keys its
message on that. A deadline inherited from the caller is never marked.

The test that checks --wait-timeout does not leak into non-wait nodes now
inspects the context those nodes receive, instead of a mock that would
have succeeded either way.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
ea8385e430 fix(up): list containers before opening the final --wait-timeout window
The final readiness check opened its --wait-timeout window before
re-listing the project's containers, so a slow daemon listing could
exhaust the budget and report "application not healthy" before
waitDependencies had polled once. List first on the caller's context,
then derive the timed one, as the imperative path did.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
c87307b89f fix(reconcile): keep each dependency's wait timeout independent
Reverts 365f0026f, a behavior-parity fix for a Copilot finding that the
plan-based start engine's per-(dependency,condition) wait node could
start its exec.waitTimeout clock earlier than the old imperative
engine's single waitDependencies(X) call -- which only begins once
EVERY direct dependency of X has itself finished starting, so a slow
sibling with no wait node of its own could silently extend another
dependency's effective grace period.

On reflection that old-engine coupling is itself the bug: a service's
declared --wait-timeout for a given dependency should bound how long
THAT dependency takes to satisfy its condition, period -- not be
inflated by how long an unrelated sibling dependency happens to take
to start. Letting db's health-check timeout silently grow because
migrate's own dependency chain is slow means --wait-timeout no longer
means what it says. Restoring the narrower, per-dependency gating is a
deliberate, accepted behavior change from the old engine, not a parity
regression to chase.

This also removes the dependency-cycle risk the sibling-widening
introduced (an ordinary diamond dependency, or a service whose own
chain end collapses onto a shared wait node, could merge a node back
into its own transitive dependents -- see 365f0026f's description) and
the wouldCreateCycle machinery and five regression tests that existed
solely to guard against it, now dead weight with no reachable scenario
to protect against.

Verified: go build, go test ./pkg/compose/..., and golangci-lint all
clean.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
4c82be2569 fix(reconcile): gate wait nodes on every sibling dependency, cycle-safe
Copilot flagged a behavior-parity regression on #14290's Create->Start
barrier: a service's OpWaitCondition node only depended on its own
dependency's chain end, so its exec.waitTimeout clock could start
ticking earlier than the old imperative engine's single
waitDependencies(X) call. That call only begins once EVERY direct
dependency of X has itself finished starting (confirmed by reading
InDependencyOrder's graphTraversal.run: a service's visitorFn only
runs once none of its dependency children are still ServiceStopped).
A slow sibling with no wait node of its own (service_started is a
plain edge, nothing to poll) could silently eat into a health check's
effective grace period compared to the old engine.

startPhaseDependencies now computes allTargets, the union of every
declared dependency's own chain-end for the requesting service, and
passes that into waitConditionNode instead of just the one dependency
being checked.

Because wait nodes are shared/deduplicated across consuming services
by (dep, condition) alone, this widening reopened a second, more
serious finding from the same review pass: two consumers of the same
shared node can have different sibling sets, and merging a sibling
that already (transitively) depends on the shared node -- an entirely
ordinary diamond dependency, or a service whose own chain end
collapses onto the wait node itself when it has nothing left to start
-- creates a dependency cycle. The executor has no cycle detection and
no timeout on the dependency-wait phase itself (exec.waitTimeout only
applies once a node starts executing), so this was a guaranteed
permanent hang, not a correctness nicety.

Fixed with wouldCreateCycle: a wait node's merge now skips any
candidate that already (transitively) depends on it. This is provably
safe, not a workaround -- if a candidate already depends on the wait
node, the wait node is necessarily already done by the time the
candidate's own chain completes, so there is nothing to gain from also
adding the reverse edge; the candidate's own direct dependency on the
shared node (or on an intermediate sibling) already encodes everything
the consumer's depends_on requires.

Five new regression tests in reconcile_start_test.go, all verified by
ablation (reverting the relevant guard reliably reproduces the
original bug, 3-5/5 runs depending on the test):
- TestPlanStart_WaitNodeGatedOnAllSiblingDependencies: the original
  parity fix (db:service_healthy + migrate:service_started siblings).
- TestPlanStart_DiamondDependencyNeverCreatesWaitCycle and
  TestPlanStart_ExceptionalChainCollapseNeverCreatesWaitCycle: the two
  concrete cycle shapes found in review.
- TestPlanStart_TransitiveChainNeverCreatesWaitCycle: exercises
  wouldCreateCycle's BFS two hops deep, not just a direct edge.
- assertNoCycle, a plan-wide helper used by the cycle tests above.

Verified: go build, go test ./pkg/compose/..., and golangci-lint all
clean; full e2e suite re-run clean against a locally built binary
(same 3 pre-existing, environment-specific failures as the stack's
baseline: TestWatch, TestIPC, TestComposeModel). Two rounds of local
Copilot CLI review: the first caught the cycle risk in the initial
allTargets widening, the second confirmed wouldCreateCycle's BFS is
correct and complete, the "skipping is safe" reasoning holds in every
case, and no other call site in reconcile.go has the same unguarded
sharing risk.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
bd088decbb fix(up): preserve the actionable dependency-timeout message without --wait
Copilot review finding (low) on #14290: with --wait-timeout supplied but
not --wait, a dependency timeout in upDetached returned the raw "context
deadline exceeded" instead of the actionable "timeout waiting for
dependencies" the legacy start()+waitDependencies path already reports
for the exact same failure. The --wait-specific "application not healthy
after %s" translation only ever covered the Wait=true case, leaving the
Wait=false, WaitTimeout>0 case (a legal CLI combination -- --wait-timeout
alone is a hang guard) with no translation at all.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
ebe25e3232 fix(executor): tell an optional wait's own timeout from an inherited deadline
Copilot review finding on #14290: waitDependency decided whether a
DeadlineExceeded on an optional dependency wait was safe to tolerate
using a bare boolean -- whether the caller had configured a timeout
for this wait at all (exec.waitTimeout > 0, or legacy waitDependencies'
timeout > 0). That can't distinguish THIS call's own timeout actually
firing from an earlier deadline inherited from the caller's own ctx
also firing: context.WithTimeout(parent, waitTimeout) still makes both
parent and child report DeadlineExceeded once the parent's earlier
deadline elapses, even though this wait's own timer never got there.
An unsatisfied optional wait could therefore swallow a real external
deadline (the process's own context, a test harness timeout) and
report success instead of propagating it.

Replaced the bool with an origCtx snapshot -- ctx as it stood right
before this call's own conditional context.WithTimeout wrap -- threaded
from executor.go's OpWaitCondition dispatch through execWaitCondition
down to waitDependency, and from waitDependencies' own wrap in
service_containers.go. waitDependency now checks origCtx.Err() == nil
at the moment ctx.Done() fires: only when the pre-wrap context hasn't
failed on its own is this wait's own timeout the one responsible.

TestExecutePlanOptionalWaitDoesNotSwallowInheritedDeadline pins the
negative case (inherited deadline must still propagate even though
exec.waitTimeout is set and the dependency is optional) and
TestExecutePlanOptionalWaitTimeoutIsToleratedWithoutInheritedDeadline
pins the positive one (this wait's own timeout, no inherited deadline,
still tolerated as before) -- both verified by ablation.

Verified: go build, go test ./pkg/compose/... (full suite, not just the
new tests) and golangci-lint clean. Local Copilot CLI review confirmed
the origCtx threading is correct and race-free across all three call
sites; its one actionable finding (missing positive-path coverage for
the plan-executor route specifically) is addressed by the second new
test above.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
19aa3d8604 fix(executor): make Create->Start a hard sequential barrier
run() used to dispatch every node concurrently, with Create-phase and
Start-phase cancellation scoped separately via phaseCancel so a
Start-phase failure couldn't cancel unrelated in-flight Create work.
That stopped short of what the interactive up convergence (lot 2's
next step) actually needs: its attach/printer session takes exclusive
hold of the terminal for the Create phase's own progress display, and
hands it over to continuous container log streaming only once the
Create phase is entirely done project-wide -- a Start-phase node's log
output interleaving with Create's progress bars has nowhere consistent
to go. Phase-scoped cancellation alone still let an unrelated
Start-phase node begin (and start logging) while a sibling elsewhere
in the plan was still being created, or had just failed.

run() now splits plan.Nodes into createNodes/startNodes upfront and
runs them as two fully sequential runPhase() calls: Start-phase nodes
are never even dispatched until every Create-phase node has succeeded,
and a Create-phase failure returns immediately without calling
runPhase on startNodes at all. This matches the old create()-then-
start() sequence's own fail-fast behavior, which the single-plan
migration had implicitly relaxed.

Added a fast-fail validation: a Create-phase node depending on a
Start-phase node would otherwise deadlock forever (the Start phase
isn't dispatched until the Create phase blocked on it returns, so
nothing would ever close that dependency's done channel). Nothing in
the reconciler should produce that edge, but failing fast with a clear
error beats a silent hang if it ever does.

TestExecutePlanCreatePhaseIsABarrierBeforeStartPhase and
TestExecutePlanCreatePhaseFailureNeverDispatchesStartPhase cover both
directions of the barrier; both verified by ablation (reverting to a
single concurrent runPhase call reliably fails each, 5/5 runs).

Verified: go build, go test ./pkg/compose/... (incl. -race), and
golangci-lint all clean; full e2e suite re-run clean against a locally
built binary (same 3 pre-existing, environment-specific failures as
the stack's baseline: TestWatch, TestIPC, TestComposeModel). Local
Copilot CLI review found no correctness/deadlock issues in the barrier
logic itself; its two actionable findings (missing phase-ordering
guard, missing never-dispatched regression test) are both addressed
here.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
7849a5091e fix(service_containers): don't swallow an inherited deadline as a wait timeout
Copilot review: waitDependency's optional-dependency tolerance (the
previous commit) treated ANY DeadlineExceeded on ctx as this call's own
timeout -- including one inherited from an ancestor context the caller
never gave this specific call a deadline of its own for. A plan whose
only outstanding work was an optional, never-satisfied wait could see
the API caller's own external deadline (a wrapper tool, a test
harness) expire, get silently converted to a Skipped event, and report
success despite the caller's context having actually timed out.

waitDependency gains a hasOwnDeadline bool: true only when the
specific call is responsible for ctx's deadline (waitDependencies
passes timeout > 0; execWaitCondition passes exec.waitTimeout > 0,
exactly the condition under which executor.go's dispatch wrapped ctx
with that same field). Only a DeadlineExceeded under hasOwnDeadline is
tolerated for an optional dependency; one without it still propagates,
regardless of Required.

TestWaitDependencyDeadline gains "an inherited parent deadline is not
swallowed for an optional dependency" (timeout=0, an already-expired
parent ctx) alongside the existing "own timeout is skipped" case --
verified by ablation that dropping hasOwnDeadline from the condition
makes the new test fail exactly as described.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
4e2526a7af fix(reconcile): include every exceptional-state restart node, not just the last
Copilot review, following up on 374079a32's own fix: serviceNodes keeps
only the LAST node processed during a service's create-phase
convergence -- correct for a single replica, but a scaled service can
have more than one exceptional-state (paused, dead) replica, each with
its own bare-restart OpStartContainer node. Using serviceNodes alone
in planServiceStart's len(replicas) == 0 branch meant a downstream
service_started consumer only ended up depending on the highest-
numbered replica's restart, not every one of them.

exceptionalStateRestartNodes collects every OpStartContainer node from
containerNodes[service] (which tracks all of them, unlike serviceNodes),
in deterministic replica-number order. planServiceStart now merges all
of them into startChainEnds alongside the dependency prerequisites.

TestPlanStart_ScaledExceptionalStateConsumerWaitsForEveryRestart pins
it: two exceptional-state replicas, asserting the consumer depends on
both restart nodes -- verified by ablation to depend on only the last
one without the fix.

Two more small, independent fixes from the same review round:
- execWaitCondition's doc comment (executor_ops.go) described the
  pre-waitTimeout "no deadline, caller wraps ctx" design; updated to
  describe planExecutor.waitTimeout's actual per-node window.
- waitDependency's new optional-dependency-timeout tolerance (the
  previous commit) gains its own direct regression test
  (TestWaitDependencyDeadline/expired deadline on an optional
  dependency is skipped, not an error) -- the existing tests covered a
  required timeout, user cancellation, and an optional dependency's
  definitive (non-timeout) failure, but not this specific path.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
382383d0c5 fix(executor): make phase cancellation race-free end to end
Three related findings from Copilot and docker-agent on the
phase-scoped cancellation commit, all stemming from the same root
cause: switching run() from errgroup.WithContext's own atomic
cancel-with-error-record to an explicit, separate cancelPhase() call
reopened timing windows that errgroup.WithContext used to close for
free.

- Copilot (high): cancelPhase() unblocks every sibling in that phase
  before this goroutine's own error reaches errgroup.Group's internal
  errOnce -- a sibling woken by the cancellation can return a bare
  context.Canceled of its own and win that race, hiding the actual
  daemon error or DeadlineExceeded (and making upDetached's own
  DeadlineExceeded translation unreliable with it).
- docker-agent (medium): the "is this my own genuine failure"
  nodeCtx.Err() == nil check and the cancellation it gates aren't
  atomic -- two genuinely concurrent same-phase failures can both pass
  it before either's cancelPhase() takes effect, both emitting a group
  Error event for the same resource.
- docker-agent (medium): the dependency-wait loop's early return on
  ctx cancellation skipped close(rs.done[node.ID]), the only exit path
  that did. Not reachable today (every dependent in the same phase
  shares that phase's ctx, already canceled by the time it would
  matter), but latent: nothing in runNode enforces that no future
  cross-phase dependency edge ever relies on this channel closing.

All three close around one new type, phaseCancel, bundling a phase's
context/cancel pair with a sync.Once: the first node in a phase to
fail records its error and emits the group event inside that Once,
cancels the phase's context, and every later caller -- genuine
concurrent failure or cancellation casualty alike -- is a silent
no-op. run() returns a phase's recorded error over whatever
eg.Wait() itself picked, so errgroup's own race can no longer surface
a cancellation casualty's error in its place. The done-channel close
moved to a single `defer` at the top of runNode, covering every exit
path uniformly instead of three separate explicit calls.

TestExecutePlanConcurrentPhaseFailureKeepsOriginatingError exercises
the first scenario under real concurrency (one immediately-failing
node alongside many siblings a dependency-wait unblocks via its
cancellation) -- see its own comment for why this specific race can't
be forced to fail by ablation in an in-process test (the Go scheduler
never actually lets a sibling win it here), so the fix's correctness
rests on reading errgroup's own errOnce.Do source directly, confirmed
independently by two reviewers, not on this test alone.

Verified: go test -race -count=10 ./pkg/compose/... clean; full e2e
suite re-run clean against a locally built binary (same 3
pre-existing, environment-specific failures as the stack's baseline).

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
8c1a3f93b1 fix(reconcile): a restarted service's consumer waits for the restart too
Copilot review ("previously missed"): the same either/or bug just
fixed for planProviderStart (e206f0566) also affects the ordinary
(non-provider) service branch of planServiceStart. A service whose
only container is in an exceptional state (paused, dead) gets a bare
create-phase restart (OpStartContainer, "not running") and takes the
len(replicas) == 0 path in the start-phase visit. When that service
also declares its own depends_on, startChainEnds used only the
dependency's wait node as ends, dropping the service's own restart
node entirely -- a downstream service_started consumer could then
start before the paused/dead service's only container was actually
running again.

ends now always includes the service's own create-phase node
(serviceNodes[service.Name]) alongside its dependency prerequisites
when it has any, instead of either/or -- the exact same fix shape as
planProviderStart.

TestPlanStart_ExceptionalStateConsumerWaitsForRestart pins it,
mirroring TestPlanStart_ProviderConsumerWaitsForDeployment: a
paused service with both an upstream dependency and a downstream
consumer, asserting the consumer's start node depends on the restart
node directly -- verified by ablation to fail, showing the exact
missing edge, without the fix.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
0fc3d8c1c6 fix(executor): scope plan cancellation to each node's own phase
Copilot review (High) on #14290: run() dispatched every node -- Create
and Start phase alike -- under one errgroup.WithContext(ctx), so any
node failing canceled the shared context for every other goroutine
still in flight. A required OpWaitCondition node hitting
--wait-timeout is a Start-phase failure that can now happen while
unrelated Create-phase work (a sibling service's container or network
create) is still legitimately running -- and that work got aborted
too, with nothing to do with the dependency that timed out. The old
create()-then-start() sequence never had this failure mode: the whole
create phase always finished completely before any dependency wait
even began.

run() now derives two contexts instead of one shared errgroup-context:
createCtx at the root, startCtx as its child. A node picks nodeCtx
(and the matching cancelPhase) from its own node.Phase and calls
cancelPhase() only on its own genuine failure. A Start-phase failure
cancels only startCtx, leaving createCtx and everything still running
under it untouched. A Create-phase failure still cancels the whole
plan, Start phase included, via startCtx's derivation from createCtx
-- matching the old sequence, where start() was never even invoked
once create() failed.

The node-goroutine body moved out of run()'s loop into a runNode
method (golangci-lint's cognitive-complexity limit after this change)
taking a new runState struct bundling the per-run bookkeeping every
node shares.

Two smaller, unrelated fixes bundled in:
- upDetached (up.go) keeps an origCtx snapshot so its two
  DeadlineExceeded-to-friendly-message checks can tell its own
  WaitTimeout window expiring apart from an inherited, unrelated
  parent deadline propagating through the derived context -- both
  report DeadlineExceeded on Err(), only the former earned the
  "application not healthy" framing.
- waitDependency (service_containers.go), shared by the old
  waitDependencies and the new execWaitCondition -- the latter can now
  produce a real deadline for the first time via exec.waitTimeout --
  tolerates a timeout on an optional (BestEffort) dependency the same
  way it already tolerates every other definitive failure: skipped
  with a warning, not a hard failure.

Two regression tests pin both cancellation directions:
TestExecutePlanStartPhaseFailureDoesNotCancelCreatePhase (a
Start-phase wait timing out must not cancel a concurrent, unrelated
Create-phase node) and TestExecutePlanCreatePhaseFailureCancelsCreatePhase
(a Create-phase failure must still fail-fast its Create-phase
siblings, same as before this change). Both verified by ablation.

Full e2e suite re-run clean against a locally built binary -- same 3
pre-existing, environment-specific failures as the stack's baseline,
no new ones.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
0f668c38f3 fix(up): don't blame --wait-timeout for an external ctx deadline
docker-agent review (moderate confidence): exec.run propagates any
context.DeadlineExceeded up, including one originating from ctx itself
(an outer caller's own deadline -- a test harness, a wrapper tool, a
client-side timeout) rather than from an OpWaitCondition node's own
derived timeout. The WaitTimeout > 0 guard alone doesn't distinguish
the two: a user who did configure --wait-timeout could still see
"application not healthy after Xs" when what actually happened was
the caller's own unrelated deadline firing during plan execution.

ctx at this point is still the caller-supplied, undecorated context
(the per-wait timeout is derived fresh inside executeNode, never
reassigned here) -- so ctx.Err() == nil confirms the DeadlineExceeded
didn't come from ctx's own deadline, leaving only an OpWaitCondition
node's derived timeout as the source.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
c1c897fbbb fix(up): give each wait its own fresh --wait-timeout window
Copilot review ("previously missed", code unchanged since an earlier
round): the prior fix (applyRemainingDeadline) replaced a confusing
raw DeadlineExceeded with a clearer message, but kept the underlying
design flaw it was reacting to -- a single absolute deadline
(time.Now().Add(WaitTimeout)) shared across the whole plan and the
final verification. Slow, unrelated create/start/hook work (never
meant to be bounded by --wait-timeout -- that's the entire point of
exec.waitDeadline existing) could still exhaust that shared budget on
its own, failing an otherwise healthy deployment as "not healthy" with
no health wait ever actually timing out.

start()'s real behavior never had this failure mode: waitDependencies
opens a fresh context.WithTimeout(ctx, timeout) every time it's
called, so each dependency wait gets its own full WaitTimeout window,
independent of how long anything before it took.

planExecutor.waitDeadline (an absolute time.Time) becomes waitTimeout
(a time.Duration): executeNode's OpWaitCondition case now derives a
fresh context.WithTimeout per wait node instead of a shared
context.WithDeadline. upDetached mirrors this for the final
verification -- its own fresh WaitTimeout window, not whatever's left
of one. applyRemainingDeadline's already-expired-deadline problem
disappears by construction: there's no longer a precomputed deadline
to have already expired.

Also fixes two sibling DeadlineExceeded-translation sites (the
post-plan container listing and waitDependencies' own check) that were
missing the WaitTimeout > 0 guard: without a --wait-timeout set, ctx
can still carry an external deadline (an upstream command timeout, a
cancellation) unrelated to --wait-timeout, and naming "application not
healthy after 0s" would blame a duration nobody configured.

TestExecutePlanWaitDeadlineOnlyBoundsWaitNodes and
TestExecutePlanWaitConditionRespectsContextDeadline updated for the
field rename; both still pin their original scenarios under the new
mechanism. Verified against the full e2e suite (TestUpWaitTimeout,
TestUpWait, TestRestartWithDependencies, the provider suite) on a
locally built binary.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
c44b656dc1 fix(reconcile): a provider's consumer waits for its deployment too
Copilot review: planProviderStart used a provider's own depends_on
wait nodes as its startChainEnds whenever it had any, entirely
dropping its own OpRunProvider (deployment) node from that set. A
downstream consumer of the provider -- ordered after startChainEnds
-- would then only wait for the provider's dependency to become
healthy, not for the provider plugin/relay deployment itself to
finish. The old create-then-start two-phase barrier guaranteed that
ordering for free; ScopeCreateStart (inert until this PR actually
exercised it end to end) didn't reproduce it.

ends now always includes the provider's own node alongside its
dependency prerequisites when it has any, instead of either/or.

TestPlanStart_ProviderConsumerWaitsForDeployment pins it: a provider
with both an upstream dependency and a downstream consumer, asserting
the consumer's start node depends on the provider's OpRunProvider node
directly -- verified by ablation to fail (showing the exact missing
edge) without the fix.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
f067cc9a70 fix(up): don't derive an already-expired context for the final wait check
docker-agent review (strong confidence): exec.run only bounds
OpWaitCondition nodes with the wait deadline, not create/start/hook
ops (see the previous commit) -- a plan whose non-wait work alone
takes longer than --wait-timeout can still return nil past the
deadline. context.WithDeadline on an already-past deadline silently
produces an immediately-canceled context, failing the next daemon call
(getContainers) with a bare context.DeadlineExceeded indistinguishable
from "health never came up" -- misleading, since health was never
actually checked.

Extracted the deadline-wrapping into applyRemainingDeadline, which
checks the remaining budget first and fails immediately with a message
that says what actually happened, instead of letting a confusing
daemon-call failure stand in for it. Pinned by three unit tests
(zero deadline is a no-op, a future deadline wraps ctx normally, a
past deadline fails immediately with the expected message) -- the
past-deadline case verified by ablation to reproduce a false "nil
error" without the check.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
e7463d69a9 fix(up): don't claim "application not healthy" without --wait
docker-agent review: the deadline set before executePlan is
unconditional (whenever WaitTimeout > 0, matching start()'s own
WaitTimeout threading, regardless of Wait), but the "application not
healthy" message is specifically a --wait message. `up -d
--wait-timeout=30` with no --wait, hitting the deadline during an
OpWaitCondition node, showed that message despite the user never
asking for a health check -- just a hang guard.

Gate the message on options.Start.Wait at this one call site. The two
other DeadlineExceeded-translating sites (the post-plan container
listing and the final waitDependencies check) are unaffected: both
already sit after the `if !options.Start.Wait { return nil }` early
return, so they're structurally unreachable without Wait already
being true.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
7fb78f42b2 fix(up): scope the wait deadline to OpWaitCondition nodes only
Copilot review (Medium): wrapping the whole run() ctx with
WaitTimeout also capped Create-phase and Start-phase work that was
never subject to --wait-timeout in the old create()+start() sequence
-- a slow image pull or container create/recreate could now fail as
"application not healthy" with no health wait involved.

planExecutor gains a waitDeadline field, consulted only in
executeNode's OpWaitCondition case to derive a deadline-bound context
for that one call; every other operation type keeps running on the
plan's plain ctx. upDetached now builds its own planExecutor directly
(instead of going through executePlan) so it can set waitDeadline
before calling run(), and reuses the same deadline for the final
post-plan verification instead of wrapping the whole plan's ctx.

TestExecutePlanWaitDeadlineOnlyBoundsWaitNodes pins this: a plan
pairing a never-satisfied OpWaitCondition with an OpCreateNetwork
confirms the network create isn't raced by the same short deadline.
Verified by ablation that removing the OpWaitCondition dispatch's
deadline derivation makes the test hang instead of failing promptly.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
139172698a fix(up): translate a deadline hit during the post-plan container listing
docker-agent review: moving the WaitTimeout deadline to wrap ctx before
executePlan closed the in-plan hang, but opened a narrow new one --
executePlan can return nil right as the deadline fires, leaving the
subsequent getContainers call (for the final --wait verification) to
run against an already-expired ctx and propagate a raw
context.DeadlineExceeded instead of the existing friendly
"application not healthy after %s" message. Same translation the
executePlan and waitDependencies error paths already apply.

Also, a second docker-agent finding: execRenameContainer's
containersByService refresh silently no-ops if the container isn't
found at its expected slot (can't happen today -- the DAG guarantees
execCreateContainer's append runs first -- but nothing would surface
it if a future change broke that). Logs a warning instead of staying
silent, so a regression here is visible rather than just quietly
reintroducing the stale-name bug this PR fixed.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
4548471dba 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 <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
d8f2273ca8 fix(up): apply --wait-timeout before executing the plan, not after
Copilot review (High): the plan's own OpWaitCondition nodes
(service_healthy / service_completed_successfully dependency waits,
executed as part of executePlan) have no timeout of their own -- they
block on whatever ctx they're given, unlike the imperative engine's
waitDependencies, which already threaded WaitTimeout through every
per-dependency wait, not just the final --wait check. upDetached only
wrapped ctx with WaitTimeout around that final check, established
after executePlan already returned -- so a condition that's never
satisfied hung `up -d --wait --wait-timeout N` forever instead of
failing after N seconds.

Move the deadline to wrap ctx before executePlan runs (gated on
Wait && WaitTimeout > 0, matching start()'s own gating), and reuse the
same ctx for the final verification instead of opening a second,
independent WaitTimeout window -- one overall budget for "becoming
healthy" covering both the plan's in-flight waits and the final check.
preparePlan is deliberately left outside the deadline: image pulls and
the rest of create()'s own work were never bounded by --wait-timeout
in the old create()+start() sequence either.

Regression-tested at two levels:
- TestExecutePlanWaitConditionRespectsContextDeadline drives a real
  OpWaitCondition node through executePlan/run() under a short
  deadline and asserts it returns promptly with ctx.Err(), proving the
  deadline propagates into the plan's blocking nodes.
- The existing e2e TestUpWaitTimeout (up --wait --wait-timeout on a
  service that never turns healthy) is what actually exercises
  upDetached's own wiring: verified by ablation that reverting this
  fix makes it hang (test timeout) instead of failing after 3s.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Nicolas De Loof
4e9477da30 feat: detached up runs on a single plan
Detached `up` used to run create() then start() back to back: two
separate daemon snapshots, the second blind to what the first just
created or recreated. preparePlan already supports planning both
phases in one pass (ScopeCreateStart, landed across lot 1) -- this
wires it in for the one caller that can use it outright: `up -d`.

preparePlan gains an explicit scope parameter (ScopeCreate for
create(), unchanged); Up()'s detached branch now calls a new
upDetached, which runs preparePlan(..., ScopeCreateStart) +
executePlan once instead of create() + start(). --wait stays a
post-plan verification: it re-lists containers after the plan runs
(the plan may have created or recreated some, so the pre-execution
snapshot can't be reused for this) and runs the same waitDependencies
check start() already does.

Interactive up is untouched: it still runs create() then start() with
its printer/monitor listener wired in between, converging onto the
plan engine separately (a riskier, later item of the same lot).

ScopeCreateStart landed in lot 1 as inert code with no real caller;
this is the first one, and it surfaced two latent bugs in the
container-recreate path that nothing had exercised end to end before:

- planRecreateContainer plans a container's recreation as Create
  (under a temporary "<shortID>_<name>" to avoid colliding with the
  old container still holding the final name) -> Stop -> Remove ->
  Rename(final name). The start phase's event naming and container-ID
  resolution (groupEventName, resolveContainerID) read the create
  node's published result by design (plannedReplica keeps every
  start-phase reference pointed at CreateNodeID, not the rename node),
  but execRenameContainer never updated that result after renaming --
  so a recreated container's Starting/Started events kept reporting
  the temporary name forever.
- execCreateContainer also publishes the new container into
  containersByService (the live view OpWaitCondition reads for
  depends_on health waits) under that same temporary name, with
  nothing refreshing it after rename either -- a dependent waiting on
  the recreated container's health reported Waiting/Healthy under the
  temporary name too.

Both fixed in execRenameContainer: it now updates the create node's
pctx result in place after a successful rename, and (via a new
Service field on the rename Operation) patches the matching
containersByService entry's name too. Each pinned by a regression
test, verified by reverting the fix locally and confirming the test
catches it.

Verified with the full e2e suite (`go test -tags e2e ./pkg/e2e/...`)
against a locally built binary -- including TestRestartWithDependencies,
which is what caught both bugs in the first place -- plus the existing
unit suite and lint.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 14:52:20 +02:00
Sebastiaan van Stijn
a015f8bebf go.mod: keep go patch version at lowest possible
Some checks are pending
ci / validate (lint) (push) Waiting to run
ci / validate (relay-lint) (push) Waiting to run
ci / validate (relay-test) (push) Waiting to run
ci / validate (validate-docs) (push) Waiting to run
ci / validate (validate-go-mod) (push) Waiting to run
ci / validate (validate-headers) (push) Waiting to run
ci / validate (validate-mocks) (push) Waiting to run
ci / binary (push) Waiting to run
ci / binary-finalize (push) Blocked by required conditions
ci / bin-image-test (push) Waiting to run
ci / relay-image-test (push) Waiting to run
ci / test (push) Waiting to run
ci / e2e (plugin, oldstable, graphdriver) (push) Waiting to run
ci / e2e (standalone, oldstable, graphdriver) (push) Waiting to run
ci / e2e (plugin, stable, containerd) (push) Waiting to run
ci / e2e (plugin, stable, graphdriver) (push) Waiting to run
ci / e2e (standalone, stable, containerd) (push) Waiting to run
ci / e2e (standalone, stable, graphdriver) (push) Waiting to run
ci / coverage (push) Blocked by required conditions
ci / ci-ok (push) Blocked by required conditions
ci / release (push) Blocked by required conditions
docs-upstream / docs-yaml (push) Waiting to run
docs-upstream / validate (push) Blocked by required conditions
merge / bin-image-prepare (push) Waiting to run
merge / bin-image (push) Blocked by required conditions
merge / relay-image (push) Waiting to run
merge / module-image (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
zizmor / zizmor (push) Waiting to run
commit 342f4de35f accidentally
bumped the minimum version in go.mod. Unfortunately, we can't
drop the patch version, but let's keep it at the lowest possible
for environments that don't have the latest Go version available.

Fixes: 342f4de ("Update to go1.26.9")

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-10-15 09:37:20 +02:00
Nicolas De Loof
4f6ed1f893 refactor(provider): move the provider plugin execution to internal/provider
Running a provider plugin (finding its binary, executing it, serving the
JSON messages it sends, applying the variables and endpoints it publishes,
streaming it an image) needs from the engine the Docker API, the event bus,
the Docker CLI that locates the plugin, the preparation of the environment
of a shelled-out command, and the lock that guards the project model every
concurrent provider run mutates.

It now lives in internal/provider behind a Backend interface that
composeService implements in pkg/compose/plugins.go, next to runPlugin, which
stays as a one-line forwarder so none of its callers (up, down, stop, pull)
changes. The relay it deploys goes through internal/relay, whose Backend the
new one extends. The public types and constants of the protocol (JsonMessage,
ProviderMetadata, the *Type message constants...) stay exported from
pkg/compose as aliases of the new package's.

The tests of the plugin protocol move with the code, assertions unchanged;
those of the provider image phase and of the relay link network removal
stay in pkg/compose. The forwarders to the relay that only the plugin code
used are dropped.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 09:10:05 +02:00
Nicolas De Loof
89ff984452 refactor(relay): move the provider relay management to internal/relay
The relay container and the relay link networks that stand in for a
provider service need three things from the engine: the Docker API, the
event bus and whether Docker Desktop is the engine.

They now live in internal/relay behind a Backend interface that
composeService implements in pkg/compose/relay.go, which keeps the names
the lifecycle code calls (ensureServiceRelay, isRelayContainer,
checkRelayTarget...) as one-line forwarders, so none of its callers change.
The one down-specific piece, turning the relay link networks into down
operations gated on the shared limiter, stays in pkg/compose together with
its tests; the other relay tests move with the code, assertions unchanged.

The progress events and the container name the package needs come from two
small shared packages, internal/progress and internal/naming, which the
following moves reuse. pkg/compose keeps its own copies until the shared
kernel is extracted.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-15 09:10:05 +02:00
Guillaume Lours
89e818966a fix(stats): bound the sampling and keep going when a container fails
Sampling a container takes about a second on the daemon side, and one
goroutine was started per container on every refresh: with all the
projects of a busy host that is hundreds of concurrent calls. Bound
them to 32.

A container that cannot be sampled is now shown without usage, like a
stopped one, instead of aborting the refresh of all the others. An
interrupted command is still reported as such, not rendered as
containers without usage.

Point containerUsage to the docker/cli helpers it follows, and cover
the --no-stream path of runStatsProjects.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-10-15 06:41:29 +02:00
Guillaume Lours
e5b5432781 feat(stats): add --all-projects and --aggregate flags
`docker compose stats` only reports on a single project. Add two
opt-in flags, the default behavior being unchanged:

  --all-projects  one line per container for every project, with a
                  PROJECT column
  --aggregate     one line per project, summing the resource usage of
                  its containers; alone, it reports on the current
                  project

Both support the `table` and `json` formats, the latter printing one
object per line like `docker stats`. Unless `--no-stream` is set, they
refresh 2s after each sample. They cannot be combined with a SERVICE,
and `--all-projects` cannot be combined with `--project-name`.

docker/cli does not export its stats collection, so containers are
sampled through the Engine API and the figures computed the same way
`docker stats` does.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-10-15 06:41:29 +02:00
Guillaume Lours
3d188290d0 test(push): pin --ignore-missing behavior under --dry-run
Some checks are pending
ci / validate (lint) (push) Waiting to run
ci / validate (relay-lint) (push) Waiting to run
ci / validate (relay-test) (push) Waiting to run
ci / validate (validate-docs) (push) Waiting to run
ci / validate (validate-go-mod) (push) Waiting to run
ci / validate (validate-headers) (push) Waiting to run
ci / validate (validate-mocks) (push) Waiting to run
ci / binary (push) Waiting to run
ci / binary-finalize (push) Blocked by required conditions
ci / bin-image-test (push) Waiting to run
ci / relay-image-test (push) Waiting to run
ci / test (push) Waiting to run
ci / e2e (plugin, oldstable, graphdriver) (push) Waiting to run
ci / e2e (standalone, oldstable, graphdriver) (push) Waiting to run
ci / e2e (plugin, stable, containerd) (push) Waiting to run
ci / e2e (plugin, stable, graphdriver) (push) Waiting to run
ci / e2e (standalone, stable, containerd) (push) Waiting to run
ci / e2e (standalone, stable, graphdriver) (push) Waiting to run
ci / coverage (push) Blocked by required conditions
ci / ci-ok (push) Blocked by required conditions
ci / release (push) Blocked by required conditions
docs-upstream / docs-yaml (push) Waiting to run
docs-upstream / validate (push) Blocked by required conditions
merge / bin-image-prepare (push) Waiting to run
merge / bin-image (push) Blocked by required conditions
merge / relay-image (push) Waiting to run
merge / module-image (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
zizmor / zizmor (push) Waiting to run
The dry-run client fakes ImageInspect for some callers, picked by the
name of the calling function, and fakes the push of an image. Nothing
tied --ignore-missing to the real state of the local image store in
dry-run.

Check that a missing image is skipped from what the engine really
holds, that the other images get the faked push, and that nothing is
pushed nor looked up in a registry for the skipped ones.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-10-14 21:34:38 +02:00
Guillaume Lours
174eb96699 feat(push): add --ignore-missing to skip images not available locally
`push --ignore-push-failures` ignores every push error, including
authentication and registry failures, which can hide real problems when
the only expectation is that some services have not been built.

Add `--ignore-missing`, which skips an image that is not in the local
image store and still fails on any other error. It is independent of
`--ignore-push-failures`, whose behavior is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-10-14 21:34:38 +02:00
Nicolas De Loof
507ca3aa4e test(executor): make the wait-slot regression test deterministic and portable
Some checks are pending
ci / validate (lint) (push) Waiting to run
ci / validate (relay-lint) (push) Waiting to run
ci / validate (relay-test) (push) Waiting to run
ci / validate (validate-docs) (push) Waiting to run
ci / validate (validate-go-mod) (push) Waiting to run
ci / validate (validate-headers) (push) Waiting to run
ci / validate (validate-mocks) (push) Waiting to run
ci / binary (push) Waiting to run
ci / binary-finalize (push) Blocked by required conditions
ci / bin-image-test (push) Waiting to run
ci / relay-image-test (push) Waiting to run
ci / test (push) Waiting to run
ci / e2e (plugin, oldstable, graphdriver) (push) Waiting to run
ci / e2e (standalone, oldstable, graphdriver) (push) Waiting to run
ci / e2e (plugin, stable, containerd) (push) Waiting to run
ci / e2e (plugin, stable, graphdriver) (push) Waiting to run
ci / e2e (standalone, stable, containerd) (push) Waiting to run
ci / e2e (standalone, stable, graphdriver) (push) Waiting to run
ci / coverage (push) Blocked by required conditions
ci / ci-ok (push) Blocked by required conditions
ci / release (push) Blocked by required conditions
docs-upstream / docs-yaml (push) Waiting to run
docs-upstream / validate (push) Blocked by required conditions
merge / bin-image-prepare (push) Waiting to run
merge / bin-image (push) Blocked by required conditions
merge / relay-image (push) Waiting to run
merge / module-image (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
zizmor / zizmor (push) Waiting to run
The sibling's start now only returns once the wait has polled its
dependency, so without the fix the plan deadlocks whichever node takes the
single slot first, instead of depending on the scheduler. It also uses the
platform-neutral newTestService helper, so the file builds on Windows.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-14 15:26:36 +02:00
Nicolas De Loof
a366252aeb fix(executor): a wait node holds no --parallel slot while it polls
Every plan node acquired a concurrency slot before running, including
OpWaitCondition, which then kept it for the whole health polling. A
dependency awaited as healthy can itself need a sibling container the plan
has yet to start, so with a bounded --parallel the wait could take the slot
that sibling's start needed and only end at its timeout.

Wait nodes now skip the limiter: they only poll the daemon on a ticker, as
the imperative waitDependencies does outside the cap.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-14 15:26:36 +02:00
Nicolas De Loof
77f57a9c8a feat(run): --no-recreate reuses existing dependencies as-is
The dependencies a one-off starts go through the regular create path
and its config-hash divergence check, with no way to opt out: any
resolution difference with the command that created them (environment,
model edit) recreates the dependency — destroying state a previous run
built up (issue #13769's database losing its users). up already offers
--no-recreate for exactly this; run now aligns: the flag maps to the
"never" recreate policy, propagated through the RunOptions.CreateOptions
fields that startDependencies previously dropped. Default behavior is
unchanged (empty policy = "diverged").

Closes #13769

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-14 09:34:19 +02:00
Nicolas De Loof
b10678d06c fix(build): read bake's stderr to the end before waiting for it
Some checks are pending
ci / validate (lint) (push) Waiting to run
ci / validate (relay-lint) (push) Waiting to run
ci / validate (relay-test) (push) Waiting to run
ci / validate (validate-docs) (push) Waiting to run
ci / validate (validate-go-mod) (push) Waiting to run
ci / validate (validate-headers) (push) Waiting to run
ci / validate (validate-mocks) (push) Waiting to run
ci / binary (push) Waiting to run
ci / binary-finalize (push) Blocked by required conditions
ci / bin-image-test (push) Waiting to run
ci / relay-image-test (push) Waiting to run
ci / test (push) Waiting to run
ci / e2e (plugin, oldstable, graphdriver) (push) Waiting to run
ci / e2e (standalone, oldstable, graphdriver) (push) Waiting to run
ci / e2e (plugin, stable, containerd) (push) Waiting to run
ci / e2e (plugin, stable, graphdriver) (push) Waiting to run
ci / e2e (standalone, stable, containerd) (push) Waiting to run
ci / e2e (standalone, stable, graphdriver) (push) Waiting to run
ci / coverage (push) Blocked by required conditions
ci / ci-ok (push) Blocked by required conditions
ci / release (push) Blocked by required conditions
merge / bin-image-prepare (push) Waiting to run
merge / bin-image (push) Blocked by required conditions
merge / relay-image (push) Waiting to run
merge / module-image (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
zizmor / zizmor (push) Waiting to run
doBuildBake waited for the buildx process in a goroutine while reading its
rawjson stderr stream. os/exec closes the pipe as soon as Wait sees the
process exit, dropping whatever was not read yet: when the consumer of the
solve statuses (the progress display) lags behind the process, the end of the
stream is lost. That is where bake tells why it failed (the Dockerfile
excerpt, then "failed to solve: ..."), so the build failed with exit code 1
but without its reason, or with it truncated.

Read the stream to EOF first, as the os/exec documentation requires, then
Wait. The os.ErrClosed case of the reader, which only existed to absorb the
pipe being closed under it, goes away with the race.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-13 13:57:32 +02:00
Guillaume Lours
4f9bec66b4 fix(models): do not pull nor configure models in dry-run mode
The docker model plugin is an external process the dry-run API client
cannot intercept, so up, create and run --dry-run really pulled the
models and changed the runner configuration.

Skip pull and configure when dry-run is set while still emitting the
progress events. The read-only ls and status commands still run, so
pulling is only reported for a model that is actually missing and the
model variables are still computed.

Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-10-13 13:44:27 +02:00
Guillaume Lours
2c38ead3eb fix(provider): do not execute provider services in dry-run mode
Dry-run only wraps the Docker API client, so provider services, which
are external processes, were still executed: up and create ran the
provider's up command, down and stop ran theirs.

Skip the process in executePlugin when dry-run is set while still
emitting the progress events, and return early from runPlugin so no
relay is deployed or removed for a provider that never ran. The
metadata command is still invoked to keep validating the binary and
its required parameters.

Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-10-13 13:44:27 +02:00
dependabot[bot]
1c88d072b6 build(deps): bump golang.org/x/sync from 0.23.0 to 0.24.0
Some checks are pending
ci / validate (lint) (push) Waiting to run
ci / validate (relay-lint) (push) Waiting to run
ci / validate (relay-test) (push) Waiting to run
ci / validate (validate-docs) (push) Waiting to run
ci / validate (validate-go-mod) (push) Waiting to run
ci / validate (validate-headers) (push) Waiting to run
ci / validate (validate-mocks) (push) Waiting to run
ci / binary (push) Waiting to run
ci / binary-finalize (push) Blocked by required conditions
ci / bin-image-test (push) Waiting to run
ci / relay-image-test (push) Waiting to run
ci / test (push) Waiting to run
ci / e2e (plugin, oldstable, graphdriver) (push) Waiting to run
ci / e2e (standalone, oldstable, graphdriver) (push) Waiting to run
ci / e2e (plugin, stable, containerd) (push) Waiting to run
ci / e2e (plugin, stable, graphdriver) (push) Waiting to run
ci / e2e (standalone, stable, containerd) (push) Waiting to run
ci / e2e (standalone, stable, graphdriver) (push) Waiting to run
ci / coverage (push) Blocked by required conditions
ci / ci-ok (push) Blocked by required conditions
ci / release (push) Blocked by required conditions
merge / bin-image-prepare (push) Waiting to run
merge / bin-image (push) Blocked by required conditions
merge / relay-image (push) Waiting to run
merge / module-image (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
zizmor / zizmor (push) Waiting to run
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.23.0 to 0.24.0.
- [Commits](https://github.com/golang/sync/compare/v0.23.0...v0.24.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-version: 0.24.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-13 10:31:22 +02:00
dependabot[bot]
1846fe0bce build(deps): bump github.com/Microsoft/go-winio
Bumps [github.com/Microsoft/go-winio](https://github.com/Microsoft/go-winio) from 0.6.3-0.20251027160822-ad3df93bed29 to 0.6.3.
- [Release notes](https://github.com/Microsoft/go-winio/releases)
- [Commits](https://github.com/Microsoft/go-winio/commits/v0.6.3)

---
updated-dependencies:
- dependency-name: github.com/Microsoft/go-winio
  dependency-version: 0.6.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-13 10:17:11 +02:00
Nicolas De Loof
6698708752 refactor(projectloader): move project loading and generation to internal/projectloader
LoadProject and Generate (the api.ProjectLoader operations) need two things
from the engine: the Docker API, to read the containers a project is
generated from, and the Docker CLI, which resolves remote Compose files.

They now live in internal/projectloader, along with the unsupported
attributes detection only the loader uses, behind a Backend interface that
composeService implements in a new file of pkg/compose, like internal/inspect.
The tests move with the code; their assertions are unchanged, only the way
the service is built differs.

The canonical container name, which both this package and internal/inspect
need, moves to a tiny internal/naming package instead of being copied a
third time. pkg/compose keeps its own copy until the shared kernel is
extracted.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-13 10:03:53 +02:00
Nicolas De Loof
c22ab50a61 refactor(inspect): move the read-only operations to internal/inspect
ps, ls, top, port, volumes, events and viz only read the state of a
project: they need the Docker API, the list of the project's containers
and the concurrency bound, nothing else of composeService.

They now live in internal/inspect, which declares that need as a Backend
interface. composeService implements it in a new file of pkg/compose and
forwards the seven api.Inspector methods, so no other file of pkg/compose
changes, and neither does the behavior: the service-level tests stay in
pkg/compose and run unchanged through the forwarders.

The few tiny helpers the operations share with the rest of pkg/compose
(canonical container name, concurrency-limited errgroup, project filter)
are copied for now: the shared kernel they belong to is a later step.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-13 10:03:53 +02:00
Nicolas De Loof
72f134f20c fix: keep the image pull of compose run inside the run progress block
compose run only wrapped the start of its dependencies in the "run"
progress operation. The pull of the target service's image, and the
creation of the one-off container, happened once that operation was
closed, so the TTY display fell back to one plain line per event,
including every layer, instead of the compact in-place block.

Wrap the whole preparation in the operation.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-13 10:02:09 +02:00
Nicolas De Loof
635221baf8 build(deps): bump compose-go to the pre_start environment fix
Some checks are pending
ci / validate (lint) (push) Waiting to run
ci / validate (relay-lint) (push) Waiting to run
ci / validate (relay-test) (push) Waiting to run
ci / validate (validate-docs) (push) Waiting to run
ci / validate (validate-go-mod) (push) Waiting to run
ci / validate (validate-headers) (push) Waiting to run
ci / validate (validate-mocks) (push) Waiting to run
ci / binary (push) Waiting to run
ci / binary-finalize (push) Blocked by required conditions
ci / bin-image-test (push) Waiting to run
ci / relay-image-test (push) Waiting to run
ci / test (push) Waiting to run
ci / e2e (plugin, oldstable, graphdriver) (push) Waiting to run
ci / e2e (standalone, oldstable, graphdriver) (push) Waiting to run
ci / e2e (plugin, stable, containerd) (push) Waiting to run
ci / e2e (plugin, stable, graphdriver) (push) Waiting to run
ci / e2e (standalone, stable, containerd) (push) Waiting to run
ci / e2e (standalone, stable, graphdriver) (push) Waiting to run
ci / coverage (push) Blocked by required conditions
ci / ci-ok (push) Blocked by required conditions
ci / release (push) Blocked by required conditions
merge / bin-image-prepare (push) Waiting to run
merge / bin-image (push) Blocked by required conditions
merge / relay-image (push) Waiting to run
merge / module-image (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
zizmor / zizmor (push) Waiting to run
Picks up compose-spec/compose-go#938, which resolves the env_file entries
of pre_start hooks like the service ones.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-12 18:15:14 +02:00
Nicolas De Loof
eef29d10c3 test(e2e): pre_start hooks must receive the service's env_file and environment
Reproduces docker/compose#14287: a hook inheriting the service's
env_file (or declaring its own) runs without those variables.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-12 18:15:14 +02:00
Nicolas De Loof
ff4494163d refactor: split create() into preparePlan + executePlan
Pure extraction, no behavior change: create() resolved the project
model, ensured images/models and external networks/volumes, observed
the daemon, and reconciled a Plan, all inline before calling
executePlan. That decision-making half is now its own function,
preparePlan, returning the canonical project, the daemon snapshot, and
the Plan — nothing is created, started, or otherwise touched by it.

This is Lot 1's last item (epic #14081): interactive up's eventual
create/start phase boundary needs to prepare the plan once, run the
Create phase, set up attach/printer/monitor, then run the Start phase
— which needs the plan and snapshot available between those steps,
not buried inside create()'s single call chain. create() itself is
unchanged in behavior, just now a two-line call into preparePlan
followed by the existing emitRunningEvents + executePlan.

Verified with the existing unit suite plus the create/up/down e2e
scenarios (TestLocalComposeUp, TestCreateIdempotentDefaultPlatform,
TestCreateIdempotentSharedImageMixedPlatforms, TestCreateRefusesJob,
TestCreateLocalMultiPlatformImage, TestUpWithAllResources) against a
locally built binary.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2026-10-12 17:23:16 +02:00
Guillaume Lours
c4f54626d9 fix(watch): skip sync+exec triggers on bind-mounted paths
A sync into a path that is also bind-mounted writes back to the host,
which the watcher sees as a new change and syncs again, looping
forever. isSync, which gates the bind mount check, missed sync+exec,
so only sync and sync+restart triggers were skipped with a warning.

Include sync+exec in isSync. This also makes initial_sync apply to
sync+exec triggers, as it does for the other sync+x actions.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
2026-10-12 17:02:20 +02:00
CrazyMax
1e1c577eab fix(bake): grant access to ssh, local caches and OCI contexts
Grant access to SSH keys and sockets from build configuration and CLI
options, and authorize default agent forwarding, including implicit SSH
Git contexts. Serialize pathless SSH entries without an empty source so
Bake applies the agent entitlement check.

Grant read access to local cache imports and OCI layout contexts, and
write access to local cache exports. Match Bake's path and cache syntax
while excluding service, target and image references from filesystem grants.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-10-12 16:54:47 +02:00
CrazyMax
43a5d5a253 fix(bake): grant permissions for configured build inputs
Buildx 0.37.2 enforces entitlements with rawjson progress, exposing missing
permissions in Compose's Bake invocation. Grant read access to Dockerfiles
and file secrets, including local Dockerfiles used with remote contexts,
and forward requested entitlements and host network access.

Deduplicate grants and preserve environment secrets and privileged builds.
Add regression coverage for the generated Bake configuration and arguments.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-10-12 16:54:47 +02:00