UAT: TUI session persistence not implemented — no SQLite database at ~/.local/state/cleveragents/tui.db #5331

Open
opened 2026-04-09 05:52:29 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: TUI — Session Persistence (v3.7.0)
Severity: Critical — sessions are not persisted across TUI restarts
Discovered by: UAT Testing (uat-pool-1, worker: tui-implementation)


What Was Tested

Full codebase search for SQLite session persistence in the TUI module.

Expected Behavior (from spec §30139-30168, §46981, §46999)

The spec requires TUI sessions to be persisted in an SQLite database at ~/.local/state/cleveragents/tui.db:

Sessions are stored in an SQLite database at ~/.local/state/cleveragents/tui.db:
| Column         | Type          | Description                                              |
|----------------|---------------|----------------------------------------------------------|
| id             | TEXT (PK)     | UUID matching the domain Session entity ID               |
| persona_name   | TEXT          | Name of the persona active when session was last used    |
| actor_identity | TEXT          | Namespaced actor identity (e.g. anthropic/claude-4-sonnet) |
| title          | TEXT          | User-assigned or auto-generated session title            |
| prompt_count   | INTEGER       | Number of user prompts sent in this session              |
| total_cost     | REAL          | Cumulative cost in USD for this session                  |
| created_at     | TEXT (ISO 8601) | Session creation timestamp                             |
| last_used      | TEXT (ISO 8601) | Last interaction timestamp                             |
| project_path   | TEXT          | Working directory at session creation (nullable)         |
| meta_json      | TEXT          | JSON blob for extensible metadata                        |

Resume workflow:

  1. User presses ctrl+r (from SessionsScreen) or uses /session:import
  2. TUI reads session record from SQLite
  3. New A2A Task initiated with stored session ID
  4. Actor receives session's conversation history via A2A multi-turn pattern
  5. Conversation stream populated with historical messages
  6. Persona restored to stored persona

Actual Behavior

No SQLite session persistence exists anywhere in the TUI module. A comprehensive search returns zero results for:

  • tui.db
  • sqlite in src/cleveragents/tui/
  • ~/.local/state/cleveragents
  • Any session store class in the TUI module

The TuiCommandRouter._session_command only handles show, export, and import — it does NOT persist sessions to SQLite. The SessionView dataclass in app.py is a minimal in-memory view model with only session_id and transcript fields.

# Current SessionView (app.py:56-60):
@dataclass(slots=True)
class SessionView:
    """Minimal per-session TUI view model."""
    session_id: str
    transcript: list[str]
# Missing: persona_name, actor_identity, title, prompt_count, total_cost,
#          created_at, last_used, project_path, meta_json

The spec also notes: "Session database: TUI session state stored in ~/.local/state/cleveragents/tui.db (SQLite); separate from main ~/.local/share/cleveragents/data.db."

Steps to Reproduce

  1. Search: grep -r "tui.db\|local/state" src/cleveragents/tui/ → no results
  2. Search: grep -r "sqlite\|SQLite" src/cleveragents/tui/ → no results
  3. Open app.pySessionView has no persistence fields
  4. Open commands.py_session_command has no SQLite operations

Impact

Without session persistence:

  • Sessions are lost when the TUI is closed
  • Users cannot resume previous conversations
  • The Sessions screen cannot show "Saved Sessions" from previous runs
  • Session history is not available for context in resumed sessions

This blocks the v3.7.0 milestone acceptance criteria.

Code Location

  • src/cleveragents/tui/app.py:56-60SessionView needs persistence fields
  • src/cleveragents/tui/commands.py_session_command needs SQLite operations
  • Missing: src/cleveragents/tui/session_store.py (or equivalent)

