UAT: TUI session persistence uses wrong database path — spec requires ~/.local/state/cleveragents/tui.db but implementation uses ~/.cleveragents/cleveragents.db #5940

Open
opened 2026-04-09 12:01:23 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area: TUI Reference and Command Input System — Session Persistence
Component: src/cleveragents/config/settings.py, src/cleveragents/application/container.py
Spec Reference: docs/specification.md §TUI — Session Persistence (line 30145), v3.7.0 milestone acceptance criterion #8


What Was Tested

Code-level analysis of the database path configuration in src/cleveragents/config/settings.py (lines 310–315) and src/cleveragents/application/container.py (lines 502–543) against the specification's TUI session persistence requirements.


Expected Behavior (from spec §TUI — Session Persistence, line 30145)

Sessions are stored in an SQLite database at ~/.local/state/cleveragents/tui.db

The v3.7.0 milestone acceptance criterion #8 (spec line 46981) also states:

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

The spec explicitly requires:

  1. TUI sessions stored at ~/.local/state/cleveragents/tui.db
  2. This is separate from the main application database

Actual Behavior (from code)

In src/cleveragents/config/settings.py, lines 310–315:

database_url: str = Field(
    default_factory=lambda: (
        f"sqlite:///{Path.home() / '.cleveragents' / 'cleveragents.db'}"
    ),
    validation_alias=AliasChoices("CLEVERAGENTS_DATABASE_URL"),
)

The default database path is ~/.cleveragents/cleveragents.db, not ~/.local/state/cleveragents/tui.db.

Furthermore, the _build_session_service() function in container.py (lines 502–543) uses this same database_url for TUI session persistence — it does not use a separate TUI-specific database at the XDG state path.

This means:

  1. The TUI sessions are stored in ~/.cleveragents/cleveragents.db instead of ~/.local/state/cleveragents/tui.db
  2. TUI sessions share the same database as all other application data (plans, resources, etc.) instead of being in a separate file
  3. The XDG Base Directory Specification (~/.local/state/) is not followed

Code Locations

  • src/cleveragents/config/settings.py, lines 310–315 (wrong default path)
  • src/cleveragents/application/container.py, lines 502–543 (_build_session_service uses shared DB)

Expected Schema

The spec (lines 30147–30158) defines a specific TUI session table schema with columns: id, persona_name, actor_identity, title, prompt_count, total_cost, created_at, last_used, project_path, meta_json. This schema is TUI-specific and should live in the dedicated tui.db file.


Severity Assessment

Non-critical for immediate functionality (sessions still persist), but this is a spec deviation that affects:

  • XDG compliance (wrong directory)
  • Separation of concerns (TUI state mixed with application data)
  • The v3.7.0 milestone acceptance criterion #8 explicitly names this path

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

## Bug Report **Feature Area:** TUI Reference and Command Input System — Session Persistence **Component:** `src/cleveragents/config/settings.py`, `src/cleveragents/application/container.py` **Spec Reference:** docs/specification.md §TUI — Session Persistence (line 30145), v3.7.0 milestone acceptance criterion #8 --- ## What Was Tested Code-level analysis of the database path configuration in `src/cleveragents/config/settings.py` (lines 310–315) and `src/cleveragents/application/container.py` (lines 502–543) against the specification's TUI session persistence requirements. --- ## Expected Behavior (from spec §TUI — Session Persistence, line 30145) > Sessions are stored in an SQLite database at `~/.local/state/cleveragents/tui.db` The v3.7.0 milestone acceptance criterion #8 (spec line 46981) also states: > **Session database**: TUI session state stored in `~/.local/state/cleveragents/tui.db` (SQLite); separate from main `~/.local/share/cleveragents/data.db`. The spec explicitly requires: 1. TUI sessions stored at `~/.local/state/cleveragents/tui.db` 2. This is **separate** from the main application database --- ## Actual Behavior (from code) In `src/cleveragents/config/settings.py`, lines 310–315: ```python database_url: str = Field( default_factory=lambda: ( f"sqlite:///{Path.home() / '.cleveragents' / 'cleveragents.db'}" ), validation_alias=AliasChoices("CLEVERAGENTS_DATABASE_URL"), ) ``` The default database path is `~/.cleveragents/cleveragents.db`, not `~/.local/state/cleveragents/tui.db`. Furthermore, the `_build_session_service()` function in `container.py` (lines 502–543) uses this same `database_url` for TUI session persistence — it does **not** use a separate TUI-specific database at the XDG state path. This means: 1. The TUI sessions are stored in `~/.cleveragents/cleveragents.db` instead of `~/.local/state/cleveragents/tui.db` 2. TUI sessions share the same database as all other application data (plans, resources, etc.) instead of being in a separate file 3. The XDG Base Directory Specification (`~/.local/state/`) is not followed --- ## Code Locations - `src/cleveragents/config/settings.py`, lines 310–315 (wrong default path) - `src/cleveragents/application/container.py`, lines 502–543 (`_build_session_service` uses shared DB) --- ## Expected Schema The spec (lines 30147–30158) defines a specific TUI session table schema with columns: `id`, `persona_name`, `actor_identity`, `title`, `prompt_count`, `total_cost`, `created_at`, `last_used`, `project_path`, `meta_json`. This schema is TUI-specific and should live in the dedicated `tui.db` file. --- ## Severity Assessment **Non-critical for immediate functionality** (sessions still persist), but this is a **spec deviation** that affects: - XDG compliance (wrong directory) - Separation of concerns (TUI state mixed with application data) - The v3.7.0 milestone acceptance criterion #8 explicitly names this path --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
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#5940
No description provided.