Fix compression-exhausted stream finalization#3316
Conversation
|
Triage: hold + (CORE) Terminal-failure handling can run BEFORE the compression session-id migration, leaving frontend/backend session state inconsistent when compression exhaustion fires after the agent rotated The new terminal-failure check is at _terminal_failure = (
_agent_result_terminal_failure(result)
or _session_lacks_final_assistant_answer(_all_result_messages)
)
if _terminal_failure:
_assistant_added = False
if _terminal_failure or (not _assistant_added and not _token_sent):
... # emits the apperror + returnsBut the compression session-id migration + snapshot preservation block runs much later, at _preserve_pre_compression_snapshot(s, old_sid) # ~5680
... # migrate locks/cache, register continuation, emit `compressed`, save against new sidHermes Agent rotates
Suggested fix (needs your design call — I didn't want to hot-patch compression-rotation ordering under release pressure):
Everything else is good — the The rest of this session's transcript/streaming fixes (#3102 edit-replay, #3321 recovery-control filter) already shipped, so this isn't a wholesale rejection — just this one ordering interaction to sort out. Happy to pair on the helper-extraction if useful. No rush. |
Thinking Path
What Changed
failed,partial,compression_exhausted, tool-tail transcripts, assistant tool-call tails, and context-compaction marker tails as terminal failures instead of completed turns._assistant_addedshort-circuit so final-answer validation always checks the persisted transcript.[CONTEXT COMPACTION — REFERENCE ONLY]content out of settled transcript rendering while preserving transient running compression status.Why It Matters
This prevents long tool-heavy sessions from appearing completed when Hermes Agent stopped before writing a final assistant answer. It also prevents internal context-compaction reference text from being rendered as user-facing final content.
Related to #3315, NousResearch/hermes-agent#36624, and NousResearch/hermes-agent#36626.
Verification
python -m pytest tests/test_auto_compression_terminal_failure.py tests/test_auto_compression_card.py tests/test_issues_373_374_375.py tests/test_issue765_streaming_persistence.py::TestIssue765FollowupHardening::test_silent_failure_path_does_not_reacquire_agent_lock -qnode --check static/ui.jsnode --check static/messages.jsgit diff --checkRisks / Follow-ups
Contract Routing
Model Used
AI-assisted implementation with OpenAI GPT-5 Codex in a local coding workflow. The assistant inspected repository code, wrote targeted tests, implemented the fix, and ran the verification commands above.