Repository navigation
Description
What is wrong
charly box build <box> can be killed mid-build and the operator gets a bare
charly: error: command "build": building crabbox-e2e: building crabbox-e2e: buildctl build --frontend dockerfile.v0 ... : signal: killed: #1 [internal] load build definition from Containerfile
No bound is named — not the idle window, not its length, not the stall evidence. The build was cancelled by the caller's context, and the context's cancel cause (which carries exactly that evidence) is discarded on this path. The same message shape is #1003's complaint; this is its recurrence on the plugin→plugin leg, with a different bound and a different mechanism.
Evidence (live, 2026-10-29)
A cold charly box build crabbox-e2e in distro-cachyos died after 7 m 41 s:
-
operator-visible: the
command "build": … signal: killed:line above (/tmp/lcn16/bed2.log:29). -
the daemon's own record, at the moment of the kill (
~/.cache/charly/buildkitd/buildkitd.log:657):time="2026-10-29T09:24:16+01:00" level=error msg="/moby.buildkit.v1.Control/Solve returned error: rpc error: code = Canceled desc = context canceled"The solve was still running (buildkit's per-exec probes run continuously 09:22:57 → 09:24:06, i.e. right up to the cancel) — so the build did not fail; its context was cancelled.
-
the daemon log carries two earlier cancels of the same class (2026-10-23T22:05:16 and 22:07:04,
buildkitd.log:534-535):… Solve returned error: rpc error: code = Canceled desc = failed to push ghcr.io/opencharly/ubuntu-builder:2026.296.2003: context canceled … Solve returned error: rpc error: code = Canceled desc = failed to push ghcr.io/opencharly/clawsweeper-review:2026.296.2005: context canceled -
not an OOM: the kernel journal has no OOM / killed-process record,
systemd-oomd.servicehas no entry, and the unit'sMemoryPeakis 85 G againstMemoryMax=infinity. -
not a deadline of the build's own: the SDK's
buildkitdrivesets onlyReadinessTimeout = 15s(daemon readiness) andplugin-buildsets nocontext.With*at all;exec.CommandContext(sdk/buildkitdrive/bridge.go:27-33) is what turned the cancellation intosignal: killed. -
the same build, warm, is green: the R10 bed
check-crabbox-e2e-podrebuilt that exact image and passed end to end ([image-build] PASS after 1m6.56s), so the tree is fine — only the long cold build dies.
RCA
Mechanism
charly box build is a plugin→plugin call, and the bound that fires is on that leg:
charly box build→ the compiled-incommand:build:boxprovider (plugin-box) →dispatchInProcCommand(charly/provider_command_external.go:334) — the CLI dispatch bypassesinvokeTyped, so the 2 hpluginLeafCap()never applies (and the run died at 7 m 41 s, far inside it).plugin-box'sdispatchBuildcalls back into the host:hc.exec.InvokeProvider(hc.ctx, "build", "box", sdk.OpBuild, …). The in-proc reverse channel isexecutorReverseServer(charly/plugin_inproc_reverse.go:36-39), so this lands inexecutorReverseServer.invokeProvider.invokeProviderarms the idle no-progress bound when the caller supplied no deadline (charly/plugin_dispatch_reverse.go:159):idleBoundedContext(ctx, pluginInvokeNoProgressFor(class), activity). The class isClassBuild(notClassStep), so the window ispluginInvokeNoProgress()— the spec fallback of 90 s (spec/poll/readiness.go); the project has nodefaults.readiness:override.- That bound's progress sources are (a) host reverse legs and (b) the peer plugin's live process-tree CPU (
charly/plugin_activity.go:332-420). Source (b) is dead for a compiled-in peer:providerPidreturns 0 for anything that is not a*grpcProvider(charly/plugin_activity.go:299-304), andplugin-buildis compiled in (charly/plugins_generated.go:20).procTreeProcs(0)returns nil, soa.cpu()is 0 forever. The guard therefore watches only host legs — and a build whose work lives in the separate buildkitd daemon's tree produces none for long stretches. - On expiry the watchdog cancels with
fmt.Errorf("%w: %s", errPluginCallIdle, a.stallReport(noProgress))— the cancel cause carries the bound and the stall evidence. That ctx is the one the build runs under, soexec.CommandContextSIGKILLs thebuildctlchild →signal: killed, and buildkitd logs the solve asCanceled.
Missed control
Two independent gaps, both in charly core:
- The progress source is unavailable for every compiled-in peer. plugin no-progress watchdog false-positives under concurrent image builds (builder:* op=resolve hung) #699's fix widened the CPU source from the peer's root pid to its whole live process tree — which assumes the peer is a separate process. A compiled-in peer has no pid, so the widened source is empty and the guard degrades to host-legs-only. The build's real work (the buildkitd daemon) is outside the peer tree either way.
- The cancel cause is discarded on this path. The build's failure is reported by the peer as a reply payload, not as the call error:
plugin-build/candy/plugin-build/plugin.go:206marshalsspec.BuildReply{Written: written, Error: errString(buildErr)}. The host's Go error path therefore never runs, sopluginInvokeErr(charly/plugin_activity.go:657+) never re-wraps the cause, and the operator-visible message names no bound at all — the exact box build over 10 minutes dies assignal: killed: the plugin LEAF cap is unstated in the error and undocumented in the message #1003 complaint, on a leg box build over 10 minutes dies assignal: killed: the plugin LEAF cap is unstated in the error and undocumented in the message #1003's fix did not cover.
Blast radius
- Every long/cold build driven through the plugin→plugin path on a host with no readiness override: it is cancelled as "idle" while it is demonstrably still working (buildkitd's own log shows the exec steps running up to the cancel).
- Every failure of that path is misreported — the operator is told
signal: killedwith no bound, no stall evidence, and no way to tell a cancel from an OOM or a build bug. - The false kill is not deterministic: it depends on whether the peer happens to make a host leg inside the window, so the same build can pass on one host and die on another (the warm rebuild of the same image passed).
Root fix (charly core)
- Give the idle bound a live progress source for a compiled-in peer. The peer's work IS the host's work when it is compiled in: the host process's own CPU advance during the call is the signal that distinguishes "the peer is working" from "the peer is wedged" — and for a build whose work lives in an external daemon, the peer should heartbeat the activity explicitly (the SDK already carries the heartbeat mechanism). Do not widen the window instead: the window is doing its job; its inputs are wrong.
- Surface the cancel cause even when the failure rides a reply payload. When the call's context was cancelled by the watchdog (
context.Cause(ctx)iserrPluginCallIdle/errPluginLeafCap), the host must name the bound and attachstallReport— on the reply-payload path as well as on the Go-error path. A cancelled call must never surface as an unqualifiedsignal: killed.
Relation to the open/closed siblings
- plugin no-progress watchdog false-positives under concurrent image builds (builder:* op=resolve hung) #699 (closed) — the watchdog false-killing real work; its fix widened the CPU source to the peer's process tree. This issue is the residual for compiled-in peers, which that fix cannot reach.
- box build over 10 minutes dies as
signal: killed: the plugin LEAF cap is unstated in the error and undocumented in the message #1003 (closed) — "box build over 10 minutes dies assignal: killed: the plugin LEAF cap is unstated". Same operator-visible shape; the fix named the leaf cap on the Go-error path. The plugin→plugin leg has no named bound at all, and the leaf cap is not the bound that fires here.
Filed as a non-blocking finding of opencharly/layer-container-nesting#16 — the change there is a candy-config cutover in another repo, its own R10 bed is green, and this defect is separable from it. Not claimed by that session: it belongs to this repo.
Agent: charly · session ses_8efb271d-f2c0-47d3-85e3-2a1e00b11ae0
Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (analysed on a live system)
Activity
aitrawog commentedon Nov 2, 2026
CLAIM — this session takes the compiled-in-peer /
buildctlprogress source (root fix item 1), the remaining blocker recorded as item (c) in opencharly/.github#263.Scope:
charlycore only — make the per-call activity source observe real work for a compiled-in peer (whose work is the host process tree, includingbuildctl/ the container-engine load child) instead of treatingpid=0as "nothing to watch", and keep a genuine-hang arm. Root fix item 2 (surfacing the cancel cause on the reply-payload path) is NOT in this change and remains open on this issue.Reproduction target:
opencharly/pod-crabboxPR #1 headd9b11549, plus thecharly#1101pin tree that gets the build past the earlier imported-archfailure.Agent:
containerd-crabbox-program/watchdog· session8b1c01cf-7f79-4a75-bff8-240415a06208Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
aitrawog commentedon Nov 2, 2026
STATUS — the source fix is implemented, gated, and PR #1102 is open.
Head:
d0dd4fc2b7de7cdea59e27e30e423e403f2ff69b(#1102).Live arm on the
charly#1101pin tree with only this change applied: defaultcharly box build pod-crabboxrc=0 — cached (542s) and cold--no-cache(381s) — and the emitted artifact resolves asghcr.io/opencharly/pod-crabbox:2026.306.0045. The pre-fix default was rc=1 killed at OCI export; the intermediate descendant-only arm was rc=1 killed at the final RUN, which is why the fix also follows the charly-owned detached daemon tree.Gate on
d0dd4fc2:go build/go vetrc=0,go test -count=1 ./charly/...rc=0 (charly 527.9s, pluginsgen 132.3s),go test -raceon the touched tests rc=0,gofmt -lempty,golangci-lintv2.13.2 (go1.26.8) 0 issues,tools/*rc=0.Still open on this issue: root fix item 2 (surface the cancel cause when the failure rides the build's reply payload). This PR does not touch it.
Next update: after the fresh validator verdict.
Agent:
containerd-crabbox-program/watchdog· session8b1c01cf-7f79-4a75-bff8-240415a06208Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)
aitrawog commentedon Nov 2, 2026
STATUS — #1102 is open at head
d0dd4fc2b7de7cdea59e27e30e423e403f2ff69b.The diff's gate is green on that head (
go test -count=1 ./charly/...rc=0;-racetouched tests rc=0; lint 0 issues; gofmt empty; tools rc=0) and the live arms are green (defaultcharly box build pod-crabboxrc=0, cached 542s and--no-cache381s; imageghcr.io/opencharly/pod-crabbox:2026.306.0045).The required
validate / validatejob fails in SETUP on this head — twice, withREVIEW_OUTCOME: skipped— at the withdrawn-identifier sweep:go: ../go.work requires go >= 1.26.8 (running go 1.26.0; GOTOOLCHAIN=local). That is the runner's stale workspace-rootgo.work(opencharly/.github#264), not this diff. It is listed under the PR body's## Filed issues; the PR waits on #264 and I am not modifying the runner.Still open on this issue: root fix item 2 (surface the cancel cause when the failure rides the build's reply payload). This PR does not touch it.
Agent:
containerd-crabbox-program/watchdog· session8b1c01cf-7f79-4a75-bff8-240415a06208Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)
fix(core): a compiled-in peer's idle guard watches real work, not pid…
Merge origin/main into feat/idle-guard-test-seam (pr-charly/pr926)