Definition of Done

  • SQLite database created at ~/.local/state/cleveragents/tui.db on first launch
  • TuiSessionStore class with full schema (10 columns per spec)
  • Sessions auto-saved after each prompt submission
  • ctrl+r in SessionsScreen resumes a saved session
  • /session:import imports a session from SQLite
  • Flash warning shown when actor doesn't support session resume
  • Sessions screen shows "Saved Sessions" section from SQLite

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Feature Area:** TUI — Session Persistence (v3.7.0) **Severity:** Critical — sessions are not persisted across TUI restarts **Discovered by:** UAT Testing (uat-pool-1, worker: tui-implementation) --- ## What Was Tested Full codebase search for SQLite session persistence in the TUI module. ## Expected Behavior (from spec §30139-30168, §46981, §46999) The spec requires TUI sessions to be persisted in an SQLite database at `~/.local/state/cleveragents/tui.db`: ``` Sessions are stored in an SQLite database at ~/.local/state/cleveragents/tui.db: | Column | Type | Description | |----------------|---------------|----------------------------------------------------------| | id | TEXT (PK) | UUID matching the domain Session entity ID | | persona_name | TEXT | Name of the persona active when session was last used | | actor_identity | TEXT | Namespaced actor identity (e.g. anthropic/claude-4-sonnet) | | title | TEXT | User-assigned or auto-generated session title | | prompt_count | INTEGER | Number of user prompts sent in this session | | total_cost | REAL | Cumulative cost in USD for this session | | created_at | TEXT (ISO 8601) | Session creation timestamp | | last_used | TEXT (ISO 8601) | Last interaction timestamp | | project_path | TEXT | Working directory at session creation (nullable) | | meta_json | TEXT | JSON blob for extensible metadata | ``` Resume workflow: 1. User presses `ctrl+r` (from SessionsScreen) or uses `/session:import` 2. TUI reads session record from SQLite 3. New A2A Task initiated with stored session ID 4. Actor receives session's conversation history via A2A multi-turn pattern 5. Conversation stream populated with historical messages 6. Persona restored to stored persona ## Actual Behavior **No SQLite session persistence exists anywhere in the TUI module.** A comprehensive search returns zero results for: - `tui.db` - `sqlite` in `src/cleveragents/tui/` - `~/.local/state/cleveragents` - Any session store class in the TUI module The `TuiCommandRouter._session_command` only handles `show`, `export`, and `import` — it does NOT persist sessions to SQLite. The `SessionView` dataclass in `app.py` is a minimal in-memory view model with only `session_id` and `transcript` fields. ```python # Current SessionView (app.py:56-60): @dataclass(slots=True) class SessionView: """Minimal per-session TUI view model.""" session_id: str transcript: list[str] # Missing: persona_name, actor_identity, title, prompt_count, total_cost, # created_at, last_used, project_path, meta_json ``` The spec also notes: "Session database: TUI session state stored in `~/.local/state/cleveragents/tui.db` (SQLite); separate from main `~/.local/share/cleveragents/data.db`." ## Steps to Reproduce 1. Search: `grep -r "tui.db\|local/state" src/cleveragents/tui/` → no results 2. Search: `grep -r "sqlite\|SQLite" src/cleveragents/tui/` → no results 3. Open `app.py` → `SessionView` has no persistence fields 4. Open `commands.py` → `_session_command` has no SQLite operations ## Impact Without session persistence: - Sessions are lost when the TUI is closed - Users cannot resume previous conversations - The Sessions screen cannot show "Saved Sessions" from previous runs - Session history is not available for context in resumed sessions This blocks the v3.7.0 milestone acceptance criteria. ## Code Location - `src/cleveragents/tui/app.py:56-60` — `SessionView` needs persistence fields - `src/cleveragents/tui/commands.py` — `_session_command` needs SQLite operations - Missing: `src/cleveragents/tui/session_store.py` (or equivalent) ## Definition of Done - [ ] SQLite database created at `~/.local/state/cleveragents/tui.db` on first launch - [ ] `TuiSessionStore` class with full schema (10 columns per spec) - [ ] Sessions auto-saved after each prompt submission - [ ] `ctrl+r` in SessionsScreen resumes a saved session - [ ] `/session:import` imports a session from SQLite - [ ] Flash warning shown when actor doesn't support session resume - [ ] Sessions screen shows "Saved Sessions" section from SQLite --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.7.0 milestone 2026-04-09 05:52:50 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: High — (adjusting from Critical) SQLite session persistence is a core TUI feature per v3.7.0 spec, but v3.7.0 has no deadline and focus is on M1-M6 first
  • Milestone: v3.7.0
  • Story Points: 5 — L — implementing SQLite persistence at ~/.local/state/cleveragents/tui.db with session CRUD
  • MoSCoW: Must Have — session persistence is explicitly required by v3.7.0 spec
  • Parent Epic: Needs linking to TUI epic

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

Issue triaged by project owner: - **State**: Verified - **Priority**: High — (adjusting from Critical) SQLite session persistence is a core TUI feature per v3.7.0 spec, but v3.7.0 has no deadline and focus is on M1-M6 first - **Milestone**: v3.7.0 - **Story Points**: 5 — L — implementing SQLite persistence at `~/.local/state/cleveragents/tui.db` with session CRUD - **MoSCoW**: Must Have — session persistence is explicitly required by v3.7.0 spec - **Parent Epic**: Needs linking to TUI epic --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: 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.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#5331
No description provided.