[PR #4625] fix: auto upgrade toast message #11048

Closed
opened 2026-02-16 18:15:49 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4625

State: closed
Merged: Yes


Problem

  1. Upgrade toast notifications weren't showing because upgrade() was called in worker initialization before any clients connected to the event stream
  2. When auto-update is disabled, users weren't notified that updates are available

Solution

  1. Added checkUpgrade() RPC method to worker that calls upgrade() in proper Instance context
  2. TUI thread triggers checkUpgrade() via RPC after TUI starts, ensuring Instance is bootstrapped
  3. Added Installation.Event.UpdateAvailable to notify users when auto-update is disabled without auto-updating them
  4. Added toast notification handler in TUI to display manual update prompt when updates are available but auto-update is off

Testing

  • Verified auto-update complete toast notification appears when auto-update is enabled
  • Verified manual update available toast notification appears when auto-update is disabled
  • Both notifications display the correct version information

Files Changed

  • packages/opencode/src/cli/cmd/tui/worker.ts - Added checkUpgrade() RPC method with Instance.provide()
  • packages/opencode/src/cli/cmd/tui/thread.ts - Call checkUpgrade() RPC after TUI starts
  • packages/opencode/src/installation/index.ts - Added UpdateAvailable event definition
  • packages/opencode/src/cli/upgrade.ts - Modified to publish UpdateAvailable event when auto-update is disabled
  • packages/opencode/src/cli/cmd/tui/app.tsx - Added toast handler for UpdateAvailable event
  • packages/sdk/js/src/gen/types.gen.ts - Regenerated SDK types to include UpdateAvailable event

IMG_8329

Screenshot 2025-11-22 at 12 56 56 PM
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4625 **State:** closed **Merged:** Yes --- ### Problem 1. Upgrade toast notifications weren't showing because `upgrade()` was called in worker initialization before any clients connected to the event stream 2. When auto-update is disabled, users weren't notified that updates are available ### Solution 1. Added `checkUpgrade()` RPC method to worker that calls `upgrade()` in proper Instance context 2. TUI thread triggers `checkUpgrade()` via RPC after TUI starts, ensuring Instance is bootstrapped 3. Added `Installation.Event.UpdateAvailable` to notify users when auto-update is disabled without auto-updating them 4. Added toast notification handler in TUI to display manual update prompt when updates are available but auto-update is off ### Testing - Verified auto-update complete toast notification appears when auto-update is enabled - Verified manual update available toast notification appears when auto-update is disabled - Both notifications display the correct version information ### Files Changed - `packages/opencode/src/cli/cmd/tui/worker.ts` - Added checkUpgrade() RPC method with Instance.provide() - `packages/opencode/src/cli/cmd/tui/thread.ts` - Call checkUpgrade() RPC after TUI starts - `packages/opencode/src/installation/index.ts` - Added UpdateAvailable event definition - `packages/opencode/src/cli/upgrade.ts` - Modified to publish UpdateAvailable event when auto-update is disabled - `packages/opencode/src/cli/cmd/tui/app.tsx` - Added toast handler for UpdateAvailable event - `packages/sdk/js/src/gen/types.gen.ts` - Regenerated SDK types to include UpdateAvailable event ![IMG_8329](https://github.com/user-attachments/assets/75c01a67-0296-41a8-b5bb-437c3a166dea) <img width="1362" height="430" alt="Screenshot 2025-11-22 at 12 56 56 PM" src="https://github.com/user-attachments/assets/0e07a3cf-8ce7-410e-8f51-63348bd387a9" />
yindo added the pull-request label 2026-02-16 18:15:49 -05:00
yindo closed this issue 2026-02-16 18:15:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11048