UAT: TUI Session Persistence and Resume not implemented — spec requires automatic session reload on restart with full conversation history and UI state #3019

Open
opened 2026-04-05 03:54:23 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: feat/tui-session-persistence-resume
  • Commit Message: feat(tui): implement TUI session persistence and automatic resume on restart
  • Milestone: v3.7.0
  • Parent Epic: #868

Background and Context

The specification states: "All TUI sessions are persisted to disk, allowing the user to close the application and resume their work later. When the TUI is restarted, it automatically reloads the previous session, including the full conversation history and the state of all UI components."

This is a core requirement of the TUI client architecture, where session state must survive process restarts. The backend persistence layer (A2A protocol, session export/import) provides the foundation, but the TUI frontend currently makes no use of it.

Current Behavior

The TUI app (src/cleveragents/tui/app.py) creates a hardcoded SessionView(session_id="default", transcript=[]) on every startup (line 107). There is no persistence of conversation history to disk, no automatic session reload on restart, and no restoration of UI component state. The PersonaRegistry does persist the last active persona name via tui-state.yaml, but this is the only state that survives a restart.

Affected code locations:

  • src/cleveragents/tui/app.py line 107: self._session = SessionView(session_id="default", transcript=[]) — always starts with empty transcript
  • src/cleveragents/tui/persona/registry.py lines 178–203: Only persists last_persona name, not full session state
  • No session persistence mechanism exists in the TUI

Steps to Reproduce:

  1. Launch the TUI: agents tui
  2. Have a conversation (submit several messages)
  3. Close the TUI (Ctrl+Q)
  4. Relaunch the TUI: agents tui
  5. The conversation history is gone — the TUI starts fresh with an empty transcript

Expected Behavior

Per the specification:

  1. When the TUI is closed, the full conversation history must be saved to disk
  2. When the TUI is restarted, it must automatically reload the previous session
  3. The state of all UI components (active persona, current preset, scroll position, etc.) must be restored

Subtasks

  • Create src/cleveragents/tui/session_persistence.py with session save/load functionality
  • Implement conversation history serialization to disk (JSON or YAML)
  • Implement automatic session detection and reload on startup
  • Restore UI component state (active persona, preset, scroll position) on resume
  • Add session cleanup for old/expired sessions
  • Write BDD scenarios in features/tui_session_persistence.feature

Definition of Done

  • Conversation history is persisted to disk on TUI close
  • TUI automatically reloads previous session on restart
  • All UI component state is restored on resume
  • BDD scenarios cover session persistence and resume
  • nox -e typecheck passes
  • nox -e unit_tests passes
  • All nox stages pass
  • Coverage >= 97%

Supporting Information

  • Spec reference: TUI session persistence requirement (automatic reload on restart)
  • Related: src/cleveragents/tui/app.py line 107, src/cleveragents/tui/persona/registry.py lines 178–203
  • This issue was filed by the UAT Testing agent (ca-uat-tester) as part of automated acceptance testing.

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `feat/tui-session-persistence-resume` - **Commit Message**: `feat(tui): implement TUI session persistence and automatic resume on restart` - **Milestone**: v3.7.0 - **Parent Epic**: #868 ## Background and Context The specification states: *"All TUI sessions are persisted to disk, allowing the user to close the application and resume their work later. When the TUI is restarted, it automatically reloads the previous session, including the full conversation history and the state of all UI components."* This is a core requirement of the TUI client architecture, where session state must survive process restarts. The backend persistence layer (A2A protocol, session export/import) provides the foundation, but the TUI frontend currently makes no use of it. ## Current Behavior The TUI app (`src/cleveragents/tui/app.py`) creates a hardcoded `SessionView(session_id="default", transcript=[])` on every startup (line 107). There is no persistence of conversation history to disk, no automatic session reload on restart, and no restoration of UI component state. The `PersonaRegistry` does persist the last active persona name via `tui-state.yaml`, but this is the only state that survives a restart. **Affected code locations:** - `src/cleveragents/tui/app.py` line 107: `self._session = SessionView(session_id="default", transcript=[])` — always starts with empty transcript - `src/cleveragents/tui/persona/registry.py` lines 178–203: Only persists `last_persona` name, not full session state - No session persistence mechanism exists in the TUI **Steps to Reproduce:** 1. Launch the TUI: `agents tui` 2. Have a conversation (submit several messages) 3. Close the TUI (Ctrl+Q) 4. Relaunch the TUI: `agents tui` 5. The conversation history is gone — the TUI starts fresh with an empty transcript ## Expected Behavior Per the specification: 1. When the TUI is closed, the full conversation history must be saved to disk 2. When the TUI is restarted, it must automatically reload the previous session 3. The state of all UI components (active persona, current preset, scroll position, etc.) must be restored ## Subtasks - [ ] Create `src/cleveragents/tui/session_persistence.py` with session save/load functionality - [ ] Implement conversation history serialization to disk (JSON or YAML) - [ ] Implement automatic session detection and reload on startup - [ ] Restore UI component state (active persona, preset, scroll position) on resume - [ ] Add session cleanup for old/expired sessions - [ ] Write BDD scenarios in `features/tui_session_persistence.feature` ## Definition of Done - [ ] Conversation history is persisted to disk on TUI close - [ ] TUI automatically reloads previous session on restart - [ ] All UI component state is restored on resume - [ ] BDD scenarios cover session persistence and resume - [ ] `nox -e typecheck` passes - [ ] `nox -e unit_tests` passes - [ ] All nox stages pass - [ ] Coverage >= 97% ## Supporting Information - Spec reference: TUI session persistence requirement (automatic reload on restart) - Related: `src/cleveragents/tui/app.py` line 107, `src/cleveragents/tui/persona/registry.py` lines 178–203 - This issue was filed by the UAT Testing agent (ca-uat-tester) as part of automated acceptance testing. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-05 03:55:47 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Confirmed
  • MoSCoW: Should Have

Valid finding verified during batch triage.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Confirmed - **MoSCoW**: Should Have Valid finding verified during batch triage. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
Reference
cleveragents/cleveragents-core#3019
No description provided.