hermes-agent/apps/desktop/e2e
ethernet a4bc1ca502
fix(timeline): persist typed display events (#69771)
* fix(desktop): hide persisted agent-only history scaffolding

Filter verification-stop nudges and context-compaction handoffs at the
stored-history mapper boundary. Preserve a real reply when a compaction
handoff shares its stored message.

* test(desktop): build persisted E2E sessions through the real agent

Drive tui_gateway.entry over its stdio JSON-RPC transport against the mock
provider, wait for real completion events, and persist normal session history
through AIAgent and SessionDB. Migrate resume and hidden-history coverage,
including real compression and live verify-on-stop scaffolding, then remove
the unused direct SessionDB import scripts.

* fix(desktop): use the provisioned Python for real-session E2Es

Run the stdio gateway through uv's synced project environment outside the
Nix dev shell, while retaining the fully provisioned Nix Python when the
shell advertises HERMES_PYTHON_SRC_ROOT.

* fix(nix): expose the provisioned Python environment to uv

Mark the Nix-built Python environment active in the dev shell so the shared
E2E session builder can always run through `uv run --active --no-sync`.

* fix(timeline): persist typed display events

* fix(timeline): strip display-only fields from provider payloads, preserve through rewrites, fix /resume display history

Three review findings from PR #69771:

1. Provider payload leak: display_kind and display_metadata were forwarded
   to the provider API as unknown message fields. Strict OpenAI-compatible
   backends can reject the next request after a model switch or resumed
   typed event. Strip both from the per-request api_msg copy in
   conversation_loop alongside the existing api_content pop.

2. Rewrite/import data loss: _insert_message_rows preserved display_kind
   but silently dropped display_metadata. After replace_messages,
   archive_and_compact, or session import, async-delegation completion
   events lost their task counts and fell back to generic display text.
   Add display_metadata to the INSERT columns and bind tuple.

3. CLI /resume stale recap: startup --resume A set _resume_display_history
   from A's lineage. A subsequent in-session /resume B loaded B only into
   conversation_history via get_messages_as_conversation, leaving the stale
   A display projection. _display_resumed_history preferentially read the
   stale attribute, showing A's recap for B. Switch /resume to
   get_resume_conversations and update _resume_display_history alongside
   conversation_history.

Tests: 890 Python (5 files), 35 desktop TS — all green.

* feat(tui): render typed display events as ◈ markers in the Ink TUI

The TUI was not handling display_kind at all — model switch markers and
async delegation completions rendered as opaque user messages with the
full [System: ...] text, and hidden compaction handoffs were visible.

Wire display_kind through the full TUI chain:

- _history_to_messages (tui_gateway/server.py) forwards display_kind
  and display_metadata to the gateway transcript payload.
- GatewayTranscriptMessage (gatewayTypes.ts) gains both fields.
- Msg.kind (types.ts) gains 'event' value.
- toTranscriptMessages (domain/messages.ts) maps:
  - hidden → skip entirely
  - model_switch → event "model changed"
  - async_delegation_complete → event "N background agents finished"
    (or "background agent work finished" without metadata)
- messageGroup (blockLayout.ts) routes event to its own group, with
  SELF_SPACED + PAINTS_TRAILING_GAP so it owns its margins.
- messageLine.tsx renders event-kind as a dim ◈ marker with no gutter,
  matching the CLI's ◈ event rendering.
- 4 new TUI tests for hidden/model_switch/async_delegation mapping.

TUI typecheck: clean. TUI lint: 0 errors (2 pre-existing warnings).
TUI tests: 9 passed (1 pre-existing failure on main, unrelated).
2026-07-23 14:46:24 -04:00
..
boot-failure.spec.ts fix: tool_calls double-encoding on import (#68856) 2026-07-21 18:53:05 +00:00
boot.spec.ts fix: tool_calls double-encoding on import (#68856) 2026-07-21 18:53:05 +00:00
chat.spec.ts fix(desktop): show steer glyph in busy composer (#69612) 2026-07-22 23:29:38 +00:00
correction-session-switch.spec.ts fix(desktop): place steer messages before redirected replies (#69739) 2026-07-22 22:04:57 -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 fix(desktop): queue prompts during context compaction (#69783) 2026-07-22 23:19:22 -04:00
hidden-history-messages.spec.ts fix(timeline): persist typed display events (#69771) 2026-07-23 14:46:24 -04:00
interim-messages.spec.ts test(desktop): add E2E coverage for session lifecycle (#69580) 2026-07-22 22:56:13 +00:00
large-session-resume.spec.ts fix(timeline): persist typed display events (#69771) 2026-07-23 14:46:24 -04:00
launch-packaged-app.spec.ts fix: tool_calls double-encoding on import (#68856) 2026-07-21 18:53:05 +00:00
mock-backend-setup.spec.ts fix: tool_calls double-encoding on import (#68856) 2026-07-21 18:53:05 +00:00
mock-server.ts fix(timeline): persist typed display events (#69771) 2026-07-23 14:46:24 -04:00
onboarding.spec.ts fix: tool_calls double-encoding on import (#68856) 2026-07-21 18:53:05 +00:00
queue-turn-boundary.spec.ts fix(desktop): split steer and queue keyboard shortcuts (#69797) 2026-07-23 00:13:58 -04:00
real-session-builder.ts fix(timeline): persist typed display events (#69771) 2026-07-23 14:46:24 -04:00
session-compression-and-queue-stop.spec.ts fix(desktop): queue prompts during context compaction (#69783) 2026-07-22 23:19:22 -04:00
sidebar-states.spec.ts test(desktop): add E2E coverage for session lifecycle (#69580) 2026-07-22 22:56:13 +00:00
submit-drift.spec.ts test(desktop): cover submit drift through e2e (#69599) 2026-07-22 16:44:54 -04:00
test.ts fix: tool_calls double-encoding on import (#68856) 2026-07-21 18:53:05 +00:00
tile-unread-bug.spec.ts test(desktop): add E2E coverage for session lifecycle (#69580) 2026-07-22 22:56:13 +00:00
visual-snapshot.ts fix(desktop): link artifacts in E2E summary + upload all screenshots 2026-07-20 11:44:41 -04:00
warm-resume-jitter.spec.ts fix(timeline): persist typed display events (#69771) 2026-07-23 14:46:24 -04:00
worktree-branch-status.spec.ts fix(desktop): separate workspace defaults from live cwd (#69765) 2026-07-23 02:44:26 +00:00