tui/app: _complete_first_run() is never called — first-run actor selection does not persist chosen actor #10387

Open
opened 2026-04-18 09:22:42 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit: fix(tui/app): wire _complete_first_run() to ActorSelectionOverlay confirmation event
  • Branch: fix/tui-app-complete-first-run-never-called

Background and Context

_complete_first_run() in _TextualCleverAgentsTuiApp is defined at line 140 of src/cleveragents/tui/app.py but is NEVER called from any event handler. When a new user selects an actor in the first-run overlay and confirms, the chosen actor is NOT persisted as the default persona. The TUI silently falls back to "local/mock-default", completely breaking the first-run user experience.

Confirmed via git grep -n "_complete_first_run" -- "src/cleveragents/tui/" which shows only the definition at line 140, with zero call sites.

Expected Behavior

After confirming actor selection, _complete_first_run(actor) is called, which:

  1. Calls create_default_persona_for_actor(registry, actor) to persist the persona
  2. Calls _refresh_persona_bar() to update the UI

Acceptance Criteria

  • A Textual message/event handler exists that fires when ActorSelectionOverlay.confirm() is called
  • The handler calls _complete_first_run(actor) with the user's chosen actor
  • create_default_persona_for_actor(registry, actor) is called with the correct actor
  • _refresh_persona_bar() is called after persona creation
  • The persona bar shows the user-chosen actor, not "local/mock-default"
  • All tests from the linked TDD issue (#10385) pass

Subtasks

  • Add a Textual message/event handler (e.g., on_actor_selection_overlay_confirmed) to _TextualCleverAgentsTuiApp
  • Wire the handler to call _complete_first_run(event.actor)
  • Alternatively, emit a custom Textual Message from ActorSelectionOverlay.confirm() that the parent app handles
  • Verify _refresh_persona_bar() is called after persona creation
  • Confirm all TDD tests from #10385 pass

Bug Report

Summary

_complete_first_run() in _TextualCleverAgentsTuiApp is defined but never called from any event handler. When a new user selects an actor in the first-run overlay and confirms, the chosen actor is NOT persisted as the default persona. The TUI silently falls back to "local/mock-default".

Code Evidence

File: src/cleveragents/tui/app.py

# on_mount() shows the overlay on first run:
actor_overlay = self.query_one("#actor-selection", ActorSelectionOverlay)
if first_run:
    actor_overlay.show()   # ← overlay is shown
else:
    actor_overlay.hide()

# _complete_first_run() is defined but NEVER called:
def _complete_first_run(self, actor: str) -> None:
    """Persist the chosen actor as the default persona and refresh the bar."""
    create_default_persona_for_actor(self._persona_state.registry, actor)
    self._refresh_persona_bar()

Confirmed: git grep -n "_complete_first_run" -- "src/cleveragents/tui/" returns only the definition at line 140, with zero call sites.

There is no Textual event handler (e.g., on_actor_selection_overlay_confirmed) that calls _complete_first_run() after the user confirms their selection.

Steps to Reproduce

  1. Launch the TUI with no personas configured (first run)
  2. The actor selection overlay appears
  3. Navigate to an actor (e.g., anthropic/claude-4-sonnet) and press Enter to confirm
  4. The overlay hides, but no persona is created

Actual Behavior

_complete_first_run() is never called. The registry remains empty. On the next call to _refresh_persona_bar(), registry.ensure_default() is called with the fallback actor "local/mock-default" instead of the user's chosen actor.

Fix Path

Add a Textual message/event handler that fires when ActorSelectionOverlay.confirm() is called, and wire it to _complete_first_run(). For example:

def on_actor_selection_overlay_confirmed(self, event: ActorSelectionOverlay.Confirmed) -> None:
    self._complete_first_run(event.actor)

Or alternatively, emit a custom Textual Message from ActorSelectionOverlay.confirm() that the parent app can handle.

Blocked By

#10385

Definition of Done

This issue should be closed when _complete_first_run() is properly wired to the ActorSelectionOverlay confirmation event, the chosen actor is persisted as the default persona, and all TDD tests from #10385 pass.


Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit:** `fix(tui/app): wire _complete_first_run() to ActorSelectionOverlay confirmation event` - **Branch:** `fix/tui-app-complete-first-run-never-called` ## Background and Context `_complete_first_run()` in `_TextualCleverAgentsTuiApp` is defined at line 140 of `src/cleveragents/tui/app.py` but is NEVER called from any event handler. When a new user selects an actor in the first-run overlay and confirms, the chosen actor is NOT persisted as the default persona. The TUI silently falls back to `"local/mock-default"`, completely breaking the first-run user experience. Confirmed via `git grep -n "_complete_first_run" -- "src/cleveragents/tui/"` which shows only the definition at line 140, with zero call sites. ## Expected Behavior After confirming actor selection, `_complete_first_run(actor)` is called, which: 1. Calls `create_default_persona_for_actor(registry, actor)` to persist the persona 2. Calls `_refresh_persona_bar()` to update the UI ## Acceptance Criteria - [ ] A Textual message/event handler exists that fires when `ActorSelectionOverlay.confirm()` is called - [ ] The handler calls `_complete_first_run(actor)` with the user's chosen actor - [ ] `create_default_persona_for_actor(registry, actor)` is called with the correct actor - [ ] `_refresh_persona_bar()` is called after persona creation - [ ] The persona bar shows the user-chosen actor, not `"local/mock-default"` - [ ] All tests from the linked TDD issue (#10385) pass ## Subtasks - [ ] Add a Textual message/event handler (e.g., `on_actor_selection_overlay_confirmed`) to `_TextualCleverAgentsTuiApp` - [ ] Wire the handler to call `_complete_first_run(event.actor)` - [ ] Alternatively, emit a custom Textual `Message` from `ActorSelectionOverlay.confirm()` that the parent app handles - [ ] Verify `_refresh_persona_bar()` is called after persona creation - [ ] Confirm all TDD tests from #10385 pass ## Bug Report ### Summary `_complete_first_run()` in `_TextualCleverAgentsTuiApp` is defined but never called from any event handler. When a new user selects an actor in the first-run overlay and confirms, the chosen actor is NOT persisted as the default persona. The TUI silently falls back to `"local/mock-default"`. ### Code Evidence **File:** `src/cleveragents/tui/app.py` ```python # on_mount() shows the overlay on first run: actor_overlay = self.query_one("#actor-selection", ActorSelectionOverlay) if first_run: actor_overlay.show() # ← overlay is shown else: actor_overlay.hide() # _complete_first_run() is defined but NEVER called: def _complete_first_run(self, actor: str) -> None: """Persist the chosen actor as the default persona and refresh the bar.""" create_default_persona_for_actor(self._persona_state.registry, actor) self._refresh_persona_bar() ``` Confirmed: `git grep -n "_complete_first_run" -- "src/cleveragents/tui/"` returns only the definition at line 140, with zero call sites. There is no Textual event handler (e.g., `on_actor_selection_overlay_confirmed`) that calls `_complete_first_run()` after the user confirms their selection. ### Steps to Reproduce 1. Launch the TUI with no personas configured (first run) 2. The actor selection overlay appears 3. Navigate to an actor (e.g., `anthropic/claude-4-sonnet`) and press Enter to confirm 4. The overlay hides, but no persona is created ### Actual Behavior `_complete_first_run()` is never called. The registry remains empty. On the next call to `_refresh_persona_bar()`, `registry.ensure_default()` is called with the fallback actor `"local/mock-default"` instead of the user's chosen actor. ### Fix Path Add a Textual message/event handler that fires when `ActorSelectionOverlay.confirm()` is called, and wire it to `_complete_first_run()`. For example: ```python def on_actor_selection_overlay_confirmed(self, event: ActorSelectionOverlay.Confirmed) -> None: self._complete_first_run(event.actor) ``` Or alternatively, emit a custom Textual `Message` from `ActorSelectionOverlay.confirm()` that the parent app can handle. ### Blocked By #10385 ## Definition of Done This issue should be closed when `_complete_first_run()` is properly wired to the `ActorSelectionOverlay` confirmation event, the chosen actor is persisted as the default persona, and all TDD tests from #10385 pass. --- **Automated by CleverAgents Bot** Agent: new-issue-creator
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#10387
No description provided.