Repository navigation
fix(provider): fail fast on a hung plugin-to-plugin call — bound the broker InvokeProvider - #474
Conversation
…broker InvokeProvider with the default invoke timeout
Review — BLOCKHead SHA: Change class: runtime/code change (Go core broker invoke path + regression test) Security screen: PASS — the change strengthens a guardrail (bounds a previously-unbounded broker call); no secrets, exfiltration, scope mismatch, or supply-chain change. Description matches the diff. Blocks
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — BLOCKHead SHA: Change class: runtime/code change (Go core broker invoke path + regression test) Security screen: PASS — the change strengthens a guardrail (bounds a previously-unbounded broker call); no secrets, exfiltration, scope mismatch, or supply-chain change. Description matches the diff. Blocks
Note: the unit test is a proper regression guard (it would hang/fail without the fix) and the broker-timeout RCA is sound — but the unit test alone does not satisfy the runtime-change bed gate, and the environmental dismissal of the live stall is a separate blocking violation. Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — BLOCKHead SHA: Change class: runtime/code change (Go core broker invoke path + regression test) Security screen: PASS — the change strengthens a guardrail (bounds a previously-unbounded broker call); no secrets, exfiltration, scope mismatch, or supply-chain change. Description matches the diff. Placement is CORRECT (reverse-channel broker belongs in core). Blocks
Note: the unit test is a proper regression guard (it would hang/fail without the fix) and the broker-timeout RCA is sound — but the unit test alone does not satisfy the runtime-change bed gate, and the environmental dismissal of the live stall is a separate blocking violation. Both prior reviewer BLOCKs raised these findings, and both survive re-derivation against the CURRENT body/diff. Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — BLOCKHead SHA: Change class: runtime/code change (Go core broker invoke path + regression test) Security screen: PASS — the change strengthens a guardrail (bounds a previously-unbounded broker call); no secrets, exfiltration, scope mismatch, or supply-chain change. Description matches the diff. Placement is CORRECT (reverse-channel broker belongs in core). Blocks
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — BLOCKHead SHA: Change class: runtime/code change (Go core broker invoke path + regression test) Security screen: PASS — the change strengthens a guardrail (bounds a previously-unbounded broker call); no secrets, exfiltration, scope mismatch, or supply-chain change. Description matches the diff. Placement CORRECT (reverse-channel broker belongs in core). Blocks
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Change class: runtime/code change (Go core broker invoke path + regression test) Security screen: PASS — the change strengthens a guardrail (bounds a previously-unbounded broker call); no secrets, exfiltration, scope mismatch, or supply-chain change. Description matches the diff. Placement CORRECT (reverse-channel broker belongs in core; no new sdk-kit imports, no alias files). Checklist: All applicable rules PASS or NA. Prior comments considered:
The diff adds a deadline guard to Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — the change strengthens a guardrail (bounds a previously-unbounded broker call); no secrets, exfiltration, scope mismatch, or supply-chain change. Description matches the diff. Placement CORRECT (reverse-channel broker belongs in core; no new sdk-kit imports, no alias files). Checklist: All applicable rules PASS or NA. Prior comments considered:
The diff adds a deadline guard to Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Change class: runtime/code change (Go core broker invoke path + regression test) Security screen: PASS — the change strengthens a guardrail (bounds a previously-unbounded broker call); no secrets, exfiltration, scope mismatch, or supply-chain change. Description matches the diff. Placement CORRECT (reverse-channel broker belongs in core; no new sdk-kit imports, no alias files). Checklist: All applicable rules PASS or NA. Prior comments considered:
The diff adds a deadline guard to Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
) * fix(plugin): bind plugin->plugin calls by IDLE, not total duration RCA (R1): defaultPluginInvokeTimeout (10m) was added as a hung-plugin guard (#468 host->plugin, #474 plugin->plugin) but applied as a TOTAL-duration cap. That also killed calls long BY DESIGN and actively progressing: check-omarchy-iso-vm's R10 [update] (deploy-dispatch op=rebuild -> plugin-deploy-vm re-runs the unattended OS install, ~13min) died at exactly 10m with 'context deadline exceeded', though 64/64 check-live had already passed. Proven by the sibling -inst beds, whose updates PASS at 553/903/1276/1346s when the same plugin happens to be in-proc (no gRPC bound) — the cap, not the install, was the failure. Root fix — a per-call IDLE guard (plugin_activity.go), replacing the total cap on the plugin->plugin path: - the call's progress clock lives in the invoke ctx and on the reverse server; - every host reverse leg (RunSystem/RunUser/PutFile/GetFile/RunCapture/RunHostStep/ HostBuild) touches it, and host_build_cli heartbeats while its host child runs (the install); - a call is cancelled ONLY when no host-visible activity occurs within the no-progress window (project defaults.readiness.no_progress — the SAME config the executors' watchdogs use, R3; no new literal, no absolute cap); - a WEDGED plugin (futex_wait, no host work) still trips it => #474 preserved; a PROGRESSING 13min install never does => the false kill removed. Scoped correctly: the host->plugin LEAF path (invokeTyped) attaches no reverse channel, so it keeps a TOTAL cap — explicitly the former 10m (pluginLeafCapDefault, UNCHANGED; no silent loosening), since no progress signal exists there. Tests: TestInvokeProvider_ProgressingLongCallIsNotKilled (a 600ms-progress call survives far past a 200ms idle window — FAILS under the old cap), TestIdleBoundedContext_TripsOnlyWhenIdle (fires only when idle), and the two existing hung-guard tests retargeted to the idle sentinel / leaf cap. Full go vet + go test ./... green. * fix(plugin): add the plugin-process CPU signal to the idle guard The first cut of the idle guard used ONLY host reverse-channel legs as progress, and the live R10 run caught it false-killing a legitimately-booting ISO guest: prepare-venue: plugin call made no host-visible progress within the no-progress window while the guest kept installing for minutes AFTER charly gave up (disk mtime advanced 5-9 min past the failure). RCA: an ISO deploy's prepare-venue does its long work PLUGIN-LOCALLY — the console bootstrap runs 'virsh send-key' and the ssh readiness retries run 'ssh', both as the PLUGIN's own children — so no host leg fires and the clock went stale at the fallback window. The same asymmetry explains why the INITIAL pass was fine (its boot wait is host-side, in bed_run) and [update] was not (the whole destroy->create->wait->deploy runs INSIDE one op=rebuild call). Second progress source: the PEER PLUGIN PROCESS's monotonic CPU. /proc/<pid>/stat utime+stime+cutime+cstime advances when the plugin is busy on its own children and is frozen for a futex-wedged plugin (no work, no children) — the exact discrimination needed. Plumbed the plugin pid from LocalTransport.Connect (captured after client.Client() spawns the process) through buildUnit into grpcProvider, seeded onto the per-call clock in InvokeProvider. Tests: TestIdleBoundedContext_PluginLocalCPUIsProgress (a plugin busy on its own child survives 3x the idle window with NO host leg — VERIFIED to fail when the CPU source is disabled), TestProcCPUTicks_Monotonic, plus the existing set. Full go vet + go test ./... green. * fix(plugin): address review — long host legs, portable tests, comment truth Review findings on the idle guard, all real: - R1 (comment): provider_invoke.go claimed the leaf cap is 'sourced from the readiness absolute_cap'; the code returns the RETAINED hardcoded 10m (pluginLeafCapDefault). Comment corrected to match the code. - R1 (comment): host_build_cli.go still said 'The context is unused'; it is now load-bearing (the activity heartbeat). Comment corrected. - R3 (literal): pluginInvokeNoProgress fell back to a new 90s literal — dead anyway, since poll.ResolveReadiness always fills NoProgress (ValidateOrdering rejects a non-positive set). Dropped; the readiness field is the single source. - B18 (portability): the local-CPU test used bash's $SECONDS under /bin/sh, so it silently SKIPPED on dash (Debian/Ubuntu CI) — the discriminator proved nothing there. Switched to a POSIX arithmetic loop and removed the t.Skip escape (now t.Fatal). - R1/RDD (the real gap): only host_build_cli heartbeated, so a host reverse LEG that itself outlives the no-progress window (a multi-minute RunSystem/RunUser/PutFile/ GetFile/RunCapture/RunHostStep/HostBuild — the plugin-legitimate-long-work class) was still killed. Every synchronous host leg now runs under withActivityHeartbeat, and the beat interval is DERIVED from the window (never a fixed 5s that could exceed it). New test TestIdleBoundedContext_LongHostLegIsProgress (a 1s leg at a 300ms window) FAILS without the wrap. Full go vet + go test ./... green. * fix(plugin): address review round 2 — stream legs, pid plumb, split seams Review findings, all real: - R4 (RunStream/RunInteractive): the ONE reverse leg with no wrapper. A peer blocked consuming a long quiet host stream (`logs --follow`, an interactive shell) produced no host touch and, blocked, no CPU advance — the idle guard would false-kill exactly the long-by-design class this change fixes. Both TTY-bounded legs now heartbeat. - R10/B12 (pid plumb untested): connectAndDescribe → buildUnit → grpcProvider.pid → providerPid had NO test; if cmd.Process were nil the CPU source would be silently dead. processPid is now a named nil-safe helper, and TestProcessPid_NilSafeAndLive asserts 0 before Start / the real pid after Start / the grpcProvider surfacing it. - R3/R10 (one override, two bounds): pluginInvokeNoProgressOverride drove BOTH the idle window and the leaf cap, so the leaf test shrank the idle window instead of exercising the real 10m default. Split into pluginInvokeNoProgressOverride and pluginLeafCapOverride. Full go vet + go test ./... green. * chore: re-trigger after body evidence fixes (full step list + served-from grep) * docs(plugin): correct two comments to match the code (review round 3) - provider_invoke_timeout_test.go said the leaf bound is 'the readiness absolute_cap'; pluginLeafCap reads NO readiness config — it is the retained hardcoded pluginLeafCapDefault (the override seam shrank it for the test). Corrected. - plugin_activity.go's leg enumeration omitted RunStream/RunInteractive, which this same change added heartbeats to. Enumeration updated. --------- Co-authored-by: Andreas AI Trawöger <[email protected]>
… name it when it fires (#1004) * fix(plugin): raise the leaf cap to a bound a cold build can meet, and name it when it fires `pluginLeafCapDefault` was 10m, applied as a TOTAL bound to every host→plugin LEAF call — one that attaches no reverse channel, so the host has no progress signal to guard on. The longest legitimate leaf is exactly the work that bound kills: a COLD image build. Measured while building the Open Web UI image on a refreshed base digest: `box build openwebui` (multi-hundred-MB base pull + full package install + a pixi/pip app layer) died at the cap twice, surfacing as `signal: killed` on buildctl and `context canceled` inside the mount callback, and the same build completed with `CHARLY_PLUGIN_LEAF_CAP=120m`. Two changes: 1. The default is 2h. Long enough for a cold multi-stage build or a full assembled bed with its rebuild legs; still finite, so a wedged plugin fails instead of wedging the host (the #474 guarantee the 10m bound carried). The precise IDLE guard is unchanged and still owns the plugin→plugin path, which does have a progress signal to watch. 2. The expiry now IDENTIFIES ITSELF: `leafCapErr` wraps with `errPluginLeafCap` when the total bound is what fired, naming the duration and `CHARLY_PLUGIN_LEAF_CAP`, while keeping the underlying error's identity (`errors.Is(err, context.DeadlineExceeded)` still holds). Previously the operator saw only `context canceled` from inside the plugin's children — which is how a time bound nobody had mentioned got misread as a crash. Tests move with the behaviour rather than being loosened: the shipped-value test now pins 2h with the rationale, the hung-plugin regression test asserts the error is identifiable as the cap AND still carries the deadline, and a new test proves the message names the knob and that an UNCAPPED call is never rewritten. Closes #1003 Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) * test(note): correct this branch's confidence tier and the bed's step list Two review findings, both correct. 1. The tier was inflated. `fully tested and validated` requires the cutover's new code paths to have EXECUTED against the fresh rebuild, and `leafCapErr`'s wrap branch did not: every leaf in the disposable bed was short, and the measured before/after deliberately RAISED the cap rather than expiring it. A live expiry could not be produced on demand either — the bound fires only on a host→plugin LEAF, and `box list boxes`, `box generate`, `box validate` and `charly cmd` all complete under a `CHARLY_PLUGIN_LEAF_CAP=1s` bound because they dispatch through the reverse-channel (idle-bounded) path. So the tier is `analysed on a live system`, and the wrapper's naming behaviour rests on its tests. 2. The bed evidence did not reconcile: the body condensed the phases to nine while the run reported `steps=11` — `vm-build` and the `bring-up-members` member leg were dropped. The body now pastes all eleven, and ties them to `driver_version: 2026.293.2010` from the run's own summary. No code change; the constant, the wrapper and their tests are unchanged. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system) * test(note): wait on ctx.Done(), and state the honest tier in the footer Two review points. The test waited for its expired deadline with a 1ms sleep; it now waits on ctx.Done(), which is the signal itself rather than a guess about how long it takes to fire. The mandatory Assisted-by footer still claimed 'fully tested and validated' while the body's own Change-classification said 'analysed on a live system' — the body was corrected last round and the footer was missed. That is this round's missed control: I corrected the prose and did not re-read the one line the rulebook requires to carry the tier. The footer now says what the evidence supports. Why no live expiry: documented on the PR — four attempts (box list, box generate, box validate and a remote --repo resolve, each under a 1ns/1s cap) all completed, because those dispatches go through the reverse-channel (idle-bounded) path, not the host→plugin LEAF path. The leaves that DO expire are the long internal ones inside a build, which cannot be triggered on demand without reproducing the 10-minute failure. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system) * chore(ci): re-trigger the gate on a fresh head The validator's own last verdict for `a8c72e77` is PASS (posted 23:31Z), but the check-run recorded for that head is the 22:51Z attempt, whose gate step read the earlier BLOCK. The re-run updated the verdict comment without replacing the check-run, so the required check still reports failure and auto-merge never arms. No code change: this commit exists only to give the gate a head whose check-runs are created after the PASS verdict, which is the state the branch is actually in. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
Summary
The broker's
InvokeProvider— the leg a plugin uses to call another plugin — ran with whatever context the caller passed back, and that context carries no deadline of its own. So a peer that never answers (the fleet-del teardown deadlock: a plugin waiting on a peer that is itself waiting) blocked the goroutine infutex_waitforever.invokeTypedalready bounds the host→plugin leg (#468). This adds the same guard to the plugin→plugin leg, reusing the samedefaultPluginInvokeTimeoutvar rather than introducing a second timeout, and only when the caller supplied no deadline:Correction to the previous body. It credited the live stall's root cause to
sdk#190. That PR is now closed, superseded byopencharly/sdk#191(same fix, corrected commit message). This PR does not depend on either: the two bound different calls — sdk bounds the engine commandRemoveImagesByReferenceruns, this bounds the broker invoke. Both were unbounded; neither subsumes the other.How tested
The regression test, with a negative control that proves it has teeth. It registers a blocking provider and calls the broker's
InvokeProviderwith a background context (no deadline), assertingcontext.DeadlineExceededwithin the test's shortened timeout:Negative control — the same test against the pre-fix path, with only the deadline block removed:
It does not fail an assertion — it hangs until the package timeout kills it, which is exactly the production symptom. 0.10s bounded vs 60s hung.
The live bed —
check-punktfunk-pod(disposable: true), run to completion with a binary built from this branch's committed tree (git status --porcelainempty beforetask build:binary). Full R10 sequence including thecharly updatefresh rebuild:check-live-rebuild: 37 PASS, 0 FAIL.A note on
[cleanup]'s 1m12s. That step is slow for a reason worth recording rather than smoothing over: I watched it live, and it was blocked inRemoveImagesByReferenceon an unboundedpodman images --filter reference=check-punktfunk-pod-overlay, queued behind an unrelatedpodman buildfrom another session holding the container store's layer lock:It recovered on its own when the other build released the lock. That is a different unbounded call from the one this PR fixes — it is the engine command bounded by
opencharly/sdk#191— and it is the clearest argument for that PR, so I have posted the capture there. It does not affect this result: the step passed, and the leg this diff bounds is the broker invoke, not the engine command.Why this bed exercises the changed leg specifically. The bed deploys the out-of-process
plugin-punktfunkverb, whose checks run inside the venue over the reverse channel — a plugin calling back through the broker to reach another plugin, which is the exactInvokeProviderpath this diff bounds. Those calls all returned real data through it:What the bed does and does not prove. It proves the bounded path carries real plugin→plugin traffic with no regression — every dispatch in those 13 steps went through it. It does not show a live timeout firing, because nothing hung: reproducing the teardown deadlock on demand is not something I can stage honestly. The bound engaging is what the negative control above proves, deterministically. I would rather say that plainly than describe a healthy run as if it had demonstrated a timeout.
Diagnostics across the run: errors 0, warnings 0. The single
allowlisted=1on each step isdev-worktree-binary-notice— charly noting it is a worktree build rather than an installed package, which is a property of how the binary under test was produced.[update]'sallowlisted=5adds fourpacman-mirror-retrieval-recoveredentries, each conditional on its own package installing.Rulebook compliance
defaultPluginInvokeTimeoutas fix(provider): fail fast on a hung plugin call — apply a default invoke timeout #468: one timeout, two call paths.check-punktfunk-pod,disposable: true, run throughcharly update's fresh rebuild on the committed tree.Change classification
check-punktfunk-podR10 run on a binary built from this branchfully tested and validated— the changed leg executed live on a disposable bed at zero errors and zero warnings, and the bound's behaviour is proved by a negative control that hangs without itAssisted-by: Claude Code Anthropic Opus 5 (fully tested and validated)