Skip to content

Normalize auto-compression transcript cards#1142

Closed
franksong2702 wants to merge 2 commits intonesquena:masterfrom
franksong2702:franksong2702/auto-compression-card
Closed

Normalize auto-compression transcript cards#1142
franksong2702 wants to merge 2 commits intonesquena:masterfrom
franksong2702:franksong2702/auto-compression-card

Conversation

@franksong2702
Copy link
Copy Markdown
Contributor

@franksong2702 franksong2702 commented Apr 27, 2026

Thinking Path

  • Hermes WebUI now uses richer transcript cards for tool and compression artifacts.
  • Manual /compress already had a clearer compression-card presentation.
  • Auto-compression still used a separate lightweight path: the live SSE event inserted a fake italic assistant message, while persisted compaction artifacts could appear as ordinary user bubbles.
  • That made the transcript feel inconsistent and could imply the user or assistant authored messages that were really system artifacts.
  • This PR keeps Hermes Agent's compression lifecycle intact and normalizes the WebUI render layer around the existing compression-card visual language.

Refs #524.

What Changed

  • Renders auto-compression SSE events as transient compression cards instead of pushing a fake assistant message into S.messages.
  • Renders persisted [CONTEXT COMPACTION — REFERENCE ONLY] messages as Context compaction reference cards across roles.
  • Renders Hermes Agent's preserved task-list snapshot as a Preserved task list compression-adjacent card instead of a normal user bubble.
  • Keeps preserved task-list rendering to the latest snapshot and attaches it once per render.
  • Adds i18n labels for automatic compression and preserved task-list cards.
  • Adds regression coverage for the SSE path, role-agnostic compaction detection, render ordering, non-active/malformed SSE safety, and history immutability.
  • Stabilizes an adjacent source-level done handler regression test so it reads the full handler instead of relying on a brittle fixed-width slice.

Why It Matters

  • Auto-compression now fits the newer Transcript UI experience instead of using one-off inline text.
  • The transcript separates system compression artifacts from user-authored messages.
  • Reload behavior remains safe because the live notification is transient and no fake message is persisted.
  • Hermes Agent's actual compaction messages stay in history/model context; WebUI only changes how they render.

Verification

  • .venv_test/bin/pytest tests/test_auto_compression_card.py tests/test_sprint46.py tests/test_regressions.py::test_done_handler_sets_busy_false_before_renderMessages -q
  • node --check static/ui.js
  • node --check static/messages.js
  • node --check static/i18n.js
  • git diff --check

Manual browser validation:

  • Verified an auto-compression event renders as an Automatic compression card.
  • Verified a persisted Context compaction artifact renders as a reference card.
  • Verified a persisted Preserved task list artifact renders as a compression-adjacent card.

Risks / Follow-ups

Model Used

  • OpenAI GPT-5.5 via Codex.
  • Used a coordinator/worker workflow for implementation review and regression follow-up.

@franksong2702
Copy link
Copy Markdown
Contributor Author

franksong2702 commented Apr 27, 2026

Visual validation screenshots:

  1. Persisted transcript artifacts now render as compression cards:
    • Context compaction is shown as a reference-only compression card.
    • Preserved task list is shown as a compression-adjacent card instead of a normal user bubble.
截屏2026-04-27 17 17 54
  1. Live auto-compression notification now renders as a transient compression card:
    • Automatic compression appears as a compact status card.
    • No fake italic assistant message is inserted into the transcript.
截屏2026-04-27 17 18 31

@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Thanks for this PR, @franksong2702 (and for the visual validation screenshots)! This is a well-structured normalization pass.

Scope covers the three consistency gaps:

  • Live SSE path — auto-compression events now render as transient Automatic compression cards instead of injecting a fake italic assistant message into S.messages.
  • Persisted compaction artifacts[CONTEXT COMPACTION — REFERENCE ONLY] messages render as Context compaction reference cards regardless of role.
  • Preserved task-list snapshots — Hermes Agent's task-list artifact renders as a compression-adjacent card instead of a normal user bubble.

Key design properties maintained:

  • Hermes Agent's actual compaction messages stay in history/model context; only the WebUI render layer changes. ✅
  • Reload behavior is safe — live notification is transient, no fake message persisted. ✅
  • Latest snapshot only, attached once per render. ✅
  • i18n labels added for new card types. ✅

Tests: test_auto_compression_card.py, test_sprint46.py + node --check on all modified JS files.

On not closing #524: Reasonable — #524 now covers broader compression UX guidance and this PR is one step in that direction.

Flagging for maintainer review and merge. 🙏

nesquena-hermes added a commit that referenced this pull request Apr 27, 2026
Merged as v0.50.227. 2634 tests passing, browser QA 21/21 (desktop + mobile). Full attribution below.

Thanks to all 12 contributors:
@jundev0001 (#1138), @franksong2702 (#1142, #1157, #1162), @dso2ng (#1143), @bergeouss (#1145, #1146, #1156, #1159), @jasonjcwu (#1149), @ccqqlo (#1161), @frap129 (#1165)

Two fixes applied during integration and two more by the independent reviewer (@nesquena):
- messages.js: per-turn cost delta capture order (#1159)
- workspace.py: symlink target blocked-roots check + HOME sanity guard (#1149, #1165)
- panels.js: cron unread counter bookkeeping (in-loop increment bug)
- tests/test_symlink_cycle_detection.py: register workspace before session/new
@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Merged as v0.50.227 via batch PR #1168. Thank you @franksong2702! 🎉

JKJameson pushed a commit to JKJameson/hermes-webui that referenced this pull request Apr 29, 2026
Merged as v0.50.227. 2634 tests passing, browser QA 21/21 (desktop + mobile). Full attribution below.

Thanks to all 12 contributors:
@jundev0001 (nesquena#1138), @franksong2702 (nesquena#1142, nesquena#1157, nesquena#1162), @dso2ng (nesquena#1143), @bergeouss (nesquena#1145, nesquena#1146, nesquena#1156, nesquena#1159), @jasonjcwu (nesquena#1149), @ccqqlo (nesquena#1161), @frap129 (nesquena#1165)

Two fixes applied during integration and two more by the independent reviewer (@nesquena):
- messages.js: per-turn cost delta capture order (nesquena#1159)
- workspace.py: symlink target blocked-roots check + HOME sanity guard (nesquena#1149, nesquena#1165)
- panels.js: cron unread counter bookkeeping (in-loop increment bug)
- tests/test_symlink_cycle_detection.py: register workspace before session/new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ux(composer): compact/compress button on context usage indicator when context is getting full

2 participants