Skip to content

Add ambient update notice for interactive TTY sessions#358

Merged
jeremy merged 8 commits intomainfrom
ambient-update-notice
Mar 24, 2026
Merged

Add ambient update notice for interactive TTY sessions#358
jeremy merged 8 commits intomainfrom
ambient-update-notice

Conversation

@jeremy
Copy link
Member

@jeremy jeremy commented Mar 23, 2026

Summary

  • Shows a non-intrusive update notice on stderr when a newer CLI version is available
  • Uses a background goroutine started in PersistentPreRunE — zero added latency
  • 24-hour disk cache at ~/.config/basecamp/.update-check to avoid hitting GitHub API on every invocation
  • Respects BASECAMP_NO_UPDATE_CHECK=1 env var to opt out
  • Suppressed for non-interactive/machine consumers (--json, --agent, --quiet, piped output)
  • Suppressed after basecamp upgrade and basecamp doctor (which have their own version checks)

Stacked on #357 (plugin-update-awareness) since both modify root.go's PersistentPostRunE.

Test plan

  • TestStartUpdateCheck_SkipsDevBuild — nil for dev builds
  • TestStartUpdateCheck_SkipsWhenEnvSet — nil when env var set
  • TestStartUpdateCheck_UsesFreshCache — uses cached version without network
  • TestStartUpdateCheck_StaleCacheFetchesInBackground — fires goroutine on stale cache
  • TestStartUpdateCheck_NoCacheFetchesInBackground — fires goroutine on missing cache
  • TestNotice_NonBlocking — returns empty without blocking on unfinished goroutine
  • Non-TTY invocations skip update check entirely (verified: no notice on piped output)

Detect outdated Claude Code plugin installations by comparing the
installed plugin version against the CLI version. Show a warning
in `basecamp doctor` and a one-time post-upgrade hint pointing
users to enable auto-update in Claude Code. The setup wizard now
recommends enabling auto-update after plugin installation.
Copilot AI review requested due to automatic review settings March 23, 2026 20:52
@github-actions github-actions bot added commands CLI command implementations tests Tests (unit and e2e) enhancement New feature or request labels Mar 23, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a best-effort, non-blocking CLI update check that can display an ambient “update available” notice on stderr for interactive TTY sessions, backed by a 24h on-disk cache under the global config directory.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Changes:

  • Introduces UpdateCheck + cache read/write helpers and a background version fetch (StartUpdateCheck, Notice).
  • Hooks the update check into the root command lifecycle (start in PersistentPreRunE, print notice in PersistentPostRunE when interactive).
  • Adds unit tests covering dev/opt-out, cache freshness behavior, background fetch behavior, and non-blocking notice semantics.

Reviewed changes

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

File Description
internal/commands/update_notice.go Implements background update checking and a disk cache for latest version discovery.
internal/commands/update_notice_test.go Adds tests for cache behavior and non-blocking notice generation.
internal/cli/root.go Wires the update check into CLI startup/shutdown and conditionally prints the notice.

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

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e5309aef32

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

@jeremy jeremy force-pushed the ambient-update-notice branch from e5309ae to d4e7c3f Compare March 23, 2026 22:25
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4e7c3f6ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The version mismatch check was in the generic agent Checks list,
causing the setup wizard and other callers to treat a version
difference as 'plugin not installed'. The version check now only
appears in `basecamp doctor`.
Copilot AI review requested due to automatic review settings March 23, 2026 23:05
@jeremy jeremy force-pushed the ambient-update-notice branch from d4e7c3f to 4c0b178 Compare March 23, 2026 23:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


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

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c0b1787b3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

jeremy added 4 commits March 23, 2026 16:24
Show a non-intrusive update notice on stderr when a newer CLI
version is available. Uses a background goroutine with a 24-hour
cache to avoid adding latency to commands. Respects
BASECAMP_NO_UPDATE_CHECK=1 and suppresses output for non-interactive
or machine consumers.
@jeremy jeremy force-pushed the ambient-update-notice branch from 4c0b178 to 573334f Compare March 23, 2026 23:24
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 573334fe13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Doctor already has its own live version check — showing the
ambient notice on top of it would be redundant.
Copilot AI review requested due to automatic review settings March 23, 2026 23:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


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

Base automatically changed from plugin-update-awareness to main March 24, 2026 05:04
@jeremy jeremy merged commit cee1212 into main Mar 24, 2026
12 checks passed
@jeremy jeremy deleted the ambient-update-notice branch March 24, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands CLI command implementations enhancement New feature or request tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants