fix: recover session submissions and failed turn settlement

This commit is contained in:
amosblomqvist
2026-10-25 19:45:17 +02:00
parent b277ee3e0f
commit 7d65fa8754
21 changed files with 944 additions and 94 deletions
+4 -3
View File
@@ -5,8 +5,9 @@
* submitter too attaches here. One SSE stream per chat: a running turn →
* subscribe to the live turn object: FULL replay of the event log, then
* live chunks until settle ([DONE]). No running turn → the cheap terminal
* ({"type":"turn-settled"} + [DONE]): the record is current, the client
* refetches it.
* ({"type":"turn-settled"} + [DONE]): the client refetches the record.
* A retained settlement-failure notice precedes that terminal when a
* reply could not be saved before the submitter attached.
*
* 404 mirrors the POST handler's unknown-chat. Framework route is a thin
* wrapper over the server barrel (the import law); tests drive the seams
@@ -18,6 +19,6 @@ export async function GET(_req: Request, ctx: { params: Promise<{ id: string }>
const { id } = await ctx.params;
if (!getChat(id)) return Response.json({ error: "Unknown chat" }, { status: 404 });
const handle = runningTurn(id);
if (!handle) return settledTurnResponse();
if (!handle) return settledTurnResponse(id);
return piTurnResponse(handle);
}