Skip to content

fix: persist TUI session undo rewinds - #79443

Closed
0xBlocky wants to merge 1 commit into
NousResearch:mainfrom
0xBlocky:fix/tui-session-undo-persist
Closed

0xBlocky wants to merge 1 commit into
NousResearch:mainfrom
0xBlocky:fix/tui-session-undo-persist

Conversation

@0xBlocky

@0xBlocky 0xBlocky commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • make the TUI session.undo RPC persist rewinds through SessionDB.rewind_to_message
  • reload the active-only transcript after undo so live context and durable resume state match
  • preserve the previous in-memory fallback for transient sessions without a persisted DB row

Why

The TUI undo path could report that messages were undone while only trimming the in-memory session history. After exiting and resuming the session, the supposedly undone turn reappeared because the rows were still active in state.db.

Tests

  • HERMES_PYTHON=/usr/bin/python3 scripts/run_tests.sh tests/tui_gateway/test_undo_command.py
  • git diff --check

@alt-glitch alt-glitch added type/bug Something isn't working comp/tui Terminal UI (ui-tui/ + tui_gateway/) area/sessions Session lifecycle, resume, persistence, history P2 Medium — degraded but workaround exists sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Aug 5, 2026
@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for this — you correctly identified that the TUI session.undo RPC only mutated in-memory history, so a restart/resume brought soft-undone turns back.

This landed on main via PR #93784 (the composite-carrier retry/undo salvage, merged today): session.undo now routes through _rewind_active_session_history(), which archives the target row and tail durably in SessionDB in the same transaction and reinstalls the active view. I verified by running this PR's own test file — including test_session_undo_persists_rewind_for_resume — against current main without your code change: 3/3 pass.

Closing as implemented on main. Appreciate the report and the tests — sorry the broader carrier rework got there first.

@teknium1 teknium1 closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/sessions Session lifecycle, resume, persistence, history comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants