Skip to content

fix(provider): fail fast on a hung plugin-to-plugin call — bound the broker InvokeProvider - #474

Merged
github-actions[bot] merged 4 commits into
mainfrom
feat/broker-invoke-timeout
Aug 30, 2026
Merged

github-actions[bot] merged 4 commits into
mainfrom
feat/broker-invoke-timeout

Conversation

@atrawog

@atrawog atrawog commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

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 in futex_wait forever.

invokeTyped already bounds the host→plugin leg (#468). This adds the same guard to the plugin→plugin leg, reusing the same defaultPluginInvokeTimeout var rather than introducing a second timeout, and only when the caller supplied no deadline:

if _, ok := ctx.Deadline(); !ok {
    var cancel context.CancelFunc
    ctx, cancel = context.WithTimeout(ctx, defaultPluginInvokeTimeout)
    defer cancel()
}

Correction to the previous body. It credited the live stall's root cause to sdk#190. That PR is now closed, superseded by opencharly/sdk#191 (same fix, corrected commit message). This PR does not depend on either: the two bound different calls — sdk bounds the engine command RemoveImagesByReference runs, 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 InvokeProvider with a background context (no deadline), asserting context.DeadlineExceeded within the test's shortened timeout:

$ go test ./charly/ -run TestInvokeProvider_FailsFastOnHungPeer -v
=== RUN   TestInvokeProvider_FailsFastOnHungPeer
--- PASS: TestInvokeProvider_FailsFastOnHungPeer (0.10s)
PASS
ok  	github.com/opencharly/charly/charly	0.553s

Negative control — the same test against the pre-fix path, with only the deadline block removed:

$ go test ./charly/ -run TestInvokeProvider_FailsFastOnHungPeer -v -timeout 60s
FAIL	github.com/opencharly/charly/charly	60.478s
FAIL

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 --porcelain empty before task build:binary). Full R10 sequence including the charly update fresh rebuild:

[image-build]         PASS after 54.892s [allowlisted=1 cache=155/164]
[check-image]         PASS after 22.976s [allowlisted=1]
[deploy-add]          PASS after 7.58s   [allowlisted=1]
[config]              PASS after 6.22s   [allowlisted=1]
[start]               PASS after 4.302s  [allowlisted=1]
[bring-up-members]    PASS after 52ms
[check-live]          PASS after 15.711s [allowlisted=1]
[feature-run]         PASS after 18.426s [allowlisted=1]
[update]              PASS after 26.033s [allowlisted=5]
[check-live-rebuild]  PASS after 21.936s [allowlisted=1]
[feature-run-rebuild] PASS after 25.062s [allowlisted=1]
[cleanup]             PASS after 1m12.323s [allowlisted=1]
[cleanup-members]     PASS after 0s
charly check run check-punktfunk-pod: PASS (steps=13)

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 in RemoveImagesByReference on an unbounded podman images --filter reference=check-punktfunk-pod-overlay, queued behind an unrelated podman build from another session holding the container store's layer lock:

charly remove check-punktfunk-pod        wchan: futex_wait
 └─ podman images --filter reference=check-punktfunk-pod-overlay    (58s and counting)

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-punktfunk verb, whose checks run inside the venue over the reverse channel — a plugin calling back through the broker to reach another plugin, which is the exact InvokeProvider path this diff bounds. Those calls all returned real data through it:

PASS  check the verb discovers the host-generated bearer token in the venue and reads
      host identity  [pf-verb-status]
PASS  check the web console answers inside the venue, so the advertised port is not a
      promise the venue breaks  [punktfunk-web-console-live]

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=1 on each step is dev-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]'s allowlisted=5 adds four pacman-mirror-retrieval-recovered entries, each conditional on its own package installing.

