fix: clarify live auto-compression state - #2517
Michaelyklam wants to merge 1 commit into
Conversation
2535562 to
58ba09a
Compare
SummaryReading However, I want to flag two things that come out of reading the surrounding code paths. Code referenceThe render itself ( function _autoCompressionCardsHtml(state){
const fallback='Context auto-compressed to continue the conversation';
const running=state&&state.phase==='running';
const detail=running
? (String(state.message||'Auto-compressing context...').trim()||'Auto-compressing context...')
: (String(state.message||fallback).trim()||fallback);
const startedAt=Number(state&&state.startedAt||0);
const elapsed=(running&&startedAt>0)
? `Elapsed ${_formatTurnDuration(Math.max(0,(Date.now()-startedAt)/1000))}`
: '';And the only place Diagnosis / Recommendation1. The elapsed counter does not actually tick. This is the substantive concern. The PR description says "Elapsed time updates on rerender/SSE activity; it does not start a separate timer loop." But during automatic compression, the whole point of issue #2477 is that no SSE activity arrives between if(!_activityElapsedTimer)_activityElapsedTimer=setInterval(_updateActiveActivityElapsedTimer,1000);2. PR #2512 is the same fix and is more complete. It's open in parallel by another author and already lands a 1-second ticking timer ( 3. Tests pin only structural strings, not the live behavior. The new assertions in RecommendationTwo paths, with a clear preference:
let _compressionElapsedTimer=null;
function _startCompressionElapsedTimer(){
if(_compressionElapsedTimer) return;
_compressionElapsedTimer=setInterval(renderCompressionUi,1000);
}
function _clearCompressionElapsedTimer(){
if(!_compressionElapsedTimer) return;
clearInterval(_compressionElapsedTimer); _compressionElapsedTimer=null;
}…and wire Test planA behavior test rather than a string-match test would catch #1: stub |
Closing as parallel-discovery superseded by #2512Thanks for the focused slice on auto-compression elapsed time, Michael — closing this in favor of #2512 which targets the same Slice A of #2477 and went a little further:
No need to rework — the diagnosis was correct, your reading of the issue was the same, just two contributors converging on the same slice. If you spot any feature in #2517 that #2512 doesn't cover (e.g. wording in Closing per the parallel-discovery pattern. |
Thinking Path
compressingandcompressedSSE events and renders them through compression cards.masterhas a running-state card path, but the automatic card still used the generic automatic-compression label and did not show elapsed time, making long fallback delays easy to misread.What Changed
startedAtwhen thecompressingSSE event creates the live automatic-compression state.compressedevent.Why It Matters
This makes the UI more honest during the specific #2477 failure mode: the backend can still be alive and compressing while the browser looks frozen. A visible running phase plus elapsed time reduces the chance that users refresh, retry, or interrupt a still-useful run.
Verification
/home/michael/.hermes/hermes-agent/venv/bin/python -m pytest tests/test_auto_compression_card.py -q— 26 passednode --check static/messages.jsnode --check static/ui.jsgit diff --checkRisks / Follow-ups
Model Used
AI-assisted change with repository inspection, targeted editing, screenshot generation, and shell-based test verification.
Refs #2477