Skip to content

Keep self-upgrade progress interruptible - #426

Merged
kindermax merged 2 commits into
masterfrom
agent-add-self-upgrade-pre
Jul 30, 2026
Merged

Keep self-upgrade progress interruptible#426
kindermax merged 2 commits into
masterfrom
agent-add-self-upgrade-pre

Conversation

@kindermax

@kindermax kindermax commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow up on #425 to fix the remaining Ctrl-C failure while lets self upgrade is displaying download progress.

  • Use the existing throttled carriage-return renderer for interactive downloads instead of starting a Bubble Tea program.
  • Add regression coverage that rejects terminal keyboard-mode control sequences in progress output.
  • Clarify the Unreleased changelog entry with the actual behavior being fixed.

Root Cause

The Bubble Tea renderer enabled modifyOtherKeys and Kitty keyboard mode even though progress input was disabled. Supporting terminals then encoded Ctrl-C as a key event instead of generating SIGINT; the progress program ignored that input, so the CLI context was never canceled and the download continued.

The signal cleanup added in #425 remains useful, but it could not receive a signal while the progress renderer had changed terminal keyboard handling.

User Impact

Ctrl-C now remains a normal terminal interrupt during self-upgrade downloads, allowing the shared CLI context to cancel the HTTP request and extraction promptly. Other download progress indicators use the same terminal-safe renderer.

Validation

  • Deterministic PTY reproduction: before the fix, encoded Ctrl-C was ignored and progress reached 100%; after the fix, no keyboard modes are enabled and Ctrl-C terminates immediately.
  • go test ./internal/progressbar ./internal/cli ./internal/upgrade/registry
  • go test ./...
  • lets lint
  • lets test-bats (150 tests)

Summary by Sourcery

Simplify download progress rendering to avoid terminal keyboard mode changes that interfere with Ctrl-C interrupts during self-upgrade.

Bug Fixes:

  • Ensure self-upgrade download progress does not intercept Ctrl-C so terminal interrupts cancel the operation as expected.

Enhancements:

  • Use the throttled, non-interactive progress renderer consistently instead of the Bubble Tea-based animated progress bar.
  • Update terminal width detection to rely directly on the shared terminal writer utility.

Build:

  • Adjust module dependencies to treat Bubble Tea as an indirect dependency and mark golang.org/x/sys as a direct dependency.

Documentation:

  • Clarify the changelog entry to describe that self-upgrade progress indicators no longer intercept Ctrl-C.

Tests:

  • Add regression coverage asserting that progress output does not emit terminal keyboard-mode control sequences.
  • Remove obsolete tests tied to the Bubble Tea-based progress model.

Bubble Tea enabled extended keyboard handling for the progress display, causing Ctrl-C to arrive as an ignored key event instead of SIGINT. Use the existing throttled carriage-return renderer for terminal downloads so the CLI signal context can cancel in-flight requests.
@sourcery-ai

sourcery-ai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Ensure self-upgrade and other download progress indicators always use the existing throttled carriage-return renderer, removing Bubble Tea-based animation so Ctrl-C remains a normal terminal interrupt and adding regression tests and docs updates around terminal-safe behavior.

File-Level Changes

Change Details Files
Simplify the progress observer to always use the manual, throttled carriage-return renderer instead of running an animated Bubble Tea program.
  • Remove animation-related fields and options from the Observer (animate, finalPause, WithFinalPause) and default to non-animated rendering
  • Delete animatedTracker and progressModel implementations that used Bubble Tea to drive progress animation and window size handling
  • Retain manualTracker-based progress updates with throttling for both known-size and unknown-size downloads
internal/progressbar/progress.go
Harden progress output against terminal keyboard-mode side effects and add regression coverage.
  • Add a test ensuring Observer output for self-update downloads does not contain modifyOtherKeys or Kitty keyboard mode escape sequences
  • Update existing Observer tests to reflect removal of WithFinalPause and animation-only behavior
  • Remove obsolete tests that exercised Bubble Tea-based progressModel logic
internal/progressbar/progress_test.go
Adjust terminal detection utility usage to centralize terminal handling behavior.
  • Simplify detectWidth to use util.IsTerminalWriter directly instead of a local isTerminal helper
  • Remove the redundant isTerminal wrapper function
internal/progressbar/progress.go
Update module dependencies to reflect removal of direct Bubble Tea usage and promotion of x/sys to a direct dependency.
  • Remove charm.land/bubbletea/v2 from the main require block and keep it only as an indirect dependency
  • Change golang.org/x/sys from an indirect to a direct dependency
go.mod
Clarify documentation of the fixed behavior around Ctrl-C during self-upgrade.
  • Update the Unreleased changelog entry to describe that download progress indicators no longer intercept Ctrl-C during lets self upgrade
docs/docs/changelog.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@kindermax
kindermax marked this pull request as ready for review July 30, 2026 15:17
@kindermax
kindermax merged commit feed5b8 into master Jul 30, 2026
5 checks passed
@kindermax
kindermax deleted the agent-add-self-upgrade-pre branch July 30, 2026 15:17

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant