Problem
Several host-side waits and polling loops use raw setInterval / setTimeout without a shared cancellation contract. This makes timeout, shutdown, and future interruption behavior harder to reason about, especially around renderer waits, idle polling, and run-completion observation.
Known areas to inspect:
src/host/hostMain.ts idle-timeout polling.
src/host/hostMain.ts wait/render polling flows.
src/host/runCompletionSentinel.ts polling and completion observation.
- RPC paths that wait on host/renderer work.
Context
The resource-cleanup refactor in #83 introduces a small ResourceScope helper for deterministic release. Cancellation work should integrate with that release model rather than adding parallel ad hoc cleanup paths.
Out of scope
- Adopting Effect or another async runtime.
- Rewriting CLI error handling.
- Changing public JSON envelopes or protocol schemas.
- Reworking OS signal handling unless required for the minimal
AbortSignal path.
Acceptance criteria
- Relevant host wait/poll operations accept or derive an
AbortSignal.
- Aborted operations release registered resources and timers deterministically.
- Non-aborted callers retain current behavior.
- Add at least one targeted test proving abort behavior for a host wait or polling path.
- Full CI passes.
Generated with mux • Model: anthropic:claude-opus-4-7 • Thinking: max
Problem
Several host-side waits and polling loops use raw
setInterval/setTimeoutwithout a shared cancellation contract. This makes timeout, shutdown, and future interruption behavior harder to reason about, especially around renderer waits, idle polling, and run-completion observation.Known areas to inspect:
src/host/hostMain.tsidle-timeout polling.src/host/hostMain.tswait/render polling flows.src/host/runCompletionSentinel.tspolling and completion observation.Context
The resource-cleanup refactor in #83 introduces a small
ResourceScopehelper for deterministic release. Cancellation work should integrate with that release model rather than adding parallel ad hoc cleanup paths.Out of scope
AbortSignalpath.Acceptance criteria
AbortSignal.Generated with
mux• Model:anthropic:claude-opus-4-7• Thinking:max