Skip to content

Thread AbortSignal through host waits and polling paths #84

@ThomasK33

Description

@ThomasK33

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvementready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions