fix: prompt to re-run after self-update instead of continuing on stale binary#65
Merged
Conversation
…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
There was a problem hiding this comment.
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
exittest seam and afinishSuccessfulUpdatehelper that prints a re-run message and exits with code0. - 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running
thicket startwhen 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.Apply→swapBinary) 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,PersistentPreRunreturns and thestartcommand 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:
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— extractfinishSuccessfulUpdate(errOut, tag); print the re-run message andexit(0).exitis 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 singleexit(0).README.md— document the re-run behavior in the Self-update section..changes/unreleased/— changieFixedfragment.Verification
go test ./...— full suite greengo build ./...— buildsgolangci-lint run+go vet— clean🤖 Generated with Claude Code
https://claude.ai/code/session_01BBqhECkiepRLjoGvg2fG2w