ISSUE DESCRIPTION fix(installer): back navigation from Pi-only install shows unrelated…
- User
ISSUE DESCRIPTION
fix(installer): back navigation from Pi-only install shows unrelated Gentle AI configuration
Pre-flight Checklist
- I have searched existing issues and this is not a duplicate
- I understand that PRs will be rejected if the linked issue does not have
status:approved
📝 Bug Description
When running the
gentle-piinstaller fromgentle-ai, if I select onlyPias the installation target and then useBackon the next step,
the installer returns to an unexpected configuration flow.Instead of going back to the previous installation target selection, it shows configuration options that do not correspond to the selected
Pi-only path, such as TDD configuration, multi-agent installation, communication style, and related Gentle AI setup options.🔄 Steps to Reproduce
- Start the
gentle-aiinstaller.
2. Select onlyPias the installation target.
3. Continue to the next step.
4. SelectBack.
5. Observe that the installer shows configuration screens for TDD, multi-agent setup, speaking style, etc.
✅ Expected Behavior
After selecting
Back, the installer should return to the previous relevant step in the Pi-only installation flow, likely the installation
target selection screen.❌ Actual Behavior
The installer jumps to unrelated Gentle AI configuration screens, including TDD setup, multi-agent installation, communication style, and other
options that were not expected after choosing a Pi-only installation.Gentle AI Version
v 1.30.5
Operating System
macOS
AI Agent / Client
Other
📋 Affected Area
CLI (commands, flags)
💡 Logs / Error Output
No logs available. This appears to be an installer navigation/state-flow issue.Additional Context
This happens specifically when selecting only
Piduring installation and then navigating back from the following step.Interface
No new interfaces are introduced.
- Assistant
I'll start by exploring the repository structure to understand the codebase and locate the installer-related code. Let me first check the current directory and look for relevant files.
- Assistant
Let me get a better overview of the repository structure.
- Assistant
Let me explore the repository structure more deeply.
- Assistant
Let me make one call at a time.
- Assistant
The
internal/installcmddirectory looks very relevant to the installer. Let me also checkinternal/tuisince it likely handles the terminal UI. - Assistant
Let me look at the router and the screens directory for installer navigation logic.
- Assistant
Let me examine the router and model files to understand the installer navigation flow.
- Assistant
Now I need to understand the installer flow better. Let me look at the model.go file to see how the navigation works, particularly when going back from a Pi-only installation. Let me first search for "pi" or "Pi" related code.
- Assistant
Let me look at the model.go file, which is the largest file and likely contains the main TUI logic, especially the navigation flow.
- Assistant
Found
isPiOnlyAgentsat line 469. Let me look at that area and the surrounding navigation logic. - Assistant
Let me look at the key sections around the isPiOnlyAgents function and the navigation logic.
- Assistant
Let me look at line 1489 to see where the piOnlyComponents is called during navigation:
- Assistant
Let me look at the
setScreenmethod and understand the screen flow for Pi-only installations: - Assistant
Let me see the setScreen method:
- Assistant
Now let me look at how the Back key is handled on ScreenDependencyTree:
- Assistant
Let me look at the main handler for ScreenDependencyTree around line 802:
- Assistant
Now let me look at the section handling the
ScreenDependencyTreecase inhandleKeyPress: - Assistant
Let me look at the case at line 1758 which is likely in handleKeyPress:
- Assistant
I can see the issue now. When the user selects only Pi, the flow goes from
ScreenAgentsdirectly toScreenDependencyTree, bypassingScreenPersona,ScreenPreset, and other configuration screens. However, when the user presses Back fromScreenDependencyTree, it falls through to the general back logic which checks for various configuration screens (StrictTDD, SDDMode, ClaudeModelPicker) and eventually goes toScreenPreset.Let me also check the
goBack()function: - Assistant
Let me look at the goBack function:
- Assistant
Let me continue reading the goBack function and check the shouldShow functions:
- Assistant
Now let me look at how the DependencyTree's back button works. The issue is when Pi is selected only, it goes to DependencyTree, and when pressing Back it shows unrelated configuration screens (TDD, multi-agent, etc.) instead of going back to ScreenAgents. Let me understand the full flow.
- Assistant
Now I understand the issue. Let me check the tests to understand the expected behavior better:
- Assistant
Let me look at the existing tests to understand the expected behavior better:
- Assistant
Let me check if there are any tests for the back navigation from the dependency tree for pi-only:
- Assistant
Let me search for tests that might exist for the back navigation from DependencyTree when Pi is the only agent:
- Assistant
Now I have a clear understanding of the issue. Let me verify my understanding by looking at the
shouldShowStrictTDDScreenand related functions to understand what they return for Pi-only installations: - Assistant
Let me look at these functions:
- Assistant
Now I understand the issue. Let me trace the full flow. Let me see the rest of the goBack function and the linearRoutes fallback:
- Assistant
Now I have a complete understanding of the issue. Let me trace through the flow:
- User selects only Pi at
ScreenAgents confirmSelectionskips directly toScreenDependencyTree(bypassingScreenPersona,ScreenPreset, etc.)- When pressing Back from
ScreenDependencyTree,goBack()runs:- The
if m.Screen == ScreenDependencyTree && m.Selection.Preset != model.PresetCustomblock is entered - But Pi-only only has
ComponentEngramso none ofshouldShowStrictTDDScreen(),shouldShowClaudeModelPickerScreen(), etc. return true - Falls through to the general fallback:
PreviousScreen(m.Screen)which maps toScreenPresetin the router - This is incorrect! It should go back to
ScreenAgents
- The
Similarly in
confirmSelection(Enter handler for "← Back"), the final else also goes toScreenPreset.Let me also check the
confirmSelectionback logic more carefully: - User selects only Pi at
- Assistant
Now I have a clear picture of the bug. Let me trace the flow:
- At
ScreenAgents, user selects only Pi and continues → skips directly toScreenDependencyTree - On
ScreenDependencyTree, when pressing Back (cursor != 0, on the "← Back" option):- The code checks if it's
PresetCustom- it's not (it'sPresetFullGentleman) - Falls through to non-custom branch where cursor != 0
- Checks
shouldShowStrictTDDScreen(),shouldShowSDDModeScreen(),shouldShowClaudeModelPickerScreen()- all false for Pi-only (only hasComponentEngram) - Falls to the
elsebranch:m.setScreen(ScreenPreset)← BUG!
- The code checks if it's
Same issue exists in
goBack()(Esc handler) - it falls through toPreviousScreen(m.Screen)which maps toScreenPreset.The fix: In both places, check if the selection is Pi-only, and if so, go back to
ScreenAgentsinstead.Let me now implement the fix. First, let me verify that
screensAgentOptions()helper exists: - At
- Assistant
Let me find it:
- Assistant
Now let me implement the fix. I need to modify two places:
- The
goBack()function - for Esc key navigation - The
confirmSelection()logic inScreenDependencyTreecase - for Enter on "← Back"
Let me first apply the fix in
goBack(): - The
- Assistant
Now I'll implement the fix. I need to edit two places in
internal/tui/model.go:- In
goBack()- add a check for Pi-only agents when onScreenDependencyTree - In the
confirmSelectionScreenDependencyTreecase - add a check for Pi-only agents when pressing "← Back"
Let me fix the
goBack()function first: - In
- Assistant
Now let me open the file and make the edits:
- Assistant
Now I understand the full picture. When Pi is the only agent selected:
- Forward flow: ScreenAgents → ScreenDependencyTree (skipping Persona, Preset, etc.)
- Back flow: ScreenDependencyTree → falls through to ScreenPreset (because none of the shouldShow* conditions match for Pi-only)
The fix needs to be in two places:
- In
confirmSelection(line ~1808): when pressing Back from DependencyTree in Pi-only mode, go to ScreenAgents - In
goBack(line ~2436): when pressing Esc from DependencyTree in Pi-only mode, go to ScreenAgents
Let me fix both:
- Assistant
Good, the
goBack()function is fixed. Now I need to fix the second place - theconfirmSelectionlogic inhandleKeyPressaround line 1808: - Assistant
Let me see the broader context around that section:
- Assistant
Now I need to apply the same fix in the
confirmSelectioncase forScreenDependencyTree. Let me add the Pi-only check: - Assistant
I notice there's an issue with the edit - it seems to have merged the
ScreenSkillPickercase incorrectly. Let me check the context around line 1827: - Assistant
I see that the edit seems to have messed up the
case ScreenSkillPicker:section. It removed thecase ScreenSkillPicker:andswitch {andcase m.Cursor < len(allSkills):lines. Let me fix this: - Assistant
Wait, I see the problem now. The
case ScreenSkillPicker:is now incorrectly placed inside thecase ScreenDependencyTree:block. Let me check the current state: - Assistant
I see the issue - the
ScreenDependencyTreecase is missing its closing}. Thecase ScreenSkillPickeris nested inside it now. Let me fix this properly: - Assistant
I see the
case m.Cursor < len(allSkills):is now empty. Let me fix that: - Assistant
Good, the code looks correct now. Let me verify the fix is properly applied by looking at the ScreenDependencyTree case in both places:
- Assistant
Let me also verify the goBack function fix:
- Assistant
Both fixes look correct. Now let me compile and run the tests to make sure everything works:
- Assistant
Let me check if Go is available:
- Assistant
Need to set GOMODCACHE or GOPATH.
- Assistant
Let me set HOME too.
- Assistant
Good, the build succeeds. Now let me run the tests:
- Assistant
All Pi-related tests pass. Let me run the full test suite for the tui package:
- Assistant
All tests pass. Let me also run the full test suite:
- Assistant
The full test suite timed out. Let me run just the relevant packages:
- Assistant
All tests pass. Let me verify the diff of my changes:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.