#470

fix(installer): show a failed save on the form instead of leaving the screen

OpenAlaeddineMessadiwants to merge intofrom

Description of the Change

Problem

When HandleSave fails on an installer form, BaseScreen.saveConfiguration logs the error and returns nil (base_screen.go#L781-L792). The status line can only show "Unsaved changes" or "Configuration saved", so Ctrl+S changes nothing on screen. Enter goes through saveAndReturn, which reads that nil as success and navigates back, so the edits are left unsaved without a word. The error only appears in the installer log. This is what the reporter of #449 hit ("Pressing Ctrl+S does nothing — no error, no feedback"), and it applies to every form built on BaseScreen, not only AI Agents Settings.

Solution

BaseScreen keeps the save error and shows it in the existing status line with the error style ("Save failed: …", new locale.UISaveFailed). Enter stays on the screen while the save fails. A later successful save or a reset (Ctrl+R) clears the error. The log line is unchanged and no individual form is touched.

Refs #449. #451 fixes the blank optional limits that triggered the report; this PR covers the missing feedback and does not overlap it.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Configuration change
  • 🧪 Test update
  • 🛡️ Security update

Areas Affected

  • Core Services (Frontend UI/Backend API)
  • AI Agents (Researcher/Developer/Executor)
  • Security Tools Integration
  • Memory System (Vector Store/Knowledge Base)
  • Monitoring Stack (Grafana/OpenTelemetry)
  • Analytics Platform (Langfuse)
  • External Integrations (LLM/Search APIs)
  • Documentation
  • Infrastructure/DevOps (the installer TUI)

Testing and Verification

Test Configuration

PentAGI Version: main @ cffed94
Docker Version: n/a (unit tests)
Host OS: Linux
LLM Provider: n/a
Enabled Features: n/a
Go: 1.26.5

Test Steps

  1. cd backend && go generate ./cmd/installer/files/
  2. go test ./cmd/installer/... -race -count=1
  3. go vet ./cmd/installer/wizard/... and golangci-lint v2.12.2 on the touched packages

Test Results

New base_screen_test.go drives the screen through Update with Ctrl+S, Enter and Ctrl+R and reads View():

  • TestBaseScreen_Update_ShowsTheSaveErrorInTheStatusLine
  • TestBaseScreen_Update_EnterStaysOnTheScreenWhenSaveFails
  • TestBaseScreen_Update_ASuccessfulSaveClearsTheSaveError
  • TestBaseScreen_Update_ResetDropsTheSaveError

All installer packages pass with -race; go vet and golangci-lint report nothing. With base_screen.go reverted to main and the tests kept, the first two fail:

--- FAIL: TestBaseScreen_Update_ShowsTheSaveErrorInTheStatusLine/ctrl+s_replaces_the_unsaved-changes_warning_with_the_error
    base_screen_test.go:55: ... expected to find "Save failed: disk full"
--- FAIL: TestBaseScreen_Update_EnterStaysOnTheScreenWhenSaveFails
    base_screen_test.go:68: enter navigated with {Target: GoBack:true} although the save failed

Removing the saveErr = nil in the success path or in the reset fails the other two.

Security Considerations

None. The error text shown is the same one already written to the log.

Performance Impact

None.

Documentation Updates

  • README.md updates
  • API documentation updates
  • Configuration documentation updates
  • GraphQL schema updates
  • Other:

Deployment Notes

None.

Checklist

Code Quality

  • My code follows the project's coding standards
  • I have added/updated necessary documentation
  • I have added tests to cover my changes
  • All new and existing tests pass
  • I have run go fmt and go vet (for Go code)
  • I have run pnpm run lint (for TypeScript/JavaScript code)

Security

  • I have considered security implications
  • Changes maintain or improve the security model
  • Sensitive information has been properly handled

Compatibility

  • Changes are backward compatible
  • Breaking changes are clearly marked and documented
  • Dependencies are properly updated

Documentation

  • Documentation is clear and complete
  • Comments are added for non-obvious code
  • API changes are documented

Additional Notes

One behaviour change for every form: a form whose HandleSave returns an error now stays open on Enter instead of navigating back. Forms whose HandleSave always succeeds behave as before.