Uh oh!
There was an error while loading. Please reload this page.
feat(cli): auto-update — nudge + tracebloc upgrade (F1) - #390
Conversation
Customers run the installer once and then never again, so they silently sit on an old CLI. Three layers, all safe (no silent binary swap): - Update-check nudge: after any command, a quiet one-liner if a newer release exists. Throttled to once/day via a cache in ~/.tracebloc, network capped at 2s, best-effort. Silent on dev builds, off a terminal, in CI, or with TRACEBLOC_NO_UPDATE_CHECK. Nudges from cache; refreshes when stale. - `tracebloc upgrade`: the apply step. Re-runs the official installer (curl … | bash) so it reuses the existing cosign verification and upgrades the CLI + the secure environment together (no version skew) — no new download/ verify surface in the CLI. - The existing 426 "CLI too old" error now points at `tracebloc upgrade`. Tests cover the semver compare (incl. v-prefix + pre-release), cache round-trip, the GitHub fetch (httptest), fresh-vs-stale cache behavior, and the skip gates. Catalog: adds 11-upgrade.golden. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
LukasWodka
commented
Jul 22, 2026
bugbot run |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Three medium-severity issues from Cursor Bugbot: 1. Offline throttle broken (update_check.go): on a failed fetch, latestReleaseVersion fell back to the stale cache but never re-stamped CheckedAt, so the cache stayed expired and every command re-hit the network and ate the 2s timeout while offline. Now re-stamps CheckedAt so the once-per-interval throttle actually holds. 2. Nudge fired after a successful `tracebloc upgrade` (main.go): the nudge used the running process's compile-time version, which is stale by design once upgrade swaps the binary — so it claimed a newer release existed right after the user installed it. main now captures the executed command via ExecuteContextC and skips the nudge for `upgrade`. 3. `upgrade` broken on Windows (upgrade.go): it hardcoded `bash i.sh`, but Windows is a shipped platform (install.ps1, windows/* build matrix) with no bash — while the new 426 message tells users to run `upgrade`. Now branches on GOOS to run install.ps1 via PowerShell on Windows. Adds regression tests: offline-fetch throttle refresh, per-OS upgrade command, and the upgrade nudge-skip detector. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
shujaatTracebloc
commented
Jul 23, 2026
Pushed fixes for the 3 Bugbot findings (commit 63d43d4), plus merged latest
Added regression tests: offline-fetch throttle refresh, per-OS upgrade command, upgrade nudge-skip detector. Full |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 63d43d4. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Round-2 Bugbot review of the auto-update work surfaced 3 real HIGH issues, all verified against scripts/install.ps1: 1. Upgrade hid curl failures: `curl … | bash` ran under `bash -c` without pipefail, so a failed curl left the trailing `bash` exiting 0 on empty stdin and `upgrade` reported success having installed nothing. Now runs with `bash -o pipefail -c`. 2/3. Windows self-upgrade can't work: install.ps1 is CLI-only (no environment upgrade) and Move-Items the binary into place, which Windows blocks for a running .exe. Proper Windows self-update is a separate feature, so instead of pretending, `upgrade` on Windows now prints the documented manual command to run in a fresh shell (no tracebloc process holding the binary). Help/home/copy no longer promise CLI+environment parity on Windows. Refactors the per-OS branch into upgradePlanFor(goos) (exec on Unix, guide on Windows) so it's testable on any host. Regenerates copy-catalog goldens. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
shujaatTracebloc
commented
Jul 23, 2026
Round-2 fixes pushed (commit
Refactored the per-OS branch into Windows automatic self-upgrade (running-exe swap + Windows environment story) is worth its own ticket — happy to file it. |
Uh oh!
There was an error while loading. Please reload this page.
Resolves the develop conflict (branched before the upgrade #390 and prepare-host #394 commands merged): copy_catalog_test.go auto-merged to keep all three commands' catalog entries; regenerated goldens (zz-all-strings + 00-home + 08-client) so the harvested strings and command lists include upgrade, prepare-host, and the seal-check screens together. No code conflicts; the seal logic is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Fixes the stale-CLI problem (backlog F1): install once → never updated.
~/.tracebloc, 2s network cap, best-effort). Silent on dev builds, off a terminal, in CI, or viaTRACEBLOC_NO_UPDATE_CHECK.tracebloc upgrade— re-runs the verified installer (reuses cosign; upgrades CLI + environment together, no skew).tracebloc upgrade.Not a silent auto-replace (surprise/latency/security/skew) — nudge + one-command apply, the gh/kubectl pattern. Tests: semver compare, cache, fetch (httptest), fresh/stale, skip gates. Catalog:
11-upgrade.golden.🤖 Generated with Claude Code
Note
Medium Risk
upgradeshells out to curl|bash on Unix (trusted installer path, but still elevated user impact); update checks add outbound GitHub traffic on interactive release builds only.Overview
Adds F1 stale-CLI handling: a best-effort update nudge after commands plus an explicit
tracebloc upgradepath, without silent auto-replace.mainswitches toExecuteContextCso it knows which command ran, then callsMaybeNotifyUpdateon stderr (skipped afterupgrade). The nudge checks GitHub’s latest release at most once per day (cached under~/.tracebloc), with a 2s timeout; it stays quiet on dev builds, non-TTY, CI, orTRACEBLOC_NO_UPDATE_CHECK.tracebloc upgradeon Linux/macOS re-runs the signed official installer viabash -o pipefail(CLI + secure environment stay aligned); on Windows it only prints the PowerShell install command because the running binary can’t replace itself.HTTP 426 upgrade-required copy now points at
tracebloc upgradeinstead of generic release URLs. Copy catalog gains11-upgrade.goldenand home help listsupgrade.Reviewed by Cursor Bugbot for commit ab10dc7. Bugbot is set up for automated code reviews on this repo. Configure here.