hermes-agent/apps/desktop/e2e
ethernet 51bb3e6b4b fix(desktop): eliminate session-load transcript re-renders
The cold resume path in resumeSession() painted the transcript twice:
once from the REST prefetch (eager setMessages), then again when the
session.resume RPC landed (reconcileAuthoritativeMessages + setMessages).
A third re-render came from setBusy(true) during the load followed by
setBusy(false) in the finally — the busy→idle transition re-rendered
the thread viewport.

Three changes fix this:

1. Defer the prefetch paint until BOTH the prefetch and the resume RPC
   have landed, then paint once. Wall time stays max(prefetch, resume)
   but the DOM only updates a single time. The prefetch result is
   awaited concurrently but not applied until after the RPC resolves.

2. Remove setBusy(true) from the cold-path entry. This is a history
   load, not a live turn — the busy flag is for active LLM turns only.
   The loading spinner is unaffected: it's driven by messagesEmpty &&
   !activeSessionId, not by $busy. The busy→idle transition was causing
   a second thread viewport re-render.

3. Drop the resumed.messages.length <= prefetchedMessageCount guard on
   the prefetch-hit fast path. When the prefetch already painted (now
   deferred) and the RPC returns no live projection, the REST endpoint
   is the display authority — the RPC's compressed-context projection
   can differ in count/content, so re-painting from it causes a teardown
   + rebuild. Now the prefetch result is always preferred when idle.

Also adds a direct setMessages call after updateSessionState so the
final paint happens synchronously (updateSessionState's RAF flush via
syncSessionStateToView is deferred and mocked in tests).

The e2e test (large-session-reload.spec.ts) now fails with 1 mutation
burst instead of 2, proving the fix eliminates the duplicate re-render.
The test's MutationObserver was also refined to only count additive
bursts (node additions), ignoring the expected setMessages([]) clear.
2026-07-20 17:15:47 -04:00
..
fixtures test(desktop): e2e proving session-load re-render bug 2026-07-20 16:40:59 -04:00
scripts test(desktop): e2e proving session-load re-render bug 2026-07-20 16:40:59 -04:00
boot-failure.spec.ts revert(desktop): restore Preparing error state in onboarding 2026-07-20 14:32:13 -04:00
boot.spec.ts feat(desktop/e2e): Playwright E2E suite with visual regression diffs 2026-07-20 11:44:40 -04:00
chat.spec.ts fix(desktop): keep visual E2E diffs advisory 2026-07-20 11:44:41 -04:00
fix-electron-tracing.ts fix(desktop): address review — overlay a11y, e2e typecheck, nits 2026-07-20 14:37:39 -04:00
fixtures.ts test(desktop): e2e proving session-load re-render bug 2026-07-20 16:40:59 -04:00
large-session-reload.spec.ts fix(desktop): eliminate session-load transcript re-renders 2026-07-20 17:15:47 -04:00
launch-packaged-app.spec.ts fix(desktop): keep visual E2E diffs advisory 2026-07-20 11:44:41 -04:00
mock-backend-setup.spec.ts fix(desktop): keep visual E2E diffs advisory 2026-07-20 11:44:41 -04:00
mock-server.ts feat(desktop/e2e): Playwright E2E suite with visual regression diffs 2026-07-20 11:44:40 -04:00
onboarding.spec.ts feat(desktop/e2e): Playwright E2E suite with visual regression diffs 2026-07-20 11:44:40 -04:00
visual-snapshot.ts fix(desktop): link artifacts in E2E summary + upload all screenshots 2026-07-20 11:44:41 -04:00