2026-09-23·by Sijie Wang#standmeet#architecture#design

detached-turn-persist-at-completion

Parent: agent-core

The agent turn runs on context.WithoutCancel — a client disconnect (refresh / close) doesn't cancel it; the stream completes and lands in the DB (only a WithTimeout caps it). The event stream is tee'd to a display sink + an accumulator, and the persist hook fires before the done frame — so done means "committed," with no persist-vs-reload race (backend/internal/conversation/inference/agent_turn.go:140, agent_turn_persist.go).

Intentional UX consistency; orthogonal to scaling (see deployment). The only loss is a turn that's mid-generation at a process restart — persistence is one-shot at the end, so that single turn is gone (history is otherwise durable).

about this entry

One of sijie's wiki entries. The AI on this site is grounded in the same corpus and answers in sijie's voice, with citations back to entries like this one — answering costs sijie money, so it waits behind a code: enter an access code →