Rulebook compliance

  • R1 (RCA) — root-caused: the plugin→plugin broker call had no deadline; fix(provider): fail fast on a hung plugin call — apply a default invoke timeout #468 covered only the host→plugin leg. Not dismissed as environmental.
  • R2 (no deferral) — the bed run the previous body deferred is in this one.
  • R3 (no duplication) — reuses the SAME defaultPluginInvokeTimeout as fix(provider): fail fast on a hung plugin call — apply a default invoke timeout #468: one timeout, two call paths.
  • R4 (no workarounds) — the broker call is genuinely bounded; no retry, no sleep.
  • R6 (git safety) — feature branch, no force-push, no hook bypass.
  • R7 (prove the gate) — unit test, negative control, and the full bed table pasted above.
  • R10 (fresh disposable proof) — check-punktfunk-pod, disposable: true, run through charly update's fresh rebuild on the committed tree.

Change classification

  • Change class: runtime/code change (Go core broker invoke path + regression test)
  • Verification gate: deterministic unit test with a passing negative control, plus a full check-punktfunk-pod R10 run on a binary built from this branch
  • Attribution tier: fully 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 it

Assisted-by: Claude Code Anthropic Opus 5 (fully tested and validated)

…broker InvokeProvider with the default invoke timeout
@github-actions

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: 7e58d1cd07d8 (branch: fix/plugin-invoke-timeout)

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

  1. A1/A2 — runtime change lacks the required fresh-rebuild bed run with pasted output; the body explicitly defers it.
    This is a runtime/code change to the core broker invoke path. The A2 gate requires a FRESH-rebuild bed run with pasted output, a named disposable: true target, and confirmation the CHANGED code path executed live. The body instead states: "after this fix + rebuild, the cleanup must complete (fail fast) — the bed re-run is the final gate" and the attribution tier is "analysed on a live system" with "bed re-run pending". That is a promise of future work ("will test"), which A1 explicitly blocks, and the changed InvokeProvider path has not executed live against a fresh rebuild. The author must complete the bed re-run (naming the disposable target) and paste the output showing the bounded call failing fast at ZERO warnings.

    Note: the unit test is a proper regression guard (it would hang/fail without the fix), and the RCA (R1) is sound — but the unit test alone does not satisfy the runtime-change bed gate.

Verdict: BLOCK


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: 7e58d1cd07d8 (branch: fix/plugin-invoke-timeout)

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

  1. A1/A2 — runtime change lacks the required fresh-rebuild bed run with pasted output; the body explicitly defers it.
    This is a runtime/code change to the core broker invoke path. The A2 gate requires a FRESH-rebuild bed run with pasted output, a named disposable: true target, and confirmation the CHANGED code path executed live. The current body instead states the attribution tier is "analysed on a live system (hang traced live; unit test proves the broker guard; bed re-run under cleared load pending)" — the bed re-run is still pending. That is a promise of future work ("will test"), which A1 explicitly blocks, and the changed InvokeProvider path has not executed live against a fresh rebuild. The author must complete the bed re-run (naming the disposable target) and paste output showing the bounded call failing fast at ZERO warnings.

  2. R1/B14 — forbidden environmental framing for a failure that surfaced under concurrent load.
    The body dismisses the live stall as "an environmental factor, not a plugin hang" and "podman saturation from concurrent sessions … the podman-saturation stalls clear when the concurrent load drops." This is exactly the forbidden "flake / transient / environmental" framing (R1) and the concurrency-mandate cheat (B14): a failure surfaced UNDER LOAD is answered with an environmental dismissal rather than a root-cause fix or a route to a NAMED thematic batch. The author must either fix the podman-saturation stall in-tree or route it to a named batch cutover — not park it as environmental.

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.

View action run

