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
shellNo 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. Assistant
I'll start by exploring the repository structure to understand the installer code and find where the navigation flow is implemented.
Assistant
The command didn't show any output. Let me try a different approach.
<tool_call> <function=bash_terminal> <parameter=command> ls -la /gentle-ai </tool_call>
Assistant
Let me try using bash_terminal properly to explore the repository structure.
Assistant
This is a Go project. Let me explore the structure to find the installer code.
Assistant
Let me look for the TUI screens and navigation logic.
Assistant
Let me explore the router and navigation logic.
Assistant
Let me look at the detection screen since that's likely where installation targets are selected.
Assistant
Let me search for "Pi" related code since that's the installation target mentioned in the issue.
Assistant
Let me search for the preset or persona screens, as that's where installation targets might be selected.
Assistant
Let me look at the preset screen which seems to be where installation targets are selected.
Assistant
Let me look at the model file to understand the preset IDs and screens better.
Assistant
Let me look at specific parts of the model related to preset handling and the agents/preset flow.
Assistant
Now I can see the issue is related to
isPiOnlyAgentsand back navigation. Let me look at the key sections more closely.Assistant
Let me look at the
isPiOnlyAgentsfunction and the back navigation logic in the model.go file around lines 1489-1510.Assistant
Let me use a different approach to read those specific lines.
Assistant
Let me look at the back navigation handling for ScreenDependencyTree.
Assistant
Let me look at the
goBackfunction and the ScreenDependencyTree back handling more carefully.Assistant
Let me look at the
goBackfunction:Assistant
Let me see the rest of the goBack function:
Assistant
Now let me look at the
shouldShowfunctions to understand which screens are conditionally shown:Assistant
Let me find the
shouldShowfunction definitions:Assistant
Let me look at the shouldShow functions to understand the conditions:
Assistant
Assistant
Let me view the end of the goBack function to see what happens when ScreenDependencyTree doesn't match any condition.
Assistant
Assistant
Let me view the ScreenDependencyTree handleKey section to see how Enter and Back are handled there.
Assistant
Let me check the renderDependencyTree function to understand how options are displayed:
Assistant
Let me look at the DependencyTreeOptions to understand the options displayed:
Assistant
Now I see that for non-custom presets (like Pi-only), the DependencyTree shows a read-only plan with "Continue" and "Back" options. The issue is in the handleKey for ScreenDependencyTree at lines 1804-1830:
goAssistant
Let me view the persona.go file to understand the Persona screen options.
Assistant
Assistant
Let me look at the agents.go screen file.
Assistant
Assistant
Let me search for test files properly.
Assistant
Now I understand the issue. Let me summarize my findings:
Root Cause Analysis
The bug occurs when:
- User selects only "Pi" as the installation target on the Agents screen
- This causes the installer to skip Persona, Preset, SDDMode, etc., and go directly to ScreenDependencyTree
- When the user presses Back (either via Esc or selecting "Back" option), the installer goes to ScreenPreset instead of ScreenAgents
- This is because the
goBack()function andhandleKeyfor ScreenDependencyTree checkshouldShow*conditions which all return false for Pi-only mode, and then fall through to ScreenPreset
The Fix
The fix needs to add a check for Pi-only mode in two places:
- In
goBack()function - to handle Esc key press from ScreenDependencyTree - In
handleKeyfor ScreenDependencyTree - to handle selecting "Back" option
Both places should go to ScreenAgents when in Pi-only mode.
Let me implement the fix:
Assistant
Let me look at the exact code sections I need to modify:
Assistant
Now let me look at the handleKey for ScreenDependencyTree (the "Back" option handling):
Assistant
Now I understand the issue clearly. Let me trace through the bug:
- User selects only Pi on Agents screen
- Continues → goes to DependencyTree (because
isPiOnlyAgentsis true, skipping Persona/Preset screens) - On DependencyTree, user presses "Back" (either selecting the option or pressing Esc)
For handleKey (selecting "Back" option):
- Checks
shouldShowStrictTDDScreen(),shouldShowSDDModeScreen(),shouldShowClaudeModelPickerScreen() - All return false for Pi-only (Components = [Engram], no Claude/OpenCode agents)
- Falls through to
m.setScreen(ScreenPreset)← BUG: should go to ScreenAgents
For goBack() (pressing Esc):
- Checks
shouldShowOpenCodePluginsScreen(),shouldShowStrictTDDScreen(),shouldShowClaudeModelPickerScreen() - All return false for Pi-only
- Falls through to
PreviousScreen(ScreenDependencyTree)= ScreenPreset (from linearRoutes) ← BUG: should go to ScreenAgents
Let me implement the fix in both places:
Assistant
Now I understand the issue clearly. Let me fix both places:
- In
goBack()- add Pi-only check before falling through to default backward route - In
handleKeyfor ScreenDependencyTree - add Pi-only check before the else clause
Let me first edit the
goBack()function:- In
Assistant
Now I need to make two changes:
- In
goBack()(around line 2448-2450), add a check for Pi-only mode before the default fallback to PreviousScreen - In handleKey for ScreenDependencyTree (around line 1818-1822), add a check for Pi-only mode before the else clause
Let me make these changes. </tool_call>
- In
Assistant
Let me now make the actual changes to fix the issue.
For the goBack() function, I need to add a check for Pi-only mode before the default fallback to PreviousScreen. Currently, the code checks shouldShow* conditions for ScreenDependencyTree, and if none match, it falls through to PreviousScreen(ScreenDependencyTree) which is ScreenPreset.
I need to add a check: if in Pi-only mode, go to ScreenAgents instead.
For the handleKey for ScreenDependencyTree, I need to add a check for Pi-only mode before the else clause that sets ScreenPreset.
Let me make these changes now.
Assistant
Looking at the code more carefully, I see that:
-
In
goBack()(around lines 2436-2450), there's a check forScreenDependencyTreethat checks shouldShow* conditions. If none match, it falls through to the default backward route (PreviousScreen) which goes to ScreenPreset. -
In
handleKeyforScreenDependencyTree(around lines 1805-1822), there's similar logic that checks shouldShow* conditions and falls through tom.setScreen(ScreenPreset)in the else clause.
For Pi-only mode, all shouldShow* conditions are false, so it falls through to ScreenPreset. But for Pi-only, it should go to ScreenAgents instead.
Let me fix the goBack() function first by adding a Pi-only check:
-
Assistant
Let me check the current state of the file:
Assistant
The goBack() function has been fixed. Now let me fix the handleKey for ScreenDependencyTree as well:
Assistant
Now I need to fix the handleKey for ScreenDependencyTree. The issue is that for Pi-only mode, all the
shouldShow*checks are false, so it falls through to theelseclause which sets ScreenPreset. For Pi-only mode, it should go to ScreenAgents instead.Assistant
OK, so the issue is that for the handleKey case of ScreenDependencyTree, when the user selects "Back" (cursor != 0), the code checks
shouldShowStrictTDDScreen(),shouldShowSDDModeScreen(), andshouldShowClaudeModelPickerScreen(). If none of these are true, it falls through tom.setScreen(ScreenPreset).For Pi-only mode, all these conditions are false (since Components = [Engram] and Agents = [Pi]), so it goes to ScreenPreset. But it should go to ScreenAgents instead.
The fix is to change the else clause to check for Pi-only mode first.
Let me edit this code:
Assistant
Let me check if the sed command worked:
Assistant
The sed command corrupted the file. Let me restore it and use a cleaner approach.
Assistant
Let me restore the file and use a more careful approach to make the changes.
Assistant
Let me make the changes properly using the edit command with precise line ranges.
First, let me view the exact sections I need to modify:
Assistant
I need to carefully make two changes to fix the issue. Let me first examine the exact code sections that need to be modified.
Assistant
Let me make the fix properly using the edit command. I need to change the
elseclause at line 1821 to check for Pi-only mode first.Assistant
I need to fix the issue where back navigation from Pi-only install shows unrelated Gentle AI configuration. Let me carefully make the edits using the correct format.
I need to:
- Fix the handleKey for ScreenDependencyTree - change the else clause to check for Pi-only mode first
- Fix the goBack() function - add a Pi-only check before falling through to default backward route
Let me use the edit command with the correct format.
Assistant
Let me try a different approach - I'll use sed to make the specific changes needed. First, let me check what the current file looks like around the lines I need to modify.
Assistant
I see the issue - I need to use the correct file path. The current directory is /gentle-ai, so I should use
internal/tui/model.goinstead ofgentle-ai/internal/tui/model.go.Assistant
Let me use the edit command with the correct syntax. Looking at the error, it seems the tool call format might not be parsed correctly. Let me try with the proper format.
Assistant
The edit command is not working as expected. Let me check if my earlier sed command corrupted the file, and then use a Python script to make the changes properly.
Assistant
Let me use a Python script to make both changes properly.
Assistant
Let me verify the changes were applied correctly.
Assistant
The edit was successful. Let me verify the second change in goBack() as well.
Assistant
The code compiles successfully. Now let me verify that the existing tests pass and ensure my fix handles all edge cases properly.
Assistant
Let me check the current state of the changes and verify everything is correct.
Assistant
The changes look correct. Let me verify the code compiles properly and run the existing tests to make sure nothing is broken.
Assistant
Let me check if Go is properly set up and try to build the project.
Assistant
The go build is failing because of module cache issues. Let me try setting up the environment properly and running the build.
Assistant
The code compiles successfully. Now let me run the existing tests to make sure my changes don't break anything.
Assistant
All the TUI tests pass. Let me also run the broader test suite to make sure everything works.
Assistant
The full test suite timed out, but the TUI tests all passed. Let me verify my fix is correct by looking at the code flow once more and checking for any edge cases.
Assistant
All TUI tests pass. Let me verify the fix is complete by checking the isPiOnlyAgents function and understanding the full code flow.
Assistant
Let me verify my fix is complete and correct by reviewing all the changes and ensuring edge cases are handled.
Assistant
Let me verify the fix is complete and correct.
Assistant
The fix is complete. Let me provide a summary of what was fixed:
Summary
Issue: When selecting only "Pi" as the installation target and pressing Back on the next step (DependencyTree), the installer showed unrelated Gentle AI configuration screens (TDD, multi-agent, communication style) instead of returning to the installation target selection (Agents screen).
Root Cause: In Pi-only mode, the installer skips Persona, Preset, and other configuration screens and goes directly from Agents to DependencyTree. However, when going Back from DependencyTree:
- The
handleKeyhandler checkedshouldShowStrictTDDScreen(),shouldShowSDDModeScreen(), andshouldShowClaudeModelPickerScreen()— all false for Pi-only mode - It then fell through to the
elseclause which setScreenPreset - Similarly,
goBack()(Esc key) checked the same conditions and fell through toPreviousScreen(ScreenDependencyTree)which is ScreenPreset per the linear routes
- The
Assistant
The submit command didn't work as expected. Let me try again with the proper format.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.