You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 884ed9b
Browse filesBrowse the repository at this point in the historyBrowse files
fix(observer): eager archive hydration on panel open + 200-frame pages
On panel open the Activity feed showed only the live in-memory window
(wiped on restart) because archived history requires manual scroll-up to
page in — 50 frames at a time. A single code-review turn emits ~900
frames, so reaching session start required 18 scroll gestures nobody
does, making archived history effectively invisible.
Two changes fix this:
A — eager initial hydration: add a hydration loop that fires automatically
when the panel mounts (or channel switches) and calls fetchOlderArchived
up to 10 pages = 2,000 frames before any user gesture. Reuses
fetchOlderArchived's existing lock/cursor/backfill-await machinery; no
parallel state machine. A new ps.initialHydrationDone flag (reset by
applyChannelReset on channel switch) prevents duplicate concurrent loops.
B — page size 50 → 200: observer frames are tiny; 50 was chat-message
tuning. 200 frames/page means the 10-page budget covers 2,000 frames,
more than enough for any single agent turn.
The scroll sentinel in AgentSessionThreadPanel already works correctly
(leave→enter gate, PRELOAD_MARGIN_PX=600) — scroll paging beyond the
initial budget continues unchanged.
Co-authored-by: Will Pfleger <[email protected]>
Signed-off-by: Will Pfleger <[email protected]>
// biome-ignore lint/correctness/useExhaustiveDependencies: ps is a stable ref; initialHydrationDone from ps is read inside the effect via ps.initialHydrationDone (not as a reactive dep) to avoid triggering re-runs; the effect re-runs on the deps that actually indicate a new hydration is needed
336
+
React.useEffect(()=>{
337
+
if(
338
+
!enabled||
339
+
!identityPubkey||
340
+
!hasSubscription||
341
+
!channelId||
342
+
ps.initialHydrationDone
343
+
){
344
+
return;
345
+
}
346
+
347
+
letcancelled=false;
348
+
// Mark running immediately to prevent concurrent hydration loops if
349
+
// fetchOlderArchived identity changes mid-run (it changes when hasOlderArchived
350
+
// flips). The loop completes asynchronously; cancelled handles cleanup.
0 commit comments