@github-actions

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: 7e58d1cd07d8 (branch: fix/plugin-invoke-timeout)

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

  1. A1/A2 — runtime change lacks the required fresh-rebuild bed run with pasted output; the body explicitly defers it.
    This is a runtime/code change to the core broker invoke path. The A2 gate requires a FRESH-rebuild bed run with pasted output, a named disposable: true target, and confirmation the CHANGED code path executed live. The CURRENT body states the attribution tier is "analysed on a live system (hang traced live; unit test proves the broker guard; bed re-run under cleared load pending)" — the bed re-run is still pending. That is a promise of future work ("will test"), which A1 explicitly blocks, and the changed InvokeProvider path has not executed live against a fresh rebuild. The author must complete the bed re-run (naming the disposable target) and paste output showing the bounded call failing fast at ZERO warnings.

  2. R1/B14 — forbidden environmental framing for a failure that surfaced under concurrent load.
    The CURRENT body dismisses the live stall as "an environmental factor, not a plugin hang" and "podman saturation from concurrent sessions … the podman-saturation stalls clear when the concurrent load drops." This is exactly the forbidden "flake / transient / environmental" framing (R1) and the concurrency-mandate cheat (B14): a failure surfaced UNDER LOAD is answered with an environmental dismissal rather than a root-cause fix or a route to a NAMED thematic batch. The author must either fix the podman-saturation stall in-tree or route it to a named batch cutover — not park it as environmental.

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.

View action run

@github-actions

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: 7e58d1cd07d8 (branch: fix/plugin-invoke-timeout)

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

  1. A1/A2 — runtime change lacks the required fresh-rebuild bed run with pasted output; the body explicitly defers it.
    This is a runtime/code change to the core broker invoke path (charly/plugin_dispatch_reverse.go). The A2 gate requires a FRESH-rebuild bed run with pasted output, a named disposable: true target, and confirmation the CHANGED InvokeProvider path executed live. The CURRENT body states the attribution tier is "analysed on a live system (stall root-caused to the unbounded engine command, fixed in sdk#190; unit test proves the broker guard; bed re-run pending)" and the verification gate is "unit test (deterministic) + live bed re-run" — the bed re-run is still pending. That is a promise of future work ("will test"), which A1 explicitly blocks, and the changed InvokeProvider path has not executed live against a fresh rebuild. The author must complete the bed re-run (naming the disposable target) and paste output showing the bounded call failing fast at ZERO warnings.

    Note: the unit test is a proper regression guard (it would hang/fail without the fix), and the prior reviewers' second finding (R1/B14 environmental framing) is now RESOLVED in the current body — the live stall is root-caused to the unbounded engine command and routed to the named fix sdk#190, not parked as environmental. That finding does not survive re-derivation. But the A1/A2 bed-gate finding survives against the CURRENT body.

Verdict: BLOCK


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: 2d743a863aca (branch: fix/plugin-invoke-timeout)

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

  1. A1/A2 — runtime change lacks the required fresh-rebuild bed run with pasted output; the body explicitly defers it.
    This is a runtime/code change to the core broker invoke path (charly/plugin_dispatch_reverse.go). The A2 gate requires a FRESH-rebuild bed run with pasted output, a named disposable: true target, and confirmation the CHANGED InvokeProvider path executed live. The CURRENT body states the verification gate is "unit test (deterministic) + live bed re-run" and the attribution tier is "analysed on a live system (… unit test proves the broker guard; bed re-run pending)" — the bed re-run is still pending. That is a promise of future work ("will test"), which A1 explicitly blocks, and the changed InvokeProvider path has not executed live against a fresh rebuild. The author must complete the bed re-run (naming the disposable target) and paste output showing the bounded call failing fast at ZERO warnings.

    Note: the unit test is a proper regression guard (it would hang/fail without the fix), and the prior reviewers' R1/B14 environmental-framing finding is now RESOLVED in the current body — the live stall is root-caused to the unbounded engine command and routed to the named fix sdk#190, not parked as environmental. That finding does not survive re-derivation. But the A1/A2 bed-gate finding survives against the CURRENT body.

