What and why?
Harness.invoke() and listModels() only expose timeoutMs. A caller cannot cancel a run when the user aborts a turn, replaces a request, or asks to stop current work. Waiting for the fixed timeout or searching the global process table loses process ownership and risks terminating unrelated work.
Possible approach
Add signal?: AbortSignal to InvokeOptions and ListModelsOptions, pass it into the shared execution path, and define a consistent abort result distinct from timedOut. Cancellation should use the same process-tree cleanup contract as timeout handling and should settle within a documented bound.
Add tests for an already-aborted signal, cancellation during execution, and cancellation after completion.
What and why?
Harness.invoke()andlistModels()only exposetimeoutMs. A caller cannot cancel a run when the user aborts a turn, replaces a request, or asks to stop current work. Waiting for the fixed timeout or searching the global process table loses process ownership and risks terminating unrelated work.Possible approach
Add
signal?: AbortSignaltoInvokeOptionsandListModelsOptions, pass it into the shared execution path, and define a consistent abort result distinct fromtimedOut. Cancellation should use the same process-tree cleanup contract as timeout handling and should settle within a documented bound.Add tests for an already-aborted signal, cancellation during execution, and cancellation after completion.