Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues. Closest: [Bug]: Orphaned run holds session after one-shot client stream drop (stream_transport); no reclaim until manual session cancel #987 (orphaned run holds session after a stream drop) and [Bug] Approval callback failure promises cancellation but detaches, leaving resumed sessions blocked by the active run #854 (approval callback detach). Neither covers the read-ahead overflow that causes the drop reported here.
Version and environment (optional)
Astra CLI 0.2.13, macOS 15 arm64, hosted Server + local Edge (transport=edge_ledger), model kimi-k3 for the affected run, TUI (prompt surface). Source references below are against main.
Actual behavior
A long turn (33m50s, ≥86k tokens context, 67 LLM rounds) died mid-flight with:
✖ Error · ✗ [stream_transport] Error: SSE control read-ahead exceeded 1048576 bytes while Edge work was running
The client recorded it as an interruption (session c0538fda-…, turn 11):
{"type":"interruption_recorded","ts":"2026-11-04T11:03:26.651865+00:00","turn":11,"agentic_step":1,
"user_input":"interruption: stream_transport (resumable=true)",
"metadata":{"interruption":{"error_detail":"Error: SSE control read-ahead exceeded 1048576 bytes while Edge work was running",
"has_checkpoint":false,"kind":"stream_transport","resumable":true,
"resume_action":"continue_immediately","resume_mode":"continue",
"tool_calls_completed":0,"turns_completed":0,
"user_message":"The model response connection failed. Continue this session to resume."}}}After that, the session was unusable. Four consecutive messages were rejected:
✖ Error · Another run still owns this session
Your message was not sent; the draft is back in the composer.
Wait for it to finish, or stop it with `astra session cancel c0538fda-…`, then run
`astra --resume c0538fda-…` before sending another message.
No model or tool ran.
Meanwhile the server-side run kept executing with no client attached — run 93f034ae-… emitted durable step events from 10:29:36Z (turn 11, step 1) through 11:11:38Z (turn 11, step 66, round 7), ending with a turn_evaluation for that run at 11:11:38Z, i.e. ~8 minutes of tool/LLM work after the client had already recorded the interruption. astra session show still reports status: active, ended_at: null, updated_at frozen at 2026-11-04T11:11:40 (re-checked at 11:20:03Z). Only a manual cancel frees the session.
A second, smaller symptom in the same incident (different session): an approval settle returned 409, surfaced as a fatal user-facing error:
✖ Error · ✗ [invalid_request] Astra could not settle the approval callback because the callback endpoint
returned an HTTP error. … Details: request failed (409): Approval response was recorded, but newer user
guidance at event 32 superseded it
error_code: run_interaction_superseded
and every tool call in that round was then rejected: Newer user guidance superseded this pending action; the tool was not executed. (cidcedfb07f, 4 × tool_call_error).
Root cause (code, main)
crates/astra-turn-core/src/sse/stream_host.rs
MAX_EDGE_EXECUTION_READ_AHEAD_BYTES = 1024 * 1024(:55), fed inEDGE_EXECUTION_READ_AHEAD_FEED_BYTES = 64 * 1024chunks (:58).EdgeExecutionReadAhead::push_feedreturnsErr("SSE control read-ahead exceeded …")whenqueued_bytes + framing.len() + live_gap_bytes + bytes.len()exceeds the cap (:96-107);ensure_boundedapplies the same check after every queued block (:149-166).- In
consume_sse_stream_cancellable, thatErris promoted to a fatal abort:abort = Some(ErrorKind::StreamTransport), the Edge tool cancel token is cancelled, and the loop breaks (:1056-1066). The turn is discarded — no partial reply, no replay of the already-queued frames. - The lane already knows how to degrade: replaceable live observations are collapsed into
live_gaps(record_live_gap_if_only_live, bounded byMAX_EDGE_EXECUTION_LIVE_GAP_KEYS/_BYTES). But ordered blocks (agent_live_event, lifecycle, tool results) accumulate to the hard cap instead of degrading. - The behavior is currently encoded as intended: the existing test
ordered_live_read_ahead_overflow_cancels_running_edge_tool(:4691) drives overflow with 300 × 4 KiBagent_live_eventframes and assertsabort == Some(StreamTransport). That means ordinary, chatty control traffic during a single Edge execution window deterministically kills a long turn.
I have not isolated which specific frames filled the lane in this incident (child-agent live events vs. large tool-result/lifecycle frames vs. durable replay of an 86k-token transcript), so the trigger is a hypothesis; the fatal-abort-on-cap behavior itself is confirmed from code and from the recorded interruption.
Expected behavior
- A defensive memory bound should not be able to fail a long-running turn. On cap pressure, prefer: drop/collapse replaceable live observations (already implemented for gaps), keep ordered lifecycle facts, and apply backpressure/replay — rather than aborting the whole run.
- If an abort is unavoidable, it should carry its own stable
error_code(e.g.stream_read_ahead_overflow) instead of genericstream_transport, so the client can distinguish it and resume deterministically. - The cap should account for legitimate traffic volume during one Edge window (child-agent live events can easily exceed 1 MiB over a long turn), or be configurable.
- When the client stream detaches, the server should settle/cancel the in-flight run so the session is immediately reusable — this is [Bug]: Orphaned run holds session after one-shot client stream drop (stream_transport); no reclaim until manual session cancel #987; here the orphaned run is a consequence of the read-ahead abort, and it outlived the client by 8+ minutes while all new user input was rejected.
- For the
409 run_interaction_supersededsettle path, the TUI should auto-recover (the text is durable and newer guidance already superseded the approval) instead of surfacing a fatal[invalid_request]and leaving the round with every tool call rejected — same class as the uncoded-409 gap described in TUI hits two uncoded run-lifecycle 409s: 'completed' guidance rejection and stale-guard new-run rejection #884.
Steps to reproduce
- Astra TUI against a hosted Server with local Edge tool execution.
- Run a long multi-round turn whose control traffic during a single Edge execution window exceeds 1 MiB (e.g. child-agent
agent_live_eventframes, or a large tool-result/lifecycle burst). - The turn aborts with
SSE control read-ahead exceeded 1048576 bytes while Edge work was running; the reply is lost andtool_calls_completed: 0. - Send any further message to that session →
Another run still owns this session, repeatedly, each run reportingNo model or tool ran. astra session show <id>→status: active,ended_at: null,updated_atfrozen, while durable step events keep appearing server-side.- Only
astra session cancel <id>(thenastra --resume <id>) restores the session.
Additional information
Timeline (UTC), session c0538fda-13d1-44da-ab75-38d8306d3735:
| time | event |
|---|---|
| 10:29:36 | run 93f034ae-… starts, turn 11 step 1 |
| 11:03:26 | client records interruption_recorded / stream_transport read-ahead overflow (tool_calls_completed: 0, has_checkpoint: false) |
| 11:03:26 → 11:11:38 | server keeps emitting durable steps for the same run (through turn 11 step 66, round 7, 35 more LLM/tool events) |
| 11:03:26 → 11:15 | 4 user messages rejected: Another run still owns this session |
| 11:11:38 | turn_evaluation recorded for run 93f034ae-… |
| 11:20:03 | astra session show → status: active, ended_at: null, updated_at: 11:11:40 |
The session also accumulated 13 approval_timeout and 22 tool_call_error events over its lifetime, which may be relevant to how much ordered control traffic one Edge window had to absorb.
Activity
guolvlin-cn commentedon Nov 5, 2026
Recurrence on the same session — and the overflow path is still live on
mainSame machine, same CLI (
astra 0.2.13, macOS 15 arm64, hosted Server + local Edge). After the11:03:26Zinterruption described above, the same sessionc0538fda-…hit the identical abort again, roughly two hours later, in the middle of an unrelated long turn (53m12s, ≥189.1k tokens context, 85 tool calls):Evidence from the local session transcript
~/.astra/sessions/…/sessions/c0538fda-….jsonl:turn_error2026-11-04T11:03:26turn_error2026-11-04T12:53:36The literal string
read-ahead exceededoccurs exactly twice in that file, matching those twoturn_errorrecords one-to-one.Largest single
turnrecords in the same file — i.e. the ordered blocks that accumulate inside one Edge window, all individually well under the 1 MiB cap:12:07:3112:10:1112:15:2412:20:32So the overflow is reached by cumulative ordered blocks in a single Edge execution window, not only by one oversized frame.
Verification against
main(fetched today)crates/astra-turn-core/src/sse/stream_host.rs(224,030 bytes) is unchanged in the relevant places::55const MAX_EDGE_EXECUTION_READ_AHEAD_BYTES: usize = 1024 * 1024;:58const EDGE_EXECUTION_READ_AHEAD_FEED_BYTES: usize = 64 * 1024;:94-107push_feedcomparesqueued_bytes + framing.len() + live_gap_bytes + bytes.len()against the cap and returnsErr("SSE control read-ahead exceeded …"):158-162the same comparison inensure_bounded:770,:794,:802,:821,:905,:930,:938still promote transport errors toabort = Some(ErrorKind::StreamTransport):4691ordered_live_read_ahead_overflow_cancels_running_edge_toolstill asserts that 300 × 4 KiBagent_live_eventframes cancel a running Edge tool:2844read_ahead_overflow_cannot_accept_a_probe_only_failed_terminalcovers the single-oversized-frame caseSo this is not fixed as of today, and the current test suite still encodes the abort as the expected behavior.
Repeated consequences
interruption_recorded(stream_transport,resumable=true), so the work is not lost but is also not visible.Another run still owns this session; recovery needs a manualastra session cancel+astra --resume.409 run_interaction_superseded("Approval response was recorded, but newer user guidance at event 32 superseded it"), and every tool call in that round is then rejected withNewer user guidance superseded this pending action.Suggested direction (non-binding)
The lane already degrades replaceable live observations into
live_gaps, but ordered blocks (agent_live_event, lifecycle, tool results) accumulate to a hard cap and then kill the turn. Two options, not mutually exclusive:abort = Some(StreamTransport);Either way the
:4691expectation has to change with it.