Verdict: BLOCK


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: 2d743a863aca (branch: fix/plugin-invoke-timeout)

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:

  • 5467359918, 5467461423, 5467472705, 5467504356, 5467680733 — all raised the A1/A2 bed-gate finding (bed re-run pending) and/or the R1/B14 environmental-framing finding. Both are stale-superseded against the CURRENT authoritative body: the body now includes the full check-punktfunk-pod (disposable: true) R10 bed run with pasted output (13 steps PASS, check-live-rebuild 37 PASS / 0 FAIL, errors 0 / warnings 0), and the cleanup stall is root-caused to the unbounded engine command and routed to the named fix opencharly/sdk#191 — not parked as environmental.

The diff adds a deadline guard to executorReverseServer.InvokeProvider (reusing the existing defaultPluginInvokeTimeout, only when the caller supplied no deadline) plus a deterministic regression test with a negative control. The body accounts for both files, names the disposable target, confirms the fresh rebuild on the committed tree, confirms the changed InvokeProvider path executed live on the bed, and honestly states the live run did not show a timeout firing (nothing hung) while the bound's engaging is proved by the negative control. Attribution tier fully tested and validated is justified. Assisted-by footer present in the exact required form.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) August 30, 2026 08:44
@github-actions

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: 33eae7b02277 (branch: fix/plugin-invoke-timeout)

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:

  • 5467359918, 5467461423, 5467472705, 5467504356, 5467680733 — raised the A1/A2 bed-gate finding (bed re-run pending) and/or the R1/B14 environmental-framing finding. Both are stale-superseded against the CURRENT authoritative body: the body now includes the full check-punktfunk-pod (disposable: true) R10 bed run with pasted output (13 steps PASS, check-live-rebuild 37 PASS / 0 FAIL, errors 0 / warnings 0), and the cleanup stall is root-caused to the unbounded engine command and routed to the named fix opencharly/sdk#191 — not parked as environmental.
  • 5467701879 — PASS; consistent with my independent re-derivation.

The diff adds a deadline guard to executorReverseServer.InvokeProvider (reusing the existing defaultPluginInvokeTimeout, only when the caller supplied no deadline) plus a deterministic regression test with a negative control. The body accounts for both files, names the disposable target, confirms the fresh rebuild on the committed tree, confirms the changed InvokeProvider path executed live on the bed, and honestly states the live run did not show a timeout firing (nothing hung) while the bound's engaging is proved by the negative control. Attribution tier fully tested and validated is justified. Assisted-by footer present in the exact required form.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: 738c4ded7dd3 (branch: fix/plugin-invoke-timeout)

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:

  • 5467359918, 5467461423, 5467472705, 5467504356, 5467680733 — raised the A1/A2 bed-gate finding (bed re-run pending) and/or the R1/B14 environmental-framing finding. Both are stale-superseded against the CURRENT authoritative body: the body now includes the full check-punktfunk-pod (disposable: true) R10 bed run with pasted output (13 steps PASS, check-live-rebuild 37 PASS / 0 FAIL, errors 0 / warnings 0), and the cleanup stall is root-caused to the unbounded engine command and routed to the named fix opencharly/sdk#191 — not parked as environmental.
  • 5467701879, 5467717858 — PASS; consistent with my independent re-derivation.

The diff adds a deadline guard to executorReverseServer.InvokeProvider (reusing the existing defaultPluginInvokeTimeout, applied only when the caller supplied no deadline) plus a deterministic regression test with a negative control. The body accounts for both files, names the disposable target, confirms the fresh rebuild on the committed tree, confirms the changed InvokeProvider path executed live on the bed, and honestly states the live run did not show a timeout firing (nothing hung) while the bound's engaging is proved by the negative control. Attribution tier fully tested and validated is justified. Assisted-by footer present in the exact required form.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot merged commit a663c87 into main Aug 30, 2026
3 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Aug 30, 2026
github-actions Bot pushed a commit that referenced this pull request Sep 15, 2026
)

* 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]>
@aitrawog
aitrawog deleted the feat/broker-invoke-timeout branch September 25, 2026 19:04
github-actions Bot pushed a commit that referenced this pull request Oct 21, 2026
… 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant