-
Notifications
You must be signed in to change notification settings - Fork 5.9k
fix: auto upgrade toast message #4625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Move upgrade() from TUI worker initialization to /event endpoint handler. The upgrade check now runs 1 second after a client connects to the event stream, ensuring proper delivery of upgrade notifications.
|
To address that issue do you think we could update upgrade function to notify the user of an update if there is one but NOT auto update them (may need to create a new event for it) |
| setTimeout(() => { | ||
| upgrade() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm this probably isn't the best spot for this tbh. The server is used in several types of environments (some people spawn these servers and connect multiple clients to it). Ideally we could have some setup w/ worker + tui thread so that once the tui is booted we run this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use worker + TUI thread approach instead. Added checkUpgrade() RPC method to worker that's called from TUI thread after startup. This ensures it only runs once per TUI session and doesn't affect other server environments.
Call upgrade() via worker.checkUpgrade() RPC from TUI thread instead of in server /event endpoint. This ensures upgrade runs in proper Instance context and avoids running on every client connection.
f1dc981 to
3e15a39
Compare
df8bdf9 to
0dd5039
Compare
…les; add newline at end of package.json files
Co-authored-by: Dax Raad <[email protected]> Co-authored-by: opencode <[email protected]>

Problem
upgrade()was called in worker initialization before any clients connected to the event streamSolution
checkUpgrade()RPC method to worker that callsupgrade()in proper Instance contextcheckUpgrade()via RPC after TUI starts, ensuring Instance is bootstrappedInstallation.Event.UpdateAvailableto notify users when auto-update is disabled without auto-updating themTesting
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 startspackages/opencode/src/installation/index.ts- Added UpdateAvailable event definitionpackages/opencode/src/cli/upgrade.ts- Modified to publish UpdateAvailable event when auto-update is disabledpackages/opencode/src/cli/cmd/tui/app.tsx- Added toast handler for UpdateAvailable eventpackages/sdk/js/src/gen/types.gen.ts- Regenerated SDK types to include UpdateAvailable event