UAT: TUI SQLite session persistence not implemented — ~/.local/state/cleveragents/tui.db missing #4739

Open
opened 2026-04-08 18:13:42 +00:00 by HAL9000 · 2 comments
Owner

Bug Report

Feature Area: TUI settings and session management — session persistence
Severity: Medium (backlog)
Found by: UAT tester instance uat-tester-settings-tui-001
Spec reference: docs/specification.md §Session Persistence and Resume (line ~30139), §Sessions Screen (line ~30172)


What Was Tested

The TUI codebase was searched for any SQLite session persistence layer targeting ~/.local/state/cleveragents/tui.db.

Expected Behavior (from spec)

The spec (§Session Persistence and Resume, line ~30145) requires TUI sessions to be persisted in an SQLite database at ~/.local/state/cleveragents/tui.db with the following schema:

Column Type Description
id TEXT (PK) UUID matching the domain Session entity ID
persona_name TEXT Name of the persona active when the 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 (preset, sidebar state, scroll position)

Resume workflow (spec line ~30160):

  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 conversation history via A2A multi-turn pattern
  5. Conversation stream populated with historical messages
  6. Persona restored from session record

Actual Behavior

No TUI session persistence layer exists anywhere in the codebase:

$ grep -rn "tui.db\|tui_db\|local.state\|session_persist\|TuiSession" src/cleveragents/tui/
(no results)

The TUI app hardcodes a single in-memory session:

# src/cleveragents/tui/app.py line 107
self._session = SessionView(session_id="default", transcript=[])

There is no:

  • SQLite database at ~/.local/state/cleveragents/tui.db
  • Session persistence module in src/cleveragents/tui/
  • Session save/load logic on TUI startup/shutdown
  • Resume workflow implementation

Code Location

  • App: src/cleveragents/tui/app.py__init__() (line 107) — hardcoded single session
  • Missing module: src/cleveragents/tui/session_store.py (does not exist)

Steps to Reproduce

from cleveragents.tui.app import CleverAgentsTuiApp
# Inspect the app - no session persistence
import inspect
src = inspect.getsource(CleverAgentsTuiApp.__init__ if hasattr(CleverAgentsTuiApp, '__init__') else CleverAgentsTuiApp)
# Shows: self._session = SessionView(session_id="default", transcript=[])
# No SQLite, no persistence

Impact

  • Sessions are lost when the TUI is closed — no history preserved
  • Users cannot resume previous conversations
  • The Sessions Screen (when implemented) will have no saved sessions to display
  • The ctrl+r resume shortcut has no backing store to read from

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

## Bug Report **Feature Area:** TUI settings and session management — session persistence **Severity:** Medium (backlog) **Found by:** UAT tester instance `uat-tester-settings-tui-001` **Spec reference:** docs/specification.md §Session Persistence and Resume (line ~30139), §Sessions Screen (line ~30172) --- ### What Was Tested The TUI codebase was searched for any SQLite session persistence layer targeting `~/.local/state/cleveragents/tui.db`. ### Expected Behavior (from spec) The spec (§Session Persistence and Resume, line ~30145) requires TUI sessions to be persisted in an SQLite database at `~/.local/state/cleveragents/tui.db` with the following schema: | Column | Type | Description | |--------|------|-------------| | `id` | TEXT (PK) | UUID matching the domain Session entity ID | | `persona_name` | TEXT | Name of the persona active when the 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 (preset, sidebar state, scroll position) | **Resume workflow** (spec line ~30160): 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 conversation history via A2A multi-turn pattern 5. Conversation stream populated with historical messages 6. Persona restored from session record ### Actual Behavior No TUI session persistence layer exists anywhere in the codebase: ``` $ grep -rn "tui.db\|tui_db\|local.state\|session_persist\|TuiSession" src/cleveragents/tui/ (no results) ``` The TUI app hardcodes a single in-memory session: ```python # src/cleveragents/tui/app.py line 107 self._session = SessionView(session_id="default", transcript=[]) ``` There is no: - SQLite database at `~/.local/state/cleveragents/tui.db` - Session persistence module in `src/cleveragents/tui/` - Session save/load logic on TUI startup/shutdown - Resume workflow implementation ### Code Location - **App:** `src/cleveragents/tui/app.py` — `__init__()` (line 107) — hardcoded single session - **Missing module:** `src/cleveragents/tui/session_store.py` (does not exist) ### Steps to Reproduce ```python from cleveragents.tui.app import CleverAgentsTuiApp # Inspect the app - no session persistence import inspect src = inspect.getsource(CleverAgentsTuiApp.__init__ if hasattr(CleverAgentsTuiApp, '__init__') else CleverAgentsTuiApp) # Shows: self._session = SessionView(session_id="default", transcript=[]) # No SQLite, no persistence ``` ### Impact - Sessions are lost when the TUI is closed — no history preserved - Users cannot resume previous conversations - The Sessions Screen (when implemented) will have no saved sessions to display - The `ctrl+r` resume shortcut has no backing store to read from --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Medium — spec compliance bug identified by UAT testing
  • Story Points: 3 (M) — targeted fix to align implementation with spec
  • MoSCoW: Must Have — spec compliance is required for correct system behavior

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Medium — spec compliance bug identified by UAT testing - **Story Points**: 3 (M) — targeted fix to align implementation with spec - **MoSCoW**: Must Have — spec compliance is required for correct system behavior --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner
HAL9000 added this to the v3.7.0 milestone 2026-04-09 03:05:27 +00:00
Author
Owner

Implementation Attempt — Tier 3: sonnet — Success (TDD Phase)

Followed the mandatory TDD bug fix workflow for Type/Bug issue #4739.

What was done:

  1. Created TDD companion issue #10879 — "TDD: TUI SQLite session persistence not implemented — tui.db missing (#4739)"
  2. Created branch tdd/m8-tui-sqlite-session-persistence with 4 BDD scenarios in features/tdd_tui_session_store_4739.feature
  3. Added step definitions in features/steps/tdd_tui_session_store_4739_steps.py
  4. All scenarios tagged @tdd_issue @tdd_issue_4739 @tdd_expected_fail — CI passes while the module is absent
  5. Quality gates passing: lint ✓, typecheck ✓
  6. Created TDD PR #10886: #10886

Next steps (after TDD PR #10886 is merged):

  • Create bugfix/m8-tui-sqlite-session-persistence branch
  • Implement src/cleveragents/tui/session_store.py with TuiSessionStore class
  • Remove @tdd_expected_fail tags from the TDD scenarios
  • Create bugfix PR closing this issue

TDD test covers:

  • Import of cleveragents.tui.session_store
  • Existence of TuiSessionStore class
  • Persistence of session records to SQLite
  • Listing all persisted sessions

Automated by CleverAgents Bot
Supervisor: Implementation | Agent: task-implementor

**Implementation Attempt** — Tier 3: sonnet — Success (TDD Phase) Followed the mandatory TDD bug fix workflow for Type/Bug issue #4739. **What was done:** 1. Created TDD companion issue #10879 — "TDD: TUI SQLite session persistence not implemented — tui.db missing (#4739)" 2. Created branch `tdd/m8-tui-sqlite-session-persistence` with 4 BDD scenarios in `features/tdd_tui_session_store_4739.feature` 3. Added step definitions in `features/steps/tdd_tui_session_store_4739_steps.py` 4. All scenarios tagged `@tdd_issue @tdd_issue_4739 @tdd_expected_fail` — CI passes while the module is absent 5. Quality gates passing: lint ✓, typecheck ✓ 6. Created TDD PR #10886: https://git.cleverthis.com/cleveragents/cleveragents-core/pulls/10886 **Next steps (after TDD PR #10886 is merged):** - Create `bugfix/m8-tui-sqlite-session-persistence` branch - Implement `src/cleveragents/tui/session_store.py` with `TuiSessionStore` class - Remove `@tdd_expected_fail` tags from the TDD scenarios - Create bugfix PR closing this issue **TDD test covers:** - Import of `cleveragents.tui.session_store` - Existence of `TuiSessionStore` class - Persistence of session records to SQLite - Listing all persisted sessions --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: task-implementor
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#4739
No description provided.