Repository navigation
feat(tui): tell users to start OpenCode again after an update restart - #58139
Conversation
There was a problem hiding this comment.
Works as described: after /update → Restart, the TUI now prints the "Updated … run opencode to start it" line. I checked with the new app test, which fails on the base and passes here, plus the related tests and tsc -b. No real update could be installed in the sandbox.
Public API is unchanged: Exit is internal to the TUI, and every existing caller still works.
Two gaps:
- The home-screen notice for an update that installed in the background ("/exit restart to use v…",
routes/home.tsx:154) still calls a bareexit(). Restarting from there prints nothing, so users get the same silent exit this PR is fixing. See the inline comment. DialogUpdatestill says "A restart is required. Any active sessions will be resumed automatically." above a Restart button, while it actually just quits. That mismatch is what #56103 reports. It would be good to update that text here too, so the dialog matches the new notice.
Related: #56103
There was a problem hiding this comment.
The new commit works: the update restart now goes into the exit banner. Outside a session it shows "Updated / Restart opencode". Inside a session it shows "Updated" above the existing Session and Continue rows. With neither, nothing is printed, as before. I checked with the updated app test (/update → Restart, then stdout), the presentation tests, and tsc -b. All pass.
Public API is unchanged: Exit and the epilogue context are internal to the TUI.
The earlier point about the home-screen restart path is still open.
There was a problem hiding this comment.
The new commit is fine: after Restart, the banner now says "Run opencode to use ", and the Session/Continue rows still follow it inside a session. Quitting a session without an update prints the same banner as before. I checked with the updated app and presentation tests and tsc -b. All pass.
Public API is unchanged.
The earlier point about the home-screen restart path is still open.
There was a problem hiding this comment.
The earlier point about the home-screen restart path is addressed. The update context now records the installed version whenever it learns of a local install, so the home notice, /exit and Ctrl+C all print the banner, as well as the dialog's Restart. The dialog text no longer promises an automatic restart and session resume.
I checked with the new app tests: /update → Restart, and a background install followed by /exit. Both fail on the base and pass here. All 63 tests in the four files pass, and tsc -b is clean.
Public API is unchanged: Exit is back to its original signature, and the epilogue context is internal to the TUI.
After installing an update from the
/updatedialog, Restart just quits the TUI, which leaves you at your shell prompt with no hint about what to do next. Now, once an update has been installed locally, every way out of the TUI (dialog Restart, the home "/exit restart to use v…" notice,/exit, Ctrl+C) prints the exit banner with a pointer to the new version:If you quit from inside a session, the existing
SessionandContinue opencode -s …rows still print below that line.{ session(value), updatedVersion(version) }. The session route reports its title and ID. The update context reports the version whenever it learns of a local install: a dialog install, a check that finds one already installed, a background auto-install, or a non-remote serverinstallation.updated.app.tsxbuilds the one banner withepilogue({ session, updatedVersion }), which replacessessionEpilogue.Exitkeeps its original signature.Tests:
bun test test/app-lifecycle.test.tsx test/util/presentation.test.ts test/component/dialog-update.test.tsx test/session-home.test.tsxinpackages/tui: 63 pass./update→ Restart, and a background install followed by/exit, then check stdout. The background test fails without the change.tsc -binpackages/tuiis clean.Related: #56103
Requested by: @vimtor (victor via Slack)
Added by the opencode bot (AI-generated).
Related: #56103