feat(drivers): execution deadline for legacy Lua entrypoints - #843
feat(drivers): execution deadline for legacy Lua entrypoints#843Sanjin-Maker wants to merge 1 commit into
Conversation
Only signed control-v2 drivers had lifecycle deadlines; a legacy driver spinning in driver_poll or driver_command wedged its goroutine forever (all 38 bundled drivers are v1). Bound poll/command/default/cleanup at a configurable command_timeout_s (default 10 s, 0 = legacy unbounded); driver_init stays unbounded for legacy drivers. A deadline abort is a normal driver failure — restart and autonomous default mode. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Sanjin Naidu <sanjin@sanrowconsulting.com>
4981652 to
401ac52
Compare
miravoss26
left a comment
There was a problem hiding this comment.
Extends the existing control-v2 lifecycle-deadline mechanism to legacy (v1) Lua drivers: driver_poll/driver_command/driver_default_mode/driver_cleanup now run under a configurable execution deadline (default 10s, command_timeout_s: 0 opts back out), where previously only signed control-v2 drivers were bounded — all 38 bundled drivers are v1, so this was a real gap.
- Correctness:
setExecContextcleanly branches control-v2 (host-policy deadline, unchanged) vs legacy (operator-configurableExecTimeout, 0 = unbounded).driver_initstays deliberately unbounded — reasonable, slow discovery at startup isn't a wedge. - Test coverage is thorough: spinning poll/command/default-mode all verified to abort at the deadline, and
TestLegacyDriverRecoversAfterTimeoutproves the LState stays usable for the next call after an abort — the sharpest way this kind of change breaks silently. - Reasonable rollout risk note in the PR body (behavior change for all legacy drivers, generously gated default, recommends a beta-channel soak) — worth a human call on whether that soak happens before merge.
- No secrets, no new deps, no authz/network surface.
⚠️ Same as #841/#842: GitHub reportsCONFLICTINGagainstmaster, no CI check runs shown yet.
Safe to merge from my read once rebased and green; the beta-soak decision is a human call given it changes behavior for every legacy driver in the fleet.
|
Blocking findings from a fresh review of the #841-#843 stack:
Please treat #841-#843 as one safety change and add a test that covers a blocking or partial legacy write, the default transition, and the final hardware command order. The narrow legacy-driver and config tests pass, but they do not prove that recovery path. |
|
Thank you @Sanjin-Maker for finding the legacy Lua liveness gap and testing a spinning VM. Current We are closing this version. Please start any follow-up as a written issue that scopes the remaining legacy-poll behavior on current |
Summary
setLifecycleContextno-ops otherwise), so a legacy driver spinning indriver_poll/driver_commandwedged its goroutine forever — and all 38 bundled drivers are v1.setExecContextboundsdriver_poll,driver_command,driver_default_modeanddriver_cleanupfor legacy drivers atLuaDriver.ExecTimeout, set from a new per-driver config knobcommand_timeout_s(unset → 10 s default; explicit0restores unbounded for slow-but-working devices). Control-v2 drivers keep their existing host-policy deadlines unchanged.driver_initis deliberately exempt for legacy drivers — slow discovery at startup is legitimate.driver_commandpreviously had no lifecycle context even for v2-adjacent paths; it now gets one.docs/writing-a-driver.md.Risk & rollout
Behavior change for all legacy drivers, gated generously: 10 s default is far above any sane poll, and
command_timeout_s: 0is a per-driver escape hatch. Recommend a beta-channel soak. TestTestLegacyDriverRecoversAfterTimeoutproves the LState stays usable after an abort (next poll succeeds).Verification
go test ./internal/drivers/ ./internal/config/ -count=1— newlua_exec_timeout_test.go: spinning poll/command/default all return at the deadline; recovery after abort;0installs no context.go build ./...,go vet. Patch changeset included.🤖 Generated with Claude Code