fix(tui): stop fetching placeholder session id on --continue - #47555
Open
woodsonl wants to merge 5 commits into
Open
fix(tui): stop fetching placeholder session id on --continue#47555woodsonl wants to merge 5 commits into
woodsonl wants to merge 5 commits into
Conversation
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
woodsonl
force-pushed
the
tui-continue-dummy-id
branch
from
September 7, 2026 16:37
92ca961 to
de91ed0
Compare
The -c flag seeded the route with sessionID "dummy" as a layout placeholder. The session route's eager fetch then issued requests against an id the server rejects (SessionID schema requires the "ses" prefix), surfacing as an error toast / "Unexpected server error" on startup. Seed an empty id instead and skip the eager session fetch for empty ids; the continue effect navigates to the real id once the session list resolves, re-triggering the fetch exactly once. Also escape the zero-width-space CSS content value in session-ui so Tailwind receives the intended \200B escape (the raw \2 was parsed as a deprecated octal escape and emitted a control character).
USER_AGENT was computed at module import, freezing Flag.OPENCODE_CLIENT before entrypoints that set it at runtime (e.g. acp). Derive it per request so the header reflects the actual client. Pin OPENCODE_CLIENT in models.test.ts so the /cli assertion no longer depends on the developer shell exporting the variable.
No consumers; userAgent(client) stays as the live helper. Deriving per request (as core models-dev now does) avoids freezing OPENCODE_CLIENT at import time.
The continue effect navigated to the most recent session regardless of an explicit --session id, so opencode -c -s <id> raced onMount's navigation and could land on the wrong session. Skip the continue effect when --session is given. Also route -c to home when no resumable session exists, instead of leaving a blank placeholder route. An explicit --session that cannot resolve is untouched (server reports it through the session route).
Poll for the resolved-id fetch instead of a fixed sleep, restore OPENCODE_FAST_BOOT in finally, and assert every /session/:id request carries the valid resolved id rather than only excluding the literal "dummy" placeholder.
woodsonl
force-pushed
the
tui-continue-dummy-id
branch
from
September 8, 2026 22:06
de91ed0 to
9160c4f
Compare
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.
Issue for this PR
Closes #47556
Type of change
What does this PR do?
opencode --continueseeds a placeholder session route withsessionID: "dummy"(from #31049). The session route eagerly fetches that id and the server 400s because ids must start withses_. WithOPENCODE_FAST_BOOT=1the route mounts before the continue effect runs, so the error shows on every cold start.This PR seeds
sessionID: ""instead and skips the eager fetch when the id is empty — no request fires for the placeholder, and the continue effect still resolves the real id and navigates. It also makes explicit--sessionwin over-cwhen both are passed, and navigates home instead of showing a blank screen when-chas no previous session.Two smaller fixes picked up while testing: ModelsDev User-Agent is now built per request instead of at import time (
OPENCODE_CLIENTset at runtime by acp.ts was invisible to the frozen constant — this was breaking a core test), and an unusedUSER_AGENTconst ininstallation/index.tsis dropped.How did you verify your code works?
Added
packages/tui/test/app-lifecycle.test.tsx: pinsOPENCODE_FAST_BOOT=1, delays the/sessionresponse, and asserts no request to/session/dummyhappens and the eventual fetch targets the real session id. Confirmed the test fails ondevand passes here. Package test suites (tui 194, core 1097, opencode 3594, session-ui 83) andbun turbo typecheckall pass. Manually ran--continueagainst a seeded server and confirmed the session renders with no/session/dummyrequest in the server log.Checklist