Repository navigation
fix(cli): keep update preflight through TUI loading - #36475
Merged
Merged
Conversation
3 of 6 tasks
This was referenced Jul 19, 2026
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The update preflight now remains visible until the main TUI has finished its non-terminal startup work, then hands its initialized renderer directly to the TUI.
Previously, the footer reached
Ready, destroyed its renderer, and left a blank terminal while the TUI loaded config, resolved its initial directory, negotiated terminal capabilities, and created another renderer. The handoff now reads:Readyremains visible through TUI mounting. The same renderer switches from the split footer to the normal alternate screen, paints the TUI, and removes the preflight root after the first TUI frame.How
packages/cli/src/services/update-preflight.tsxadds an explicit loading stage and initializes the renderer with the settings the TUI will need.packages/cli/src/commands/handlers/default.tskeeps the preflight mounted through TUI config loading and passes a terminal handoff callback into the TUI.packages/tui/src/app.tsxcompletes its initial directory request, accepts the existing renderer and detected terminal mode, mounts the TUI, then retires the preflight root after the first rendered frame.Scope
This changes only the fresh-launch version-mismatch flow introduced in #36448 and refined in #36455. Normal TUI startup and already-connected TUI reconnection behavior are unchanged.
Testing
bun typecheckinpackages/clibun run testinpackages/cli(25 pass)bun typecheckinpackages/tuibun run testinpackages/tui(214 pass, 1 skip)darwin-arm64binaries from this branch with baked-in versions0.0.1-oldand0.0.2-new/api/healthreported0.0.2-newwith the replacement service PIDDemo
Real compiled-binary service replacement under isolated XDG state, recorded at 60fps:
handoff.mp4
Flow
sequenceDiagram participant Preflight as Update preflight participant CLI as CLI startup participant Server as New service participant TUI as Main TUI Server-->>CLI: healthy endpoint CLI->>Preflight: show Loading OpenCode par While preflight remains visible CLI->>CLI: load TUI config CLI->>Server: resolve initial directory Preflight->>Preflight: detect terminal mode end CLI->>Preflight: show Ready Preflight-->>TUI: transfer initialized renderer + mode TUI->>TUI: mount on transferred renderer TUI->>Preflight: retire footer root after first frame