Repository navigation
fix(plugin): bind plugin->plugin calls by IDLE, not total duration - #612
Conversation
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.
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.
Review — BLOCKHead SHA: Change class: core runtime Go (plugin→plugin dispatch bound) — one new core file + tests; no docs, candy, schema/ Blocks
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: core runtime Go (plugin→plugin dispatch bound) — one new core file + tests; no docs, candy, schema/ Blocks
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
Review — BLOCKHead SHA: Change class: core runtime (plugin-dispatch bound) + Go tests; no docs/config/CI/security-machinery edits. Comment thread is empty (no prior claims to reconcile). Security screen: PASS — no secrets, no egress, no dependency/CI/validator/rulebook edits, no injected instructions in body/commits/diff. The removal of the 10m total cap is a loosening of a fail-fast guard, but it carries an explicit, verifiable justification (a ~13 min legitimate install killed mid-flight) and the wedge case (0 % CPU) is still caught, so T4 is satisfied. Blocks
Non-blocking note (B15): two non-changelog commits ( Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: core runtime (plugin-dispatch bound) + Go tests; no docs/config/CI/security-machinery edits. Comment thread is empty (no prior claims to reconcile). Security screen: PASS — no secrets, no egress, no dependency/CI/validator/rulebook edits, no injected instructions in body/commits/diff. The removal of the 10m total cap is a loosening of a fail-fast guard, but it carries an explicit, verifiable justification (a ~13 min legitimate install killed mid-flight) and the wedge case (0 % CPU) is still caught, so T4 is satisfied. Blocks
Non-blocking note (B15): two non-changelog commits ( Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
… 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.
Review — BLOCKHead SHA: Change class: core runtime Go (plugin dispatch bound) + Go tests; no docs/candy/schema/ Blocks
Comment intake
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: core runtime Go (plugin dispatch bound) + Go tests; no docs/candy/schema/ Blocks
Comment intake
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
Review — BLOCKHead SHA: Change class: core runtime Go — one new core file ( Prior thread (4 comments, all from the
Blocks
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: core runtime Go — one new core file ( Prior thread (4 comments, all from the
Blocks
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
…eams 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.
Review — BLOCKHead SHA: Change class: core runtime Go — plugin→plugin dispatch bound ( Blocks
Comment intakeFour distinct BLOCK reviews exist (each duplicated by a second run), all at superseded heads (
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: core runtime Go — plugin→plugin dispatch bound ( Blocks
Comment intakeFour distinct BLOCK reviews exist (each duplicated by a second run), all at superseded heads (
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
Review — BLOCKHead SHA: Change class: core runtime Go — one new core file ( Placement: CORRECT — the per-call idle clock, the reverse-leg heartbeats and the pid plumb are provider-dispatch / reverse-channel-broker mechanism, which B16 places in core; Security screen: T1–T4 clear. The change replaces the plugin→plugin total cap with an idle bound; it is a runtime fail-fast bound (not a guardrail surface), the wedge case (no host leg + frozen CPU) still trips the window, and it carries an explicit justification — T4 satisfied. No embedded directives, secrets/egress, or supply-chain edits. Blocks
Comment intake
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: core runtime Go — one new core file ( Placement: CORRECT — the per-call idle clock, the reverse-leg heartbeats and the pid plumb are provider-dispatch / reverse-channel-broker mechanism, which B16 places in core; Security screen: T1–T4 clear. The change replaces the plugin→plugin total cap with an idle bound; it is a runtime fail-fast bound (not a guardrail surface), the wedge case (no host leg + frozen CPU) still trips the window, and it carries an explicit justification — T4 satisfied. No embedded directives, secrets/egress, or supply-chain edits. Blocks
Comment intake
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
Review — BLOCKHead SHA: Change class: core runtime Go — plugin→plugin dispatch bound ( Placement: CORRECT — the per-call idle clock, the leaf cap and the pid plumb are provider-dispatch / reverse-channel-broker mechanism, which belongs in core; Blocks
Comment intakeThread was truncated by the harness at comment
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: core runtime Go — plugin→plugin dispatch bound ( Placement: CORRECT — the per-call idle clock, the leaf cap and the pid plumb are provider-dispatch / reverse-channel-broker mechanism, which belongs in core; Blocks
Comment intakeThread was truncated by the harness at comment
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
Review — BLOCKHead SHA: Change class: core runtime Go — plugin→plugin dispatch bound ( Placement: CORRECT — the per-call idle clock, the leaf cap and the pid plumb are provider-dispatch / reverse-channel-broker mechanism (B16 core); no Security screen: T1–T4 clear — no embedded directives, no secrets/egress (only Blocks
Comment intake (all prior comments are at superseded heads — re-derived against
|
[step: review]Review — BLOCKHead SHA: Change class: core runtime Go — plugin→plugin dispatch bound ( Placement: CORRECT — the per-call idle clock, the leaf cap and the pid plumb are provider-dispatch / reverse-channel-broker mechanism (B16 core); no Security screen: T1–T4 clear — no embedded directives, no secrets/egress (only Blocks
Comment intake (all prior comments are at superseded heads — re-derived against
|
- 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.
Review — PASSHead SHA: Change class: core runtime Go (plugin→plugin dispatch bound, Comment intake (all prior comments are at superseded heads
Verdict: PASS opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — PASSHead SHA: Change class: core runtime Go (plugin→plugin dispatch bound, Comment intake (all prior comments are at superseded heads
Verdict: PASS opencode/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Change class: core runtime Go — plugin→plugin dispatch bound ( Security screen: PASS — no T1–T4 finding (no embedded directives, no secrets/egress, no dependency/CI/validator/rulebook edit; the replaced bound is a runtime fail-fast guard, not a guardrail surface, and carries explicit measured justification while the wedge case — no host leg + frozen CPU — still trips). Checklist: All applicable rules PASS or NA. Placement CORRECT (provider-dispatch / reverse-channel-broker mechanism in core; stdlib-only imports; no Comment intake (all prior comments are at superseded heads and were re-derived against the current diff/body):
Residual items are non-blocking: Verdict: PASS opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — PASSHead SHA: Change class: core runtime Go — plugin→plugin dispatch bound ( Security screen: PASS — no T1–T4 finding (no embedded directives, no secrets/egress, no dependency/CI/validator/rulebook edit; the replaced bound is a runtime fail-fast guard, not a guardrail surface, and carries explicit measured justification while the wedge case — no host leg + frozen CPU — still trips). Checklist: All applicable rules PASS or NA. Placement CORRECT (provider-dispatch / reverse-channel-broker mechanism in core; stdlib-only imports; no Comment intake (all prior comments are at superseded heads and were re-derived against the current diff/body):
Residual items are non-blocking: Verdict: PASS opencode/deepseek-v4.1-flash — action-review. |
Summary
Replaces the withdrawn #611 (env-configurable timeout) with the ROOT fix.
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 guillotined calls long BY DESIGN and actively progressing. Measured live oncheck-omarchy-iso-vm's R10[update]step (deploy-dispatchop=rebuild→plugin-deploy-vmre-runs the unattended OS install): it died withcontext deadline exceededaftercheck-livehad passed 64/64, while the guest kept installing for minutes afterwards (disk mtime advanced past the failure). The step ran 788s persummary.yml— i.e. the 10m cap is not measured from the step's start but from when the bounded plugin→plugin call begins, so "the step reports 788s while the call is cut at 10m" is the same event, not a contradiction.Why the sibling
-instbeds survived at 553/903/1276/1346s — executed evidence (theserved fromline is emitted per out-of-process plugin connection; zero means in-proc, hence no gRPC hop and nodefaultPluginInvokeTimeout):That placement difference — not the operation's length — is why one bound fired and the other did not.
Root fix — an IDLE guard, not a wall-clock cap
plugin_activity.go: the plugin→plugin call is bound by NO-PROGRESS, with two progress sources:RunSystem/RunUser/PutFile/GetFile/RunCapture/RunHostStep/HostBuildtouch the call's clock;host_build_cliheartbeats while its host child (the install) runs./proc/<pid>/statutime+stime+cutime+cstime, polled per tick. This is load-bearing: an ISOprepare-venuedoes its long work plugin-locally (consolevirsh send-key, ssh readiness retries as the plugin's own children), touching NO host leg.RunSystem/RunHostStep/HostBuild) is heartbeated for its whole duration (withActivityHeartbeat), and the beat interval is DERIVED from the window.ResolvedReadiness.WatchProgressfor an intentional long-runner); the window is the project'sdefaults.readiness.no_progress(the SAME config the executors' watchdogs use, R3).Scoped correctly: the host→plugin leaf path (
invokeTyped— distro/resource/init/project/gpu/arbiter resolve) 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.The plugin pid is plumbed
LocalTransport.Connect(captured afterclient.Client()spawns the process) →buildUnit→grpcProvider.How tested
The two guards' behavior, both discriminating:
Two more discriminators, each verified to FAIL without its code path:
TestIdleBoundedContext_PluginLocalCPUIsProgress— a plugin busy on its OWN child survives 3x the window with NO host leg; FAILS when the CPU source is disabled. Uses a POSIX loop (not bash's$SECONDS) and does nott.Skip, so it runs on dash-based CI too.TestIdleBoundedContext_LongHostLegIsProgress— a 1s host leg at a 300ms window survives; FAILS without the leg heartbeat.LIVE R10 proof (fully-patched binary: spec#135 + sdk#259 + plugin-vm#34 + this)
charly check run check-omarchy-iso-vmon adisposable: truetarget, fresh rebuild from the 4.0.3 ISO:summary.ymlstep list (reconcilessteps=10;[update]duration_seconds: 769,ok: true):summary.yml:ok: true,errors: 0,warnings: 0. ZeroDeadlineExceeded, zerono host-visible progress. No post-failure install artifact (contrast the pre-fix FAIL run, whose disk kept growing 22min after charly reported failure). VM destroyed; umbrella status unchanged.Rulebook compliance
go+check+vmskills loaded before editing.poll.ResolvedReadiness.NoProgress(always populated byResolveReadiness), so there is NO new literal; the host legs reuse onewithActivityHeartbeat; one pid plum.defaultPluginInvokeTimeoutis deleted; the executed repo-wide sweep (only the explanatory WHY comment survives) and the withdrawn band-aid identifier is absent:git statuschecked; PR-only; no force-push.check-omarchy-iso-vmbed PASSES on the final tree (output above).Change classification
go vet/go test ./...+ the livecheck-omarchy-iso-vmR10 bed (PASS).fully tested and validated— the changed path ran live end-to-end to a PASS on a disposable target with zero warnings.Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)