You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.7 KiB
Markdown
42 lines
1.7 KiB
Markdown
---
|
|
# claudbg-zi1d
|
|
title: TUI session list shows no sessions — state.sessions never populated on startup
|
|
status: in-progress
|
|
type: bug
|
|
priority: high
|
|
created_at: 2026-03-30T17:05:02Z
|
|
updated_at: 2026-03-30T17:05:05Z
|
|
parent: claudbg-i6l2
|
|
---
|
|
|
|
## Problem
|
|
|
|
The TUI session list is always empty. `run_tui()` in `src/tui/run.rs` creates `AppState::new()` (which has `sessions: Vec::new()`) and enters the event loop without ever loading sessions from disk.
|
|
|
|
## Root cause
|
|
|
|
`discover_sessions()` in `src/parser/discovery.rs` is never called from the TUI startup path. The session list screen renders from `state.sessions` which stays empty forever.
|
|
|
|
## Fix
|
|
|
|
Before entering the event loop in `run_tui()`, call `discover_sessions()` and convert each `SessionRef` into a `SessionListItem`, then populate `state.sessions`.
|
|
|
|
### SessionRef → SessionListItem mapping
|
|
- `short_id` = first 8 chars of `session_id`
|
|
- `full_id` = `session_id`
|
|
- `date` = `modified_at.format("%Y-%m-%d %H:%M:%S")`
|
|
- `project` = `project_path.unwrap_or_default()`
|
|
- `model` = `""` (leave empty — would require parsing JSONL)
|
|
- `msg_count` = 0 (leave as 0 for now)
|
|
- `agent_count` = call `discover_agents_for_session(&session_ref.file_path).map(|v| v.len()).unwrap_or(0)`
|
|
|
|
Sort by `modified_at` descending (most recent first).
|
|
|
|
### Error handling
|
|
If `discover_sessions()` fails, start with an empty list (don't crash). Log the error to stderr before entering the alternate screen, or silently ignore.
|
|
|
|
## Relevant files
|
|
- `src/tui/run.rs` — `run_tui()` function, add session loading before the event loop
|
|
- `src/parser/discovery.rs` — `discover_sessions()` and `discover_agents_for_session()`
|
|
- `src/tui/state.rs` — `SessionListItem` struct
|