mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-21 16:18:55 +00:00
fix(tui): heal alternation at the remaining live-replay resume sites
Sibling-site audit on top of #65672: the interactive TUI resume, the profile-scoped resume, and the /undo history reload also feed LIVE REPLAY (raw_history -> sanitize_replay_history -> working conversation; session['history'] after rewind). Pass repair_alternation=True on the model-fed copies; display_history stays verbatim so inspection/export show what is actually stored. Display-only consumers (session.history RPC, formatted transcript output) intentionally unchanged.
This commit is contained in:
parent
bebcf95847
commit
95cc3f7eb2
1 changed files with 13 additions and 3 deletions
|
|
@ -6069,7 +6069,11 @@ def _(rid, params: dict) -> dict:
|
|||
_enable_gateway_prompts()
|
||||
try:
|
||||
db.reopen_session(target)
|
||||
raw_history = db.get_messages_as_conversation(target)
|
||||
# repair_alternation on the model-fed copy only: this resume feeds
|
||||
# LIVE REPLAY (raw_history → sanitize_replay_history → the resumed
|
||||
# session's working conversation). display_history stays verbatim —
|
||||
# inspection/export must show what is actually stored.
|
||||
raw_history = db.get_messages_as_conversation(target, repair_alternation=True)
|
||||
display_history = db.get_messages_as_conversation(target, include_ancestors=True)
|
||||
except Exception as e:
|
||||
if lease is not None:
|
||||
|
|
@ -6143,7 +6147,9 @@ def _(rid, params: dict) -> dict:
|
|||
)
|
||||
try:
|
||||
db.reopen_session(target)
|
||||
raw_history = db.get_messages_as_conversation(target)
|
||||
# repair_alternation on the model-fed copy only (see the interactive
|
||||
# resume above): this loads LIVE REPLAY history; display stays verbatim.
|
||||
raw_history = db.get_messages_as_conversation(target, repair_alternation=True)
|
||||
display_history = db.get_messages_as_conversation(
|
||||
target, include_ancestors=True
|
||||
)
|
||||
|
|
@ -12715,8 +12721,12 @@ def _(rid, params: dict) -> dict:
|
|||
return _err(rid, 5008, f"undo: {e}")
|
||||
# Reload the active-only transcript into the in-memory session
|
||||
# history so subsequent turns see the truncated view.
|
||||
# repair_alternation: this reload feeds LIVE REPLAY — session["history"]
|
||||
# is the working conversation for subsequent turns, and a rewind that
|
||||
# lands on a durable user;user pair would otherwise re-fire the
|
||||
# pre-request repair on every request from here on.
|
||||
try:
|
||||
active = db.get_messages_as_conversation(session_key)
|
||||
active = db.get_messages_as_conversation(session_key, repair_alternation=True)
|
||||
except Exception:
|
||||
active = []
|
||||
with session["history_lock"]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue