Skip to content

Inbox: OpenCode's model list reads whole and in time; a failed start with a model says why - #4194

Merged
backnotprop merged 2 commits into
mainfrom
fix/inbox-opencode-model-list
Nov 29, 2026
Merged

backnotprop merged 2 commits into
mainfrom
fix/inbox-opencode-model-list

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Starting a new OpenCode agent with a model picked: three weaknesses fixed.

The model list may never load. Each list read (models, agents, default) is a whole OpenCode start with the person's plugins, and the three ran at once with 5 seconds each. They now get 30 seconds each and run one after another (models, then agents, then the default; no agent read when the models could not be read). Nothing waits on them longer than before: compose and a Send still wait 250 ms at most, and a slow read still shows "Reading OpenCode's models…". The timeout line now names the real limit: "Couldn't read OpenCode's models: it took longer than 30 seconds." (the number comes from the same constant the server reads with). Claude Code, Pi and Codex keep their 5 s.

A long list can arrive cut off. A CLI that writes a large list to a pipe and exits at once can lose the end of it; the Inbox then could not read the list and showed only Default. Each OpenCode list read now writes its output to a file of its own in the Inbox's launch folder (0600), read after OpenCode exits and then removed (the 16 Mi cap stays; a pipe as before if the file can't be made).

A start with a model that fails now says why. When OpenCode makes no session, the failed line reads "OpenCode didn't start. OpenCode did not make a session: <OpenCode's reason>. Your message is kept." The reason is OpenCode's error message (or the request's own error, such as a time-out), on one line, the home folder shown as ~, the server's password and credential-like login values hidden, 200 characters at most. With no reason, the line is as before.

Not in this PR: telling the person when OpenCode starts on a different model than the one picked (no existing sentence fits; needs words).

Tests: packages/server/inbox-launch-opencode-choices.test.ts (a 6 s read is read, the three reads never overlap, a ~3.5 MB list written just before process.exit(0) is read whole, a run's output file is removed, a pipe when it can't be made), packages/server/inbox-launch-opencode.test.ts (the refusal's reason, its bound, plain-text and empty answers).

…h a model fails

OpenCode's list reads (models, agents, default) get 30 seconds each and run
one after another; the window's timeout words name that limit. Each read's
output goes to a file in the Inbox's launch folder, read after OpenCode
exits and then removed, so a long list is never cut short. When OpenCode
makes no session, the failed start says OpenCode's own reason, on one line,
with the home folder as ~ and credential-like values hidden.
@backnotprop backnotprop added the ci:e2e Run the full browser suite (Inbox window e2e) on this PR label Nov 29, 2026
An Inbox that quits or restarts during an OpenCode list read leaves the
read's stdout file in its launch folder. The host's first list read now
removes such files: only the exact name listRead makes, of a pid that is
not this process and not running, older than 5 minutes; a link is
removed itself, never followed; every error is ignored.
@backnotprop
backnotprop marked this pull request as ready for review November 29, 2026 03:28
@backnotprop
backnotprop merged commit 5bcfc53 into main Nov 29, 2026
61 checks passed
DuongCoder04 pushed a commit to DuongCoder04/plannotator that referenced this pull request Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:e2e Run the full browser suite (Inbox window e2e) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant