0248. Async model port and per-call deadlines
- Status: Accepted (maintainer, 2026-11-15; implementation held until M14)
- Date: 2026-11-15
- Plan: HTTP transport plan (PR8; held until M14)
- Review: Verdict in brief
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
- Keep synchronous
call_modeland buffered subprocesses: simple migration, but model waiting blocks and incremental events cannot reach the runner. - Use callbacks into Harness: can deliver chunks promptly, but
complicates ownership and the value-shaped
step(state, event)model. - Impose a fixed total timeout: bounds calls, but cuts off legitimate long streams; callers can instead specify a total deadline and budget.
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.