Repository navigation
fix(core): a compiled-in peer's idle guard watches real work, not pid 0 (#1088) - #1102
Conversation
… 0 (#1088) The per-call idle guard was blind to a compiled-in peer: providerPid returned 0, so the process-tree source watched nothing, and a build whose work lives in buildkitd was killed at the 90s no-progress window while it was working (opencharly/.github#263 item (c), measured on pod-crabbox PR #1). Root fix in charly/plugin_activity.go: - A compiled-in peer now watches the HOST's DESCENDANTS (buildctl, the engine's load child) instead of pid 0, with the host root excluded so the runtime's own ticks cannot mask a wedged call. - The tree sample is CPU ticks PLUS /proc/<pid>/io bytes (rchar+wchar), so an I/O-bound OCI export / engine load is observed as work. - A compiled-in peer also follows the charly-owned DETACHED daemon trees (buildkitd under rootlesskit, reparented to init), discovered generically by argv under the user's charly cache/runtime dirs -- never by a daemon kind word. This covers a quiet BuildKit RUN, where the client emits nothing for longer than the window. - The stop func now joins the watcher, so a stopped clock cannot sample after return (and cannot race a restored test seam). Tests: descendant-I/O arm, detached-daemon arm (fails with discovery off), the daemon-discovery unit, and the genuine-hang arm (no descendant, no daemon) still trips. R5: providerPid/treeTicks/cpu()/cpus/lastCPU are gone. Reproduction (pod-crabbox PR #1 head d9b11549, charly#1101 pin tree): default pre-fix rc=1 (killed at OCI export); CHARLY_PLUGIN_NO_PROGRESS=20m rc=0; final default rc=0 (542s). Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)
|
STATUS — the required RCA — missed control
What is green on this headThe diff's own gates are green on
Agent: |
|
STATUS — re-run attempt 2 on the same head go: ../go.work requires go >= 1.26.8 (running go 1.26.0; GOTOOLCHAIN=local)
##[error]Process completed with exit code 1.
REVIEW_OUTCOME: skipped(job Agent: |
Review — PASSHead SHA: Security screen: PASS — no T1–T4 findings. The PR does not touch the validator spec or project rulebook; it adds no secrets, credentials, network egress, or dependencies (only stdlib Comments considered: both Checklist: All applicable rules PASS or NA — placement: CORRECT (the idle guard is the reverse-channel/dispatch broker surface; no Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
173 commits behind; both touched files conflicted. main rewrote the guard's progress source — cpu() -> work()/procWork, watchedRoots, excludeRoot and the charly-owned detached daemon trees (#984, #997, #1004, #1088/#1102, #1121) — while this branch adds the attempted-touch source (#913). Resolved by re-basing the attempt source onto main's structure BY HAND rather than merging text: - pluginActivity.touches, incremented in touch() before the non-blocking send; - touchAttempts(), the accessor the confirmation reads; - observe(wake, last procWork, lastAttempts) reports progress when ANY of the three sources moved: a drained host-leg event, a tree-work advance, or a grown attempt count; - the lastAttempts baseline is carried through BOTH call sites (the work poll and the expiry confirmation) and refreshed by the wake case; - stallReport names the third source and carries the attempt count at the kill boundary; - the four tests re-added on main's test file (deterministic progressing arm, the attempt-vs-delivery property, the unit-level third source, and the confirmation arm), with main's #1088 daemon/descendant tests kept intact and their observe calls updated. Verified on THIS tree: gofmt clean; go build ./... and go vet ./... rc=0; the focused guard tests 15/15 PASS; the full module suite go test ./... -> ok 414.387s and ok internal/pluginsgen 142.184s, rc=0, zero failures. *Agent: pr-charly* *Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)*
Summary
charly box build pod-crabboxatopencharly/pod-crabboxPR #1 headd9b11549died at thedefault 90s no-progress window while BuildKit was working. This change fixes the guard's
progress SOURCE, not the window (#1088; item (c) of opencharly/.github#263).
The measured mechanism: the build peer is compiled in, so
providerPidreturned 0 and theprocess-tree source watched nothing; a
buildctlphase has no host reverse leg, so nothingelse fired; the phase died
signal: killedand buildkitd loggedSolve ... Canceled.charly/plugin_activity.gonow:buildctl, the engine'sload child), with the host root excluded so the runtime's own ticks cannot mask a wedged
call;
/proc/<pid>/iobytes (rchar+wchar), so an I/O-bound OCIexport / engine load is observed as work;
buildkitdunderrootlesskit, whichre-execs and is reparented to init) for a quiet BuildKit RUN, discovered generically by
argv under the user's charly cache/runtime roots — no daemon kind word in core;
stop(), so a stopped clock cannot sample after return.The window remains
readiness.no_progress(90s default). No default was raised.How tested
Reproduction target:
pod-crabboxPR #1 headd9b11549a8f47e4395a908b37cdda2f8b0aad6a2.Live venue: a charly worktree at
opencharly/charly#1101head0d3efd27(the pin tree thatgets past the earlier imported-
archfailure) with only this change's four files applied.The PR branch itself is
origin/main(7bb19d0a) + the same four files;origin/mainalonecannot reach the phase under test because the imported-
archfix is #1101's scope.Pre-fix, default settings —
rc=1, killed at OCI exportbuildkitd's own record at the cancel (
buildkitd.log):Pre-fix, raised bound —
rc=0Intermediate arm — descendant-only source, default —
rc=1(the daemon gap)The first version of this fix (host descendants only) passed the OCI export but still died
on the final
pod-crabboxRUN: the RUN executes inbuildkitd, whichbuildkitdrivedetaches and which is reparented to init (
ppid=1), so no descendant tree reached it and theclient emitted no line for >90s:
buildkitd:
Solve returned error ... code = Canceled desc = context canceled(
2026-11-02T01:22:47+01:00). This is why the change also follows the charly-owned detacheddaemon trees.
Final — default settings, final-source binary —
rc=0The final-source binary (built with
scripts/bootstrap-charly.sh) completed the same buildwith the default 90s window:
Cold arm —
--no-cache, default, final-source binary —rc=0To prove the quiet RUN and OCI export are exercised cold (not cache-short-circuited):
Unit arms (R7): fail-without and genuine-hang
All pass under
go test -race:TestObserve_CompiledInPeerDescendantIOIsProgress— a compiled-in peer's host childmoving bytes is progress.
TestIdleBoundedContext_CompiledInPeerDescendantWorkIsProgress— the fixed clock survivesa host child working past the window; the pid-0 source over the same live child trips
(the failing-without-the-fix control).
TestIdleBoundedContext_CompiledInPeerDetachedDaemonTreeIsProgress— a double-forked,reparented writer (the daemon shape) is progress; with discovery OFF the same live writer
is invisible and the clock trips (the second failing-without control).
TestCharlyDaemonPids_FindsProcessesUnderTheCharlyCacheRoot— the discovery itself.TestIdleBoundedContext_CompiledInPeerNoDescendantWorkTrips— the genuine-hang arm:with the fix in place, a compiled-in peer with no working descendant and no daemon still
trips. The host root is excluded, so the runtime's own ticks cannot keep it alive.
Gate (final tree
d0dd4fc2)All commands run with the pinned
go1.26.8toolchain; each line is the command's own exitcode.
charly versionof the worktree-local build:2026.305.2353.(
charly#1101's pin tree was used only for the live venue; the PR's own Go gate is green onorigin/main+ this change.)Rulebook compliance
intermediate post-fix kill (daemon gap) was RCA'd the same way and fixed in this change,
not filed away. The reply-payload cancel-cause (root fix item 2 of charly box build: the plugin→plugin idle bound cancels a long build, and the operator sees a bare
signal: killedwith no bound named #1088) is separable andremains open on charly box build: the plugin→plugin idle bound cancels a long build, and the operator sees a bare
signal: killedwith no bound named #1088; it is listed below.work()is the only sampled source andobserve()theonly decider; daemon and descendant roots are summed by the same
treeWork./procCPU ticks and I/O bytes ofprocesses doing the work; a dip is not progress.
git grep -nE 'providerPid|treeTicks|\.cpu\(\)|\.cpus\b|lastCPU' -- charly/→ NONE.git statusstated before any action; umbrella's 131 pre-existing modifiedentries were not touched; the charly submodule was clean at
046fa3bf; this worktree isoff fresh
origin/main; no force-push or bypass; no submodule edits.the genuine-hang arm still trips; the changed path ran live on the real service (pod-crabbox
build) and the emitted image is in the local store.
pod-crabboxproject;nothing was mocked.
scripts/bootstrap-charly.sh;charly versionandthe
go version -mpins are pasted above.go test ./charly/..., lint, vet, gofmt, tools) passed onthe committed tree, and the live default/cold builds passed with the default bounds.
Change classification
Runtime Go change in the charly core. Attribution tier: fully tested and validated —
the change-class gate passed on the final tree, and the changed path executed live on the real
pod-crabboxbuild with default settings (cached and--no-cache).Filed issues
opencharly/charly#1088— owns this fix (root fix item 1). Root fix item 2 (surface theidle watchdog's cancel cause when the failure rides the build's reply payload) remains open
there; it is separable from this progress-source fix.
opencharly/.github#263— item (c) is the defect this PR fixes; (a) W5.4 CI remains.opencharly/.github#264— the requiredvalidate / validaterun on headd0dd4fc2fails in SETUP:go: ../go.work requires go >= 1.26.8 (running go 1.26.0; GOTOOLCHAIN=local)in the withdrawn-identifier sweep, withREVIEW_OUTCOME: skipped(run41370344019, job125039265452). This is the runner's stale workspace-rootgo.work, not this diff; the local gate and the live pod-crabbox arms are green.Agent:
containerd-crabbox-program/watchdog· session8b1c01cf-7f79-4a75-bff8-240415a06208Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)