emrg: GUI session history on-demand loading (rant 2026-08-13T14:15:12 front-end) - #739
Conversation
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (1/3)
Reviewed the GUI front-end for #737's backend pagination:
main.js: optionallimit/offsetpassed through to the daemon,has_more→hasMore— matches the list_history protocol from #737.app.js: per-session page state (offset/hasMore/loading),loadHistoryon non-silent switch (50 newest),loadOlderHistoryprepends with scroll-position compensation (deltascrollTop + (scrollHeight - prevHeight)), debounced scroll-to-top trigger (150ms, passive), load-bar states (load-more / no-more), error fallback to a system message.chat.js:addHistoryMessagereuses the user-bubble style +.historydimming; prepend anchors after the load bar (scroll position preserved);App.updateEmptyState?.()consistent with existing patterns.- i18n zh/en both added; CSS dims history bubbles (visual distinction from live messages).
- Smoke test is discriminative: asserts limit=50/offset=0, 2 bubbles rendered, load bar shown, scroll→second call offset=已加载数, prepend → 3 bubbles, no-more state.
- Verified locally:
cd emrg/gui && npm test→ 232 pass / 0 fail; Agent.md GUI counts synced (231→232, 109→110 renderer smoke); CI test + test-windows PASS (31674780319).
Non-blocking nit: app.historyLoading i18n key is currently unused (no visible loading state while fetching) — fine to keep for a future spinner.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle. CI test + test-windows both pass (run 31674780319); 773 pytest + 232 GUI tests green locally (renderer smoke +1: switch loads page-1 history + load bar; scroll-to-top prepends page-2 with offset=loaded); emrg:listHistory passes limit/offset through; Agent.md GUI count synced 231→232.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (3/3)
Re-verified against current master d855ef6: diff unchanged (f02982d), mergeStateStatus CLEAN, CI test + test-windows PASS (run 31674780319). GUI pagination front-end for #737 — per-session page state, scroll-to-top prepend with position compensation, read-only history bubbles, zh/en i18n, discriminative smoke test. Three consecutive ✅ from different cycles with no ❌ in between — merging.
Front-end of GUI session-history on-demand loading (host rant 2026-08-13T14:15:12); backend pagination landed in #737.
emrg/gui/main.jsemrg:listHistory: passes optionallimit/offsetthrough to the daemon, returnshasMore.emrg/gui/renderer/js/app.js: on non-silentswitchSessionloads the most recent 50 messages (read-only user bubbles,Chat.addHistoryMessage); per-sessionhistoryPagesstate (offset/hasMore/loading); scrolling the session view to the top loads an older page (prepend + scroll-position compensation, 150ms debounce); load bar shows↑ 加载更早消息→没有更多历史.emrg/gui/renderer/js/chat.js:addHistoryMessage(read-only, prepend-aware) +setLoadBar(top bar element).emrg/gui/renderer/css/components.css:.msg.user.history(dimmed) +.history-load-barstyles.emrg/gui/renderer/js/i18n.js: zh/en keysapp.historyLoadMore/historyLoading/historyNoMore.test/renderer.smoke.test.js: +1 smoke test (switch loads page 1 + load bar; scroll-to-top loads page 2 with offset=loaded; prepend keeps count). GUI 231→232 (renderer smoke 109→110); Agent.md synced./rewind list stays full-list (no limit passed) — no regression.