fix(script-runner): #999 K-5 script-worker frames are cut at the frame cap; one oversized evaluation fails alone instead of killing the worker

This commit is contained in:
Joseph Doherty
2026-12-03 10:56:40 -05:00
parent c42eeb3c69
commit 8e91d6503d
6 changed files with 314 additions and 19 deletions
+8
View File
@@ -182,6 +182,14 @@ processes:
evaluation thread is busy is reported back as *deferred*, the host stops its clock, and restarts T and G when the worker
reports it *started* — so an item queued behind a runaway sibling is neither timed out nor struck, and at the kill it
is a victim (`script worker restarted`), not the culprit.
- **Frames never exceed the cap (#999 / review K-5).** The combining pipe writer merges consecutive evaluations /
results only up to the frame cap (4 MiB) and cuts a larger batch — merged or a single `EvalBatch` — into several frames,
in order; the worker's `ctx.Logger` drain is cut by bytes as well as lines (`LogBatch` per ≤ cap; a line too large for
any batch counts as dropped). One item too large for any frame fails **that evaluation alone** as `unsupported type: …
frame cap` — an oversized input set is refused before it is written (`ScriptWorkerFrameWriter.FitsOneFrame`), an
oversized result is replaced by that error in the worker. Before, any of these faulted the writer: the worker exited
(host side: was killed as a crash), every evaluation in flight on the shard published `BadResourceUnavailable`, and a
script logging megabytes in one 100 ms window repeated that until it was quarantined.
- **Scripted alarms** (only when `Scripting:Runner:Seams` lists `ScriptedAlarm`). The engine compiles each predicate at
load only to validate it (same Roslyn, sandbox and diagnostics, so a broken predicate still fails the load; no
assembly is loaded into the host), the worker compiles and runs it, and each re-evaluation pass submits its dirty set