On this page

0248. Async model port and per-call deadlines

Context

ADR-0010 intends model waiting to be I/O on one event loop. Today ModelPort.call_model is synchronous and curl subprocesses buffer the response; this violates that waiting-on-model-I/O intent. ADR-0122 records separate density target deviations, not evidence that asynchronous model I/O is implemented.

Decision

Amend ADR-0010 to name the libcurl multi reactor proposed in ADR-0247 as the model I/O event loop. Change ModelPort to start/poll: a pull-based state/event loop receives incremental ModelChunk events as providers decode transport Head, Data and End chunks. No callbacks into Harness code are required.

Library defaults are a 10 s connect timeout, 60 s idle timeout between body bytes, and no total timeout. Calls can override these and max_bytes, including an optional total_ms, via transport Limits; the runtime has no fixed default total timeout. Explicit cancellation or budget exhaustion cancels and releases the in-flight transport. Retain the synchronous round_trip adapter for migration; it is blocking, not a nonblocking implementation.

Alternatives considered

Consequences

Incremental provider decoding and cancellation require coordinated changes to the runner, providers and transport. Implementation is held until M14 approval: PR8 depends on the held platform and interpreter-helper work (PR4–5) and agent migration (PR7), with their prerequisites. This proposal does not claim these changes have shipped or that agent density has been measured or improved.