Commit Graph

15 Commits

Author SHA1 Message Date
Devin AI c283d884cf fix(agent-proxy): reconnect with events.list backfill so long sessions don't cut off
The Anthropic Managed-Agents SSE stream (`/v1/sessions/{id}/events/stream`)
is not guaranteed to stay open for the life of a multi-turn session.
Inter-turn gaps (e.g. while MCP tools or the next model request run) of
~25s+ are common and can trigger upstream / proxy read timeouts; when
that happens, the SDK's `for await` iterator just ends and the proxy
silently closed the downstream response, leaving the browser with only
the events from the first tool batch.

Implement the official 'consolidation' pattern: treat any upstream
end-of-stream that isn't a terminal `session.status_*` as a transient
drop, fetch what we missed via `sessions.events.list()` (deduped by
event.id), reopen the live stream, and keep going — up to a 20 minute
wall-clock budget so a wedged session can't pin the function forever.

Also switch the wire format from inline-markdown-with-status-comments to
NDJSON, so the React side can render in-flight tool activity in a
separate status banner from the streaming brief. The existing zero-width
heartbeat is replaced by an explicit `{"type":"heartbeat"}` line.

Drop the `agent.tool_use` write-tool special case — the agent now
streams the brief directly via `agent.message` text blocks.

Co-Authored-By: alex <alex@semipublic.co>
2026-05-13 03:20:15 +00:00
alex d256ffb487 heartbeat added 2026-05-12 22:39:36 -04:00
alex 1a93c9246f Streaming updates 2026-05-12 22:29:25 -04:00
alex d1fd7fbe61 Env vars updated 2026-05-12 22:17:22 -04:00
alex 822944958f Managed agents endpoints addition 2026-05-12 22:10:33 -04:00
alex 09b1021d63 token change 2 2026-05-12 21:56:51 -04:00
alex 82c0fb096e token change 2026-05-12 21:54:15 -04:00
alex 450b6eff61 BG change 2026-05-12 21:49:31 -04:00
alex 8dbc8e78d8 Agent fix 2026-05-12 21:36:24 -04:00
alex 70cd0d6015 CSV fix again 2026-05-11 23:34:57 -04:00
alex aa8a2b9475 CSV fix 2026-05-11 23:28:15 -04:00
alex a9873b5634 CSV handling 2026-05-11 23:21:45 -04:00
alex 5de3955a3f Revert "Invoke file ID"
This reverts commit c8ca68f13b.
2026-05-11 23:14:06 -04:00
alex c8ca68f13b Invoke file ID 2026-05-11 23:07:30 -04:00
alex ea05c521c3 Initial 2026-05-11 22:27:54 -04:00