Skip to content

fix: prompt to re-run after self-update instead of continuing on stale binary#65

Merged
uribrecher merged 1 commit into
mainfrom
fix/self-update-rerun
Jun 23, 2026
Merged

fix: prompt to re-run after self-update instead of continuing on stale binary#65
uribrecher merged 1 commit into
mainfrom
fix/self-update-rerun

Conversation

@uribrecher

Copy link
Copy Markdown
Owner

Problem

Running thicket start when a new release is available prompts to update; after agreeing, the update succeeds but the start page still shows the previous version. You have to stop the run and start again to actually use the new version — confusing UX.

Root cause

The self-updater (updater.ApplyswapBinary) atomically replaces the binary file on disk, but the running process keeps executing the old code already loaded in memory — replacing an executable's file doesn't hot-swap a live process. So after the swap, PersistentPreRun returns and the start command body runs the old version's UI. The old code even printed "Continuing with your original command using the previous binary…", which is exactly the stale render the user saw.

Fix

After a successful in-place update, print a completion message and exit cleanly instead of continuing on the stale binary:

Update to v0.10.0 completed successfully. Please re-run the CLI to use this latest version.

The next invocation runs the freshly-installed binary, and the 24h-cached update probe then sees it's already on latest — so nothing re-prompts. No new flags needed; it's self-correcting.

Changes

  • internal/updater/updater.go — extract finishSuccessfulUpdate(errOut, tag); print the re-run message and exit(0). exit is an injectable package var (= os.Exit) following the package's existing test-seam pattern.
  • internal/updater/updater_test.go — TDD test asserting the message content and a single exit(0).
  • README.md — document the re-run behavior in the Self-update section.
  • .changes/unreleased/ — changie Fixed fragment.

Verification

  • go test ./... — full suite green
  • go build ./... — builds
  • golangci-lint run + go vet — clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01BBqhECkiepRLjoGvg2fG2w

…e binary

The self-updater swaps the binary on disk, but the running process keeps
executing the old code already loaded in memory — so `thicket start` rendered
the previous version's UI until the user manually stopped and restarted.

After a successful in-place update we now print a "completed — please re-run"
message and exit cleanly. The next invocation runs the freshly-installed
binary, and the 24h-cached update probe then sees it's already on latest, so
nothing re-prompts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BBqhECkiepRLjoGvg2fG2w
Copilot AI review requested due to automatic review settings June 23, 2026 04:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a confusing self-update UX where thicket start (and other commands) could continue executing the old in-memory binary after an on-disk self-update, causing the UI to show the previous version. After a successful in-place update from the pre-run prompt, the CLI now prints a clear completion message and exits cleanly so the user can re-run on the newly installed binary.

Changes:

  • Add an injectable exit test seam and a finishSuccessfulUpdate helper that prints a re-run message and exits with code 0.
  • Update updater tests to assert the message content and that the process exits exactly once with code 0.
  • Document the “re-run after successful self-update” behavior in the README and add a changelog fragment.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
README.md Documents that thicket exits after a successful self-update and prompts the user to re-run to load the new binary.
internal/updater/updater.go Stops post-update execution on the stale binary by printing a completion message and exiting after a successful Apply.
internal/updater/updater_test.go Adds a unit test verifying the re-run message and the single exit(0) behavior.
.changes/unreleased/Fixed-20260623-073650.yaml Records the behavioral change in the changelog fragments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@uribrecher
uribrecher merged commit 7c8c82c into main Jun 23, 2026
5 checks passed
@uribrecher
uribrecher deleted the fix/self-update-rerun branch June 23, 2026 04:40
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.

2 participants