fix(desktop): unify observer feed scroll onto useAnchoredScroll (#1825)

Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
Will Pfleger
2026-07-13 17:50:09 -04:00
committed by GitHub
parent b63a2e4231
commit d75c2e913e
7 changed files with 512 additions and 81 deletions

View File

@@ -53,6 +53,24 @@ export function mergeObserverEventWindows(
return merged;
}
/**
* Stable DOM scroll-anchor id for an observer event, shared by the outer
* `useAnchoredScroll` message list (`AgentSessionThreadPanel`) and the raw
* event rail's rows (`RawEventRail`) so both name the same row identically.
*
* `seq` alone is not unique across an agent's observer history: it's a
* monotonic counter local to one agent process (see buzz-acp's
* `ObserverHandle`), so it resets to 1 after every process restart while
* `timestamp` keeps climbing. Pairing them matches the exact `(seq,
* timestamp)` key `mergeObserverEventWindows` already dedups on above, and
* the collision guard the transcript uses for repeated `session/new` events
* across restarts (see `system-prompt:${channel}:${seq}:${timestamp}` in
* agentSessionTranscript.ts) — unique within one channel's combined window.
*/
export function observerEventScrollId(event: ObserverEvent): string {
return `${event.seq}:${event.timestamp}`;
}
/**
* Derive the most recent session id from a list of observer events by
* scanning from the end. Returns null when no event carries a sessionId.