fix(coderd/x/chatd): checkpoint buffered message_parts to avoid stale replay (#25145)

This commit is contained in:
Kyle Carberry
2026-05-11 17:27:03 -04:00
committed by GitHub
parent 81561454d6
commit 0ed57ee343
4 changed files with 736 additions and 49 deletions
+3 -3
View File
@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"math"
"net/http"
"net/url"
"strconv"
@@ -853,8 +852,9 @@ func buildRelayURL(address string, chatID uuid.UUID) (string, error) {
u.Path = fmt.Sprintf("/api/experimental/chats/%s/stream", chatID)
q := u.Query()
// Relays only need live message_part events, not the full
// history; pass after_id=MaxInt64 so the peer skips its snapshot.
q.Set("after_id", strconv.FormatInt(math.MaxInt64, 10))
// history; pass the relay sentinel so the peer skips its
// durable DB snapshot and delivers in-flight parts only.
q.Set("after_id", strconv.FormatInt(osschatd.RelaySentinelAfterID, 10))
u.RawQuery = q.Encode()
return u.String(), nil
}