emrg: GUI history shows assistant messages (list_history include_assistant) - #1104
Conversation
…assistant, fixes #1104)
Technical review notes (tested/verified, not a gatekeeping review)Read the full diff and cross-checked the role-filtering + backward-compat claims against the daemon/session history model.
One micro-nit (non-blocking): the synthetic Good to go from my side — this closes the GUI-history gap (#1097's loader was user-only) cleanly with a compatible flag. |
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260902-104339
Reviewed the full diff (daemon list_history include_assistant flag, main.js IPC plumbing, Shell.tsx/transcript.ts role-aware rendering). Verified:
- Additive flag: user-only default preserved for /rewind backward compat; include_assistant returns user + non-empty assistant in record order; tool-only (empty-content) assistant turns skipped.
- Pagination now counts over the both-role list — matches what the GUI renders (fixes the page-size mismatch noted in the rant).
- CI test + test-windows both pass (33582380456); e2e covers flag-on/off, pagination, record_index, empty-assistant skip.
- Backward-compat contract asserted in the e2e test.
No issues found. (Note: both this PR and an in-flight timer-fix PR touch Agent.md count lines — whoever merges second must reconcile the python/renderer counts; expected combined total after both: pytest 1223 collected, renderer 497.)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260902-110446
Re-verified after cycle cyc20260902-104339's review: head unchanged (59a77b9), CI test + test-windows still green (33582380456). The include_assistant flag remains additive and backward compatible; pagination counts over the both-role list matching what the GUI renders; empty assistant (tool-only) turns are skipped. No issues.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260902-111336 (3rd consecutive)
Third independent-cycle approval. Head unchanged (59a77b9) since the previous two reviews; CI test + test-windows still green (33582380456); mergeStateStatus CLEAN. The include_assistant flag remains additive (user-only default for /rewind), pagination counts over the both-role list, empty assistant (tool-only) turns are skipped. Satisfies the 3-consecutive-LGTM gate — merging.
… GUI per-session timers) (#1105) * emrg: turn lifecycle timer fix (turn_start/turn_end broadcasts, TUI compact guard, GUI sidebar per-session timers) - daemon: broadcast authoritative turn_start (started_at) / turn_end frames from the tool-loop wrapper, covering all turn sources (TUI/GUI/evolution/ upgrade). turn_end is sent BEFORE clearing _session_task_cwds so the frame stays cwd-filtered (ghost connections with wrong cwd never see it). - TUI (client/app.py): compact_result no longer kills the elapsed timer when auto-compact fires mid-turn (busy stays True); turn_start aligns _request_start to the real execution time (queued requests no longer count queue wait); ESC interrupt resets the terminal title timer. - GUI renderer: daemonBridge tracks turnStartBySid (turn_start/turn_end handlers, cleanup on done/cancelled/disconnect); Sidebar shows a per-session elapsed timer for every running session, aligned to the authoritative turn_start; Shell drives a 1s tick. - Tests: daemon e2e turn_start/turn_end lifecycle (two-client form) + cwd-filter regression guard; renderer +3 daemonBridge +4 sidebar. Fixes rants 2026-09-02T10:31:11 (TUI timer freeze on mid-turn auto-compact) and 2026-09-02T10:36:26 (GUI sidebar per-session timers aligned to real turn start). Note: Agent.md count lines also touched by PR #1104 — whoever merges second must reconcile (combined target: pytest 1223, renderer 497). * Agent.md: correct GUI breakdown to real static counts (100 incl nav-policy) --------- Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Problem
Rant 2026-09-02T10:03:29: opening a historical session in the GUI shows only user messages — assistant replies never appear.
Root cause
The GUI history loader (
Shell.tsxloadHistory/loadOlderHistory, wired in #1097) consumes the daemon'slist_historyRPC — but that RPC was designed user-only for the TUI/rewindrewind-point dialog (it returns onlyrole=userrecords withrecord_index). The GUI therefore rendered only user bubbles.Fix
list_history): new optionalinclude_assistantflag (defaultfalse→ user-only, fully backward compatible with TUI/rewind). Whentrue, returns both user and assistant messages in record order, each withrole+record_index; empty assistant content (tool-only turns) is skipped so no empty bubbles render. Pagination (limit/offset) counts over the full both-role list.includeAssistant→include_assistant.includeAssistant: trueand renderrole=assistantmessages as assistant bubbles (markdown, ✦ mark), user ones as before.addHistoryMessage/prependHistoryMessageaccept an optionalrole;assistantcreates a sealed non-typingAssistantEntrysegment, otherwise the existinghistoryentry.Verification
pytest tests/: 1221 passed, 1 skipped (new e2e test:include_assistantreturns both roles in record order, skips empty assistant turns, default stays user-only, pagination over full list) — Agent.md doc counts bumped (1222 collected)tsc --noEmitclean,npm test490/490 (3 new transcript role tests)npm test93 pass / 0 fail,node --checkcleanpython -c "from emrg.client.app import run_client"+python -m emrg --helpgreenCloses rant 2026-09-02T10:03:29 (GUI history shows only user messages).