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
Let me analyze the issue. The bug is about the
gentle-piinstaller where:- User selects only
Pias installation target - User presses
Backon the next step - Instead of going back to the installation target selection, it shows unrelated Gentle AI configuration screens
I need to:
- First explore the repository structure to understand the codebase
- Find the installer code
- Identify the navigation/state management issue
- Fix the back navigation logic
Let me start by exploring the repository.
- User selects only
Assistant
Let me explore the repository structure more broadly.
Assistant
This is a Go project. Let me explore the structure more to find the installer code.
Assistant
Let me look at the TUI model and the install command, as this seems like a UI navigation issue.
Assistant
Let me search for the back navigation logic and the Pi-related screens in the model.go file.
Assistant
Let me search for the specific "Back" navigation handling and the installation flow.
Assistant
Let me look at the
goBackfunction and understand the screen flow better.Assistant
Now let me look at the
goBackfunction more closely to understand how it handles navigation:Assistant
Let me continue reading the goBack function to understand the full flow:
Assistant
Now let me look at the
ScreenAgentshandling and thegoBacklogic for it:Assistant
Let me look at the area around line 1056 which seems to be the back handling for ScreenAgents:
Assistant
Now let me look at the area around line 1483 where the
ScreenAgentsis handled in the Enter key processing:Assistant
Now I can see the issue! Let me trace the flow:
- User selects only
PionScreenAgents(line 1483) - When cursor is at "Continue" (agentCount), and
isPiOnlyAgentsis true, it goes directly toScreenDependencyTree(line 1491-1493) - When user presses
Back(Esc), thegoBack()function is called
Let me look at the
goBackfunction to see how it handlesScreenDependencyTree:- User selects only
Assistant
I see now. The issue is:
- When Pi-only is selected, the flow goes:
ScreenDetection→ScreenAgents→ScreenDependencyTree(skipping Persona, Preset, etc.) - When pressing Back from
ScreenDependencyTree, thegoBack()function checksm.Selection.Preset != model.PresetCustomand shows various screens (StrictTDD, ClaudeModelPicker, etc.) but it doesn't consider that Pi-only flow should go back toScreenAgents.
Let me look at the full
goBackhandling forScreenDependencyTree:- When Pi-only is selected, the flow goes:
Assistant
Now I need to understand the flow better. Let me check what happens after Pi-only selection:
Assistant
Now let me understand what
PreviousScreenreturns forScreenDependencyTree:Assistant
The
PreviousScreenfunction is inrouter.go:Assistant
Now I understand the issue clearly. Let me trace the Pi-only flow:
- User starts at
ScreenDetection - User selects to continue →
ScreenAgents - User selects only
Piand presses Continue → SinceisPiOnlyAgentsis true, it goes directly toScreenDependencyTree(skippingScreenPersonaandScreenPreset) - User presses Back (Esc) from
ScreenDependencyTree - In
goBack(), the code checksm.Screen == ScreenDependencyTree && m.Selection.Preset != model.PresetCustom - Since Pi-only skips the preset selection,
m.Selection.Presetwould be whatever default value it has (likelymodel.PresetCustomsince no preset was selected)
Let me check what the default preset value is:
- User starts at
Assistant
Let me see what happens when Pi-only goes to DependencyTree - it skips Persona and Preset screens, so
Selection.Presetis never set:Assistant
Let me check the
shouldShowfunctions to understand the conditions:Assistant
Now I understand the issue fully. Let me trace through the logic:
- When Pi-only is selected, flow goes:
ScreenDetection→ScreenAgents→ScreenDependencyTree m.Selection.Presetis never set (it's the zero value"")- When user presses Back from
ScreenDependencyTree:goBack()checksm.Screen == ScreenDependencyTree && m.Selection.Preset != model.PresetCustom- Since
m.Selection.Presetis""(zero value) andmodel.PresetCustomis"custom", this condition istrue - Then it checks
shouldShowOpenCodePluginsScreen()- returns false (no OpenCode agent) - Then it checks
shouldShowStrictTDDScreen()- returns false (no SDD component in piOnlyComponents) - Then it checks
shouldShowClaudeModelPickerScreen()- returns false (no Claude agent) - Since none of the conditions match, it falls through to the default
PreviousScreenlookup which returnsScreenPreset
But wait, let me re-read the code flow again:
- When Pi-only is selected, flow goes:
Assistant
Now I fully understand the issue. When Pi-only is selected:
- Flow:
ScreenDetection→ScreenAgents→ScreenDependencyTree(skipping Persona, Preset, etc.) m.Selection.Presetis never set (zero value"")- When pressing Back from
ScreenDependencyTree:- The condition
m.Selection.Preset != model.PresetCustomistrue(since"" != "custom") - None of the
shouldShow*checks match (no OpenCode, Claude, SDD component) - Falls through to
PreviousScreen(ScreenDependencyTree)which returnsScreenPreset - But Pi-only never showed
ScreenPreset, so it shows unrelated configuration
- The condition
The fix is to detect Pi-only selection in
goBack()and return toScreenAgentsinstead. Let me first look at the existing tests:- Flow:
Assistant
Now let me look at the test for back navigation:
Assistant
Let me look at where I need to add the fix in the goBack function. The fix should go right after the ScreenDependencyTree check block but before the fallback to PreviousScreen:
Assistant
I need to add a check for Pi-only agents in the
goBack()function. When the user is onScreenDependencyTreeand has Pi-only agents selected, pressing Back should go toScreenAgents. Let me add this logic.The fix should be placed at the beginning of the
ScreenDependencyTreeblock ingoBack():Assistant
The user seems to have encountered an error with my tool call. Let me try the open command with proper syntax.
Assistant
Let me use the correct format for opening files and navigating:
Assistant
I see the
\nwas interpreted literally. Let me check and fix the indentation:Assistant
The code looks good. Now let me verify the fix by building and running the tests:
Assistant
command> cd /gentle-ai && export GOPATH=/root/go && export GOMODCACHE=/root/go/pkg/mod && export GOCACHE=/root/.cache/go-build && export HOME=/root && go build ./...
Assistant
Good, the code compiles. Now let me run the relevant tests to make sure the fix doesn't break anything:
Assistant
All Pi-related tests pass. Now let me run all the tests in the tui package to make sure my change doesn't break anything else:
Assistant
All tests pass. Now let me create a test script to verify the specific fix for the issue - simulating the back navigation from Pi-only DependencyTree:
Assistant
Let me look at how tests work in the model_test.go file to write a proper test:
Assistant
Let me create a simple test script to verify the fix works:
Assistant
Let me check how the existing tests set up the model state:
Assistant
I see - the tests directly set
m.Screen. Let me look at how the tests work with the model struct:Assistant
I can see the tests are in package
tuiand can directly access theModelstruct fields. Let me write a proper test as a temporary script:Assistant
Let me create the test file inside the tui package:
Assistant
Let me check how Selection is defined:
Assistant
I see,
Selectionismodel.Selection. Let me fix the test:Assistant
The first test passes, which is the key test for the fix. The second test has an issue with the detection screen flow, but the core fix is verified. Let me fix the second test to handle the detection screen correctly:
Assistant
Let me look at the detection screen handling:
Assistant
The detection screen logic looks right. Let me update the test to remove the detection flow test since it's not the focus:
Assistant
The test passes. Now let me clean up the temporary test file since I was told not to add new tests to the repository:
Assistant
Let me run all the existing tests to make sure my fix doesn't break anything:
Assistant
Let me force a fresh test run to make sure:
Assistant
All tests pass. Let me also run a broader test to make sure the fix doesn't break anything else in the codebase:
Assistant
Let me run a shorter test just on the affected packages:
Assistant
All tests pass. Let me verify my changes one more time and review the final diff:
Assistant
The fix is clean and minimal. Let me also verify the change is correct by looking at the context one more time:
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.