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.ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use to restore the file to its original state. You can also reset all changes in the repository using command. Additionally, you can use and to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted.
Assistant
Let me start by exploring the repository structure to understand the codebase and find the installer code that's causing the back navigation issue.
Assistant
No Python files found. Let me explore the repository structure more broadly.
Assistant
This is a Go project. Let me look for installer-related code.
Assistant
Let me look at the TUI (Terminal User Interface) code since the issue is about installer navigation.
Assistant
Let me look at the main model.go file to understand the installer flow and the back navigation logic.
Assistant
Let me search for "back" navigation logic in the model.go file:
Assistant
Let me search more specifically for back navigation and the Pi-only flow:
Assistant
Let me look at the goBack function:
Assistant
Now let me look at the
PreviousScreenfunction and also understand the Pi-only flow better:Assistant
Now let me find the
PreviousScreenfunction:Assistant
I need to use the correct syntax for the open command - it should be just the file path without the FILE= prefix.
Assistant
Now I understand the flow. Let me look at how the Pi-only flow works. The user selects agents, and if Pi-only is selected, the flow should be different. Let me trace the flow after selecting Pi-only:
Assistant
Now let me look at the ScreenAgents handling in more detail, especially around line 1483 where Pi-only is checked:
Assistant
Now I can see the issue! When Pi-only is selected (line 1489-1493), it goes to
ScreenDependencyTree. But when pressing Back fromScreenDependencyTree, thegoBack()function (line 2416-2428 in thegoBackfunction) checks if it's NOT a custom preset and then shows various screens like StrictTDD, ClaudeModelPicker, etc.Let me check what happens when going back from ScreenDependencyTree for Pi-only:
Assistant
couldn't complete its analysis because it was cut off. Let me continue examining the code by looking at the full goBack function section that handles ScreenDependencyTree. </tool_call>
Assistant
Let me continue examining the code to understand the full flow of ScreenDependencyTree back navigation.
Assistant
Let me understand the issue better. When Pi-only is selected, the flow skips Persona and Preset screens and goes directly to DependencyTree. But when going back, the code checks for non-custom presets and shows TDD, ClaudeModelPicker, etc. screens. Let me check what those
shouldShowfunctions return for Pi-only:Assistant
Let me find the definition of these
shouldShowfunctions to understand when they return true, especially for Pi-only agents.Assistant
Now I need to understand what these functions check. Let me look at them.
Assistant
Now I need to see the other shouldShow functions to understand the full picture.
Assistant
Now I understand the issue. Let me examine what happens in the Pi-only flow and confirm my understanding:
Assistant
Let me trace the exact flow for Pi-only selection and understand what preset value is set.
Assistant
Now I see the issue clearly! When Pi-only is selected:
- User selects Pi agent on ScreenAgents
- The code detects Pi-only (
isPiOnlyAgentsreturns true) - It sets
m.Selection.Components = piOnlyComponents()(which is just[model.ComponentEngram]) - It skips Persona and Preset screens and goes directly to
ScreenDependencyTree - But
m.Selection.Presetis NOT set to anything (it retains its default/initial value)
When user presses Back from ScreenDependencyTree, the
goBack()function checks:if m.Screen == ScreenDependencyTree && m.Selection.Preset != model.PresetCustom {Since
m.Selection.Presetis NOT set toPresetCustom(it's probably empty or default), this condition is true. Then it checksshouldShowStrictTDDScreen(), which returns true if SDD component is selected. For Pi-only, only Engram is selected, so SDD shouldn't be there...Wait, let me check what
piOnlyComponents()returns and if it includes SDD:Assistant
Good, so
piOnlyComponents()returns[]model.ComponentID{model.ComponentEngram}, which does NOT include SDD. SoshouldShowStrictTDDScreen()should return false.Let me trace through more carefully what happens in
goBack()for Pi-only fromScreenDependencyTree:Assistant
The code after the
ScreenDependencyTreecheck goes to the defaultPreviousScreenfunction at the end ofgoBack(). Let me see what happens when none of the special cases match:Assistant
Now let me check what returns. Looking at :
Assistant
Now I understand the problem clearly. The
isPiOnlyAgentsfunction can be called withm.Selection.Agentsto check if we're in Pi-only mode. I need to add special handling in thegoBack()function for when the user is onScreenDependencyTreeand is in Pi-only mode - it should go back toScreenAgentsinstead ofScreenPreset.Let me first look at the exact location in
goBack()where I need to add this fix:Assistant
Now I understand the issue. When Pi-only is selected, the flow goes:
ScreenAgents→ScreenDependencyTree(skipping Persona and Preset). But when pressing Back fromScreenDependencyTree, it falls through to the defaultPreviousScreen()which returnsScreenPreset, which is wrong because the Pi-only flow never went through ScreenPreset.The fix should add a check for Pi-only mode in the
goBack()function's handling ofScreenDependencyTree, so it goes back toScreenAgentsinstead.Let me implement the fix:
Assistant
The issue is clear now. When Pi-only is selected:
- Flow goes:
ScreenAgents→ScreenDependencyTree(skipping Persona and Preset) - Back from
ScreenDependencyTreefalls through to defaultPreviousScreen()which returnsScreenPreset - This is wrong - it should go back to
ScreenAgents
The fix should add a check at the beginning of the
ScreenDependencyTreehandling block ingoBack()to check for Pi-only mode and redirect toScreenAgents.I need to add this check before or within the existing block that handles
ScreenDependencyTreewithm.Selection.Preset != model.PresetCustom.The best place would be to add a check for Pi-only at the start of the ScreenDependencyTree back handling:
// Pi-only flow: back from DependencyTree should return to Agents selection. if m.Screen == ScreenDependencyTree && isPiOnlyAgents(m.Selection.Agents) { m.setScreen(ScreenAgents) return m }This should be placed before the existing non-custom preset check, so Pi-only is handled first.
- Flow goes:
Assistant
I can see the issue clearly now. When Pi-only is selected, the flow skips Persona and Preset screens and goes directly to DependencyTree. But when pressing Back from DependencyTree, the code at line 2436 checks
m.Selection.Preset != model.PresetCustomwhich is true (since Preset is empty for Pi-only), but none of the shouldShow checks match (since Pi-only only has Engram component). So it falls through toPreviousScreen(ScreenDependencyTree)which returnsScreenPreset- which is wrong because Pi-only never went through ScreenPreset.The fix is to add a check for Pi-only agents before the existing non-custom preset check. Let me implement it:
Assistant
The edit command failed because no file is currently open. I need to use the --file option to specify the file to edit.
Assistant
Let me verify the change looks correct:
Assistant
The edit looks correct. Now let me also check if there are any similar issues in other places. The
confirmSelectionfunction is mentioned in the comment "NOTE: DependencyTree back logic also in confirmSelection() — keep in sync." Let me check if there's similar logic there that needs updating:Assistant
Let me check the confirmSelection function to see if similar logic exists there:
Assistant
Let me continue to see the confirmSelection function and check if there's similar logic that needs to be updated for Pi-only back navigation.
Assistant
I see there's similar logic in the
confirmSelectionfunction for handling back navigation fromScreenDependencyTree. Let me check if the same Pi-only fix needs to be applied there. Let me look at the exact code for the DependencyTree back button handling:Assistant
I need to check the confirmSelection function for the ScreenDependencyTree case and see if it also needs the Pi-only fix. The code I saw shows that for the back button from ScreenDependencyTree (the "default" case after the "Continue" button), it checks various shouldShow functions and falls back to ScreenPreset. This is the same issue as in goBack().
Let me find the exact location in confirmSelection where ScreenDependencyTree back handling is done.
Assistant
Let me check the confirmSelection function around line 1758 which is the ScreenDependencyTree case:
Assistant
I see the same issue in
confirmSelection. The back button fromScreenDependencyTree(line 1803-1821) also falls through toScreenPresetwhen none of the shouldShow checks match. I need to add the same Pi-only check here.Assistant
I see there's an extra closing brace on line 1827 that needs to be removed. Let me check the current state of the file and fix it.
Assistant
I see there's a missing closing brace for the
if m.Cursor == 0block, and an extra one at the end. Let me fix this:Assistant
Now let me verify the code compiles correctly by running the Go build:
Assistant
The build succeeded. Now let me run the existing tests to make sure I haven't broken anything:
Assistant
The tests are passing. Let me run all the tests to make sure I haven't broken anything else, and also look for any tests specifically related to the Pi-only back navigation to see if there's an existing test I should check.
Assistant
All tests pass. Let me also verify by running the full test suite for the TUI package:
Assistant
Let me verify the exact changes I made by reviewing the diff:
Assistant
The changes look correct. Let me now summarize my work and verify the checklist:
Summary of Changes
The bug was that when a user selected only
Pias the installation target in the installer, the flow correctly skipped the Persona and Preset screens and went directly to the DependencyTree screen. However, when pressingBackfrom the DependencyTree screen, it incorrectly navigated to the Preset screen (via the defaultPreviousScreen()lookup) instead of going back to the Agents selection screen.Root Cause
In the Pi-only flow, the installer skips Persona and Preset screens, going directly from
ScreenAgents→ScreenDependencyTree. But both thegoBack()function (for Esc key) andconfirmSelection()function (for Enter on "Back" option) did not handle this case specially. They fell through to the default navigation, which forScreenDependencyTreepoints backward toScreenPreset- but Pi-only flow never visited that screen.Fix
Added a check for Pi-only agents in two places:
Assistant
The full test suite timed out, but the TUI tests already passed. Let me run just the TUI and model-related tests again to confirm:
Assistant
All TUI tests pass. Let me also verify the build is still working:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.