fix(core): preserve queue after provider failure

This commit is contained in:
Kit Langton 2026-06-22 19:07:13 -04:00
commit 24c672e89e
5 changed files with 51 additions and 3 deletions

View file

@ -163,6 +163,8 @@ A process-global `SessionRunCoordinator` serializes execution for each local Ses
Inbox promotion coalesces pending steers in durable admission order. Once continuation would otherwise end, it promotes one queued input at a time in FIFO order. Add explicit inbox backlog and steering-batch limits before exposing broad multi-caller admission or untrusted queue growth.
A durably projected terminal provider failure stops the current drain without promoting pending steering or queued input. The failure remains visible in Session history, and explicit `run` may later promote the preserved inbox work. Raw stream failures, tool execution failures, and interruption already stop through their Effect failure or interruption paths.
Eager local-tool execution is intentionally unbounded in the current local slice. This minimizes tool latency but does not increase SQLite settlement throughput: Session-event publication remains serialized per provider turn. Before broadening exposure, revisit per-turn call limits, output truncation, and operational backpressure using observed workloads. The `session.next.*` event schemas remain experimental and unshipped; databases created by earlier experimental builds are disposable rather than compatibility targets.
The synchronized `session.next.*` event family and projected Session-message model predate this branch. This slice refines their replay contract: projected Session messages retain their source aggregate sequence so canonical context ordering and `sessions.messages(...)` pagination follow durable event order even when caller-supplied IDs or timestamps do not. Consumers can use `sessions.events({ sessionID, after? })` to replay durable `session.next.*` events after an aggregate sequence cursor, then tail durable events without a race. Live-only text, reasoning, and tool-input fragments remain available through EventV2 subscriptions for connected renderers; they are intentionally absent from the replayable Session stream.