[TDD] TUI session persistence: no SQLite database at ~/.local/state/cleveragents/tui.db — BDD test to prove gap #8499

Open
opened 2026-04-13 20:12:35 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit message: test(tui): add BDD scenario proving TUI SQLite session persistence is absent
  • Branch name: tdd/tui-sqlite-session-persistence-missing

Background and Context

The v3.7.0 milestone scope explicitly requires:

"Session persistence (SQLite at ~/.local/state/cleveragents/tui.db)"

The TUI architecture ADR-044 and the milestone description both specify that TUI session state must be persisted to a SQLite database at ~/.local/state/cleveragents/tui.db. This enables session resumption across TUI restarts and is a foundational requirement for the multi-session tab feature (#8445).

Code evidence of the gap:

Inspection of src/cleveragents/tui/app.py shows:

  • No SQLite import or database initialization
  • No ~/.local/state/cleveragents/tui.db path reference anywhere in the TUI codebase
  • The PersonaState uses only in-memory dicts (active_by_session, preset_by_session) with no persistence
  • The PersonaRegistry persists persona definitions to YAML files at ~/.config/cleveragents/personas/ and last-used persona to ~/.config/cleveragents/tui-state.yaml — but this is persona configuration, not session conversation state
  • SessionView (the TUI's session model) is a minimal in-memory dataclass with no persistence
# src/cleveragents/tui/app.py
@dataclass(slots=True)
class SessionView:
    """Minimal per-session TUI view model."""
    session_id: str
    transcript: list[str]
    # No persistence — lost on TUI exit

A search of the entire TUI codebase confirms no SQLite database is created or used for TUI session persistence:

find src/cleveragents/tui -name "*.py" | xargs grep -l "sqlite\|tui.db\|local/state" 
# Returns: (empty)

Current Behavior

The TUI has no SQLite session persistence. When the TUI exits, all session conversation state (transcript, active session ID, session history) is lost. There is no ~/.local/state/cleveragents/tui.db file created or used. The only persistence is the last-used persona name in ~/.config/cleveragents/tui-state.yaml.

Expected Behavior

Per the v3.7.0 spec and ADR-044:

  • A SQLite database must be created at ~/.local/state/cleveragents/tui.db on first TUI launch
  • TUI session state (session IDs, conversation transcripts, active session) must be persisted to this database
  • On TUI restart, the last active session must be restored from the database
  • The database path must follow XDG Base Directory Specification (~/.local/state/)

Acceptance Criteria

  • BDD scenario: launching the TUI creates ~/.local/state/cleveragents/tui.db
  • BDD scenario: session state is written to the SQLite database during a TUI session
  • BDD scenario: restarting the TUI restores the last active session from the database
  • BDD scenario: the database path is ~/.local/state/cleveragents/tui.db (XDG-compliant)
  • The BDD scenario is tagged @tdd_expected_fail and fails on the current codebase (proving the gap)

Subtasks

  • Write BDD feature file features/tui_session_sqlite_persistence.feature with scenarios proving the gap
  • Write step definitions in features/steps/tui_session_sqlite_persistence_steps.py
  • Tag scenarios with @tdd_expected_fail so CI passes while the bug is unfixed
  • Verify the scenarios fail on the current codebase (confirming the gap)
  • Link this issue as a dependency of the fix issue (Type/Bug)

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to main, reviewed, and merged before this issue is marked done.

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor

## Metadata - **Commit message**: `test(tui): add BDD scenario proving TUI SQLite session persistence is absent` - **Branch name**: `tdd/tui-sqlite-session-persistence-missing` ## Background and Context The v3.7.0 milestone scope explicitly requires: > "Session persistence (SQLite at ~/.local/state/cleveragents/tui.db)" The TUI architecture ADR-044 and the milestone description both specify that TUI session state must be persisted to a SQLite database at `~/.local/state/cleveragents/tui.db`. This enables session resumption across TUI restarts and is a foundational requirement for the multi-session tab feature (#8445). **Code evidence of the gap:** Inspection of `src/cleveragents/tui/app.py` shows: - No SQLite import or database initialization - No `~/.local/state/cleveragents/tui.db` path reference anywhere in the TUI codebase - The `PersonaState` uses only in-memory dicts (`active_by_session`, `preset_by_session`) with no persistence - The `PersonaRegistry` persists persona definitions to YAML files at `~/.config/cleveragents/personas/` and last-used persona to `~/.config/cleveragents/tui-state.yaml` — but this is persona configuration, not session conversation state - `SessionView` (the TUI's session model) is a minimal in-memory dataclass with no persistence ```python # src/cleveragents/tui/app.py @dataclass(slots=True) class SessionView: """Minimal per-session TUI view model.""" session_id: str transcript: list[str] # No persistence — lost on TUI exit ``` A search of the entire TUI codebase confirms no SQLite database is created or used for TUI session persistence: ``` find src/cleveragents/tui -name "*.py" | xargs grep -l "sqlite\|tui.db\|local/state" # Returns: (empty) ``` ## Current Behavior The TUI has no SQLite session persistence. When the TUI exits, all session conversation state (transcript, active session ID, session history) is lost. There is no `~/.local/state/cleveragents/tui.db` file created or used. The only persistence is the last-used persona name in `~/.config/cleveragents/tui-state.yaml`. ## Expected Behavior Per the v3.7.0 spec and ADR-044: - A SQLite database must be created at `~/.local/state/cleveragents/tui.db` on first TUI launch - TUI session state (session IDs, conversation transcripts, active session) must be persisted to this database - On TUI restart, the last active session must be restored from the database - The database path must follow XDG Base Directory Specification (`~/.local/state/`) ## Acceptance Criteria - [ ] BDD scenario: launching the TUI creates `~/.local/state/cleveragents/tui.db` - [ ] BDD scenario: session state is written to the SQLite database during a TUI session - [ ] BDD scenario: restarting the TUI restores the last active session from the database - [ ] BDD scenario: the database path is `~/.local/state/cleveragents/tui.db` (XDG-compliant) - [ ] The BDD scenario is tagged `@tdd_expected_fail` and fails on the current codebase (proving the gap) ## Subtasks - [ ] Write BDD feature file `features/tui_session_sqlite_persistence.feature` with scenarios proving the gap - [ ] Write step definitions in `features/steps/tui_session_sqlite_persistence_steps.py` - [ ] Tag scenarios with `@tdd_expected_fail` so CI passes while the bug is unfixed - [ ] Verify the scenarios fail on the current codebase (confirming the gap) - [ ] Link this issue as a dependency of the fix issue (Type/Bug) ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `main`, reviewed, and **merged** before this issue is marked done. --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor
HAL9000 added this to the v3.7.0 milestone 2026-04-13 20:13:00 +00:00
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#8499
No description provided.