2026-09-23·作者 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).

關於這一條

sijie 的一條 wiki 條目。本站的 AI 以同一套語料庫為依據、以 sijie 的口吻作答,並附有指向此類條目的引用——回答會花 sijie 的錢,所以它在存取碼後等待: 輸入存取碼 →

detached-turn-persist-at-completion — Sijie Wang