Skip to content

Fix: Prevent duplicate CLI errors and unescape AI newlines - #124

Merged
thomas-vilte merged 3 commits into
masterfrom
dev
Jul 31, 2026
Merged

Fix: Prevent duplicate CLI errors and unescape AI newlines#124
thomas-vilte merged 3 commits into
masterfrom
dev

Conversation

@thomas-vilte

@thomas-vilte thomas-vilte commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Description

I've implemented a robust error handling mechanism to prevent duplicate error messages from being displayed in the CLI. Previously, errors handled by ui.PrintError or ui.HandleAppError could still be caught and re-printed by the top-level error handler in main.go. This change introduces ui.Shown and ui.IsShown functions to explicitly mark errors that have already been presented to the user, ensuring they are not printed again.

Additionally, this PR addresses an issue with AI-generated content from the Gemini model. The model occasionally emits literal escape sequences instead of actual newline characters within Markdown fields like PR bodies and issue descriptions. I've added an unescapeLiteralNewlines helper function and integrated it into the Gemini service to automatically convert these literal escape sequences into proper newlines, ensuring correct Markdown rendering.

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

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

  • Unit tests
  • Integration tests
  • Manual test: (describe below)
    New unit tests were added for the unescapeLiteralNewlines function in internal/ai/gemini/helper_test.go and for the Shown and IsShown error wrapping in internal/ui/ui_test.go.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Test Plan & Evidence

Suggested Manual Verification

  • API/Backend: Attach JSON response or logs as evidence of correct behavior
  • Performance: Ensure no significant latency increase
  • Unit Tests: Run go test ./... and ensure all tests pass
  • No Regressions: Verify that related features still work as expected

@thomas-vilte thomas-vilte changed the title placeholder fix(cli): prevent duplicate error messages Jul 31, 2026
@thomas-vilte thomas-vilte added fix Bug fixes refactor Code restructuring or cleaning without functional changes test Testing, trials, and coverage labels Jul 31, 2026
@thomas-vilte thomas-vilte changed the title fix(cli): prevent duplicate error messages fix(cli): Prevent duplicate error messages and refactor UI error handling Jul 31, 2026
@thomas-vilte thomas-vilte changed the title fix(cli): Prevent duplicate error messages and refactor UI error handling Fix: Prevent duplicate CLI errors and unescape AI newlines Jul 31, 2026
@thomas-vilte
thomas-vilte merged commit 0595a0b into master Jul 31, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fixes refactor Code restructuring or cleaning without functional changes test Testing, trials, and coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant