chat: preserve cross-client reconciliation work

This commit is contained in:
2026-10-18 21:45:56 +01:00
parent 5946f1abc8
commit 36d1c8ea7a
11 changed files with 213 additions and 35 deletions
+10 -8
View File
@@ -54,16 +54,18 @@ func handleChatPrompt(ctx context.Context, request protocol.Message, broker chat
// The user turn every *other* client sees, carrying the sender's label. The
// sender's own client appended it locally, so it is excluded below.
userFrame := protocol.ChatEventFrame{
SessionID: sessionID,
MessageID: hub.nextUserMessageID(),
Kind: protocol.ChatEventUser,
Part: &protocol.ChatPart{Type: protocol.ChatPartText, ID: "usr", Text: prompt.Text},
Client: sub.label,
SessionID: sessionID,
MessageID: hub.nextUserMessageID(),
Kind: protocol.ChatEventUser,
Part: &protocol.ChatPart{Type: protocol.ChatPartText, ID: "usr", Text: prompt.Text},
Client: sub.label,
OperationID: prompt.OperationID,
}
queued, refused := hub.submitPrompt(sessionID, &chatQueuedPrompt{
text: prompt.Text,
requestID: request.ID,
write: write,
text: prompt.Text,
operationID: prompt.OperationID,
requestID: request.ID,
write: write,
})
if refused {
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "session " + sessionID + " already has the maximum number of prompts queued"})