Merge branch 'sidecars-claude' into sidecars
This commit is contained in:
@@ -141,6 +141,20 @@ export function useChat(initialSessionId?: string, initialModel?: string | null,
|
||||
function handleMessage(data: unknown) {
|
||||
const msg = data as ServerMessage;
|
||||
|
||||
// Continuity check, before the cursor moves. The writer stamps every durable message with the cursor
|
||||
// of the one before it in the same session, so a mismatch against what we last saw means something is
|
||||
// missing — pruned by retention, or a write that failed. Surface it: a conversation that silently
|
||||
// skips a tool call or half an answer reads as the assistant having done something inexplicable.
|
||||
// Only checked once we actually hold a cursor; opening a session from history starts mid-chain by
|
||||
// design (events are swept after 7 days, the transcript itself is not).
|
||||
const prevSeq = (data as { prevSeq?: number }).prevSeq;
|
||||
if (typeof prevSeq === 'number' && cursorRef.current > 0 && prevSeq !== cursorRef.current) {
|
||||
setMessages((prev) => [
|
||||
...prev,
|
||||
{ role: 'error', text: '⚠️ Some output could not be recovered — part of this conversation is missing above.' },
|
||||
]);
|
||||
}
|
||||
|
||||
// Advance the resume cursor for any durable (seq-carrying) event.
|
||||
const seq = (data as { seq?: number }).seq;
|
||||
if (typeof seq === 'number' && seq > cursorRef.current) cursorRef.current = seq;
|
||||
|
||||
Reference in New Issue
Block a user