Repository navigation
Commit 0eb349d
authored
feat(models): drop the OpenCode Free tier and ask the user for a provider instead (#1678)
* feat(models): drop OpenCode Free and ship no model credential
OpenCode's gateway now serves its free tier only to requests it recognises
as coming from OpenCode itself. Reproduced on 2026-09-20: replicating the
official client's headers verbatim — user agent, x-opencode-client, a
session id in its own `ses_` shape — still answers 403 FreeTierError, while
replaying an official request body unchanged answers 200. The gate reads the
system prompt and the tool definitions, so the adapter's own prompt cannot
pass it, and upstream has said in anomalyco/opencode#49621 that other
harnesses are not to use the free tier.
Nothing in the product can honour that and keep the routes, so they go, and
with them the identity shim that made PawWork's requests look official: it
only ever reached headers, which is no longer where the gate is. Matching a
prompt fingerprint to get through would be circumventing an access control,
not adapting to an interface.
What this changes for a first launch: the product ships no model credential
and names no default model, so a user supplies a provider key before the
first turn. The seeded OPENCODE_API_KEY moves from a value the launcher
states to a name it drops, because credentials-local ranks the environment
above its own store and would otherwise shadow the key the Models page
writes.
The pi-ai patch keeps its other two hunks; only the session-affinity switch,
which existed for the zen wire, is dropped. Web search keeps its shared
anonymous allowance — that reason was never the free models, it is that a
search key is a second credential to hold.
The smoke configures a provider over the settings RPC before the probes that
read the model catalog, since an install with no key registers none.
* fix(models): keep the paid OpenCode Go route working
Dropping the free tier took two things the paid route also needs.
The gateway answers `400 MissingSessionID` to an inference request that
carries no per-conversation id, and it accepts only ids shaped like the
ones its own client mints. pi-ai writes the harness session id as
`x-client-request-id` when a route asks for the affinity headers, so the
preload reshapes that value rather than minting a second one; the
Completions protocol gates those headers behind
`sendSessionAffinityHeaders`, which the adapter offers only because of
`patches/@deepseek-ai__dsh-llm-pi-ai@*.patch`. Both halves are back, and
the route's config states the switch.
What is gone is the rest of the old preload: the User-Agent and
`x-opencode-client` values that claimed to be OpenCode's own desktop
client. The paid gateway admits third-party agents, so the request now
says who it is.
This was already broken in 2026.9.10 for anyone bringing an OpenCode Go
key: `opencode-go` had no compat switch, and the launcher injected
`OPENCODE_API_KEY` read-only as `public`, so the key models.dev names
for that provider could not be saved at all.
Verified against the real paid route with a user key rather than in the
suite: a turn needs a live key and bills for it.
* fix(desktop): keep the window's timers running while it is covered
Chromium throttles an occluded window's timers to once a second and can
stop them outright, so a running agent's stream stalls while the user
works in another window. It also made the CDP smoke hang: its waits are
timer-driven and the renderer answered Runtime.evaluate while never
firing a setTimeout.
* feat(models): ask for a provider on first run and adopt the one it gets
The product ships no key, and the default model selection it inherits
from DSH names `deepseek-official` — a provider PawWork does not mount.
So a fresh install refused the first message with
`session/model-unavailable` even after the user had configured a working
provider, because nothing moved the default off the one that cannot
serve.
The step closes both halves. It reads the same provider/settings/
credential join the Models page reads: a provider serves when it is
registered and any key its profile names is held. With none, it shows a
dialog pointing at Models; with one the default cannot reach, it writes
the default there and stands down. It re-decides on `llm/adapters-updated`
and `credentials/reference-updated`, so adding a key in Models dismisses
it without a restart.
DSH registers `deepseek-official` for this slot but PawWork disables
`llm-deepseek`, so that step resolves to `adapter-absent` and shows
nothing. The dialog reuses DSH's own onboarding chrome — headless modal,
its measurements, `#root` inert while it blocks.
* fix(models): re-decide the onboarding step against facts that settled
The step read the provider directory, the settings mirror and the
credential store over several round trips. An event that arrived while
that read was in flight was answered by a verdict formed before it, and
nothing raised a second one — so configuring a provider left the dialog
up over a provider that was already usable. Each request now marks the
read stale and the loop repeats until it finishes against settled facts.
`settings/document-updated` joins the two it already watched, because the
provider profile the join reads comes from that document.
The smoke seeds the default model itself rather than waiting for the step
to adopt one: it keeps the probe off that timing, and the step is left
with nothing to ask for. It does assert the dialog stands down, which is
what caught this.
* fix(models): let the user choose the model, and only say what is missing
The step used to write the default model itself, taking the first model
of the first usable provider. That is the user's choice to make, and the
choice was available all along: `session/modelCatalog` lists every model
the configured providers offer, and choosing in the composer is what
records the default.
Its readiness join was also wrong. It treated a provider whose profile
names no key reference as needing none, and `opencode-go` names none in
settings — the bundled catalog carries that name, not the document — so
a clean first run read as "provider ready, pick a model" when nothing
was configured at all.
Both go away with a narrower question: is the selected provider one the
adapter registered? A fresh install inherits `deepseek-official`, which
PawWork does not mount, so the answer is no until the user has both
configured a provider and chosen one of its models — which is exactly
when a session can send. No credential join, no guess at a key
reference, and nothing chosen on the user's behalf.
* fix(models): keep opencode-go out of the picker until the user adds it
The route's session-affinity switch lived in the product's settings patch,
and pi-ai registers a route for every provider the settings document
names. So a clean install registered `opencode-go` with no key for it, and
its 27 models sat in the composer's model picker where choosing any of
them answers 401.
The switch is a fact about the endpoint rather than a choice a user makes,
so it moves into the adapter patch, applied when the route resolves. The
settings document now names no provider at all, and `opencode-go` appears
once the user adds it under Models — with the switch already on.
Confirmed on the wire rather than in the sources, since three layers
assemble these headers: with only `apiKeyEnv` in settings, the request
carries `x-client-request-id`, `x-session-affinity` and the `ses_` session
id the gateway requires.
* fix(site): state the pricing value in the pricing row
The comparison table's "app free, no subscription" row rendered
`Apache-2.0`, which is the license the row above already states. It read
as a duplicate and said nothing about cost. Render a localized value
that answers the row instead.
* fix(onboarding): hand the app back when opening the model settings
The first-run step holds the app root inert while it is up, and the
settings section it points at renders inside that root. Opening the
section without standing down therefore delivered a page the user could
not type into: measured on a clean home, the only visible input came
back unfocusable and inert. The composer's model picker is inside the
same root, so both actions the dialog asks for were impossible while it
was displayed, and the button read as a no-op.
Standing down is part of opening the section, not a later step. The
decision loop gains two corrections found alongside it: a verdict formed
before an event that has since arrived no longer completes the step, and
a read that throws now stands down rather than becoming an unhandled
rejection -- this step is first in the shell's order, so one that never
completes hides every step behind it for the rest of the launch.
Holding `complete` by reference keeps the shell's unrelated re-renders
from re-running the decision and its RPC.
The smoke could not have caught this: it configures a provider over RPC
and never presses the button. It now asserts the step stood up before
seeding and left the root usable after, so a step that never renders
stops passing as a step that stood down.
* fix(models): delete the free-tier routes this product used to write
Removing the tier from the product does not remove it from an install
that ran it. The retired refresher wrote `opencode` and
`opencode-responses` into the *user* settings layer, where the shipped
patch cannot reach them, so they survive the upgrade and still resolve:
measured on a seeded home, both register, their models stay in the
picker, and `agent-default-model` still names one. The first-run step
then sees a registered provider and completes, so the user is never
asked for a key and every send fails at a gateway that no longer serves
them.
This plugin wrote those rows, so it is the one that takes them back. A
selection left pointing at one is deliberately not repaired: the
replacement would be this plugin's guess rather than the user's choice,
and with the route unregistered the first-run step asks them for it.
* fix(site): finish removing the free tier from the published copy
`llms.txt` is served from pawwork.ai and still said the app includes
free models and needs no API key; CONTRIBUTING still listed the free
model routes as a product plugin. Both describe the thing this branch
deleted.
The provider count went with them: the page claimed 40+, and the
installed adapter offers 39. A number that moves with every pi-ai
upgrade is stated as a floor instead.
The session-id chain the paid route depends on gains a sentinel. Four
parties have to spell it the same way and three are upstream, nothing
else exercises it -- the smoke sends no OpenCode request -- so a rename
would have surfaced as every send failing in a released build.
* fix(smoke): wait for the onboarding step to release the app root
React removes the dialog's DOM in the commit but runs the step's passive
cleanup after the next paint, so there is a frame where the dialog is gone
and the root is still inert. Reading the flag the instant the dialog
disappeared caught that frame on the macOS x64 runner while arm64 passed on
the same commit. Polling still fails a root that is never handed back, which
is the defect this assertion was added for.1 parent 89447b8 commit 0eb349d
29 files changed
Lines changed: 681 additions & 1885 deletions
File tree
- packages/desktop-electron
- resources/dsh
- automations/lib
- home
- product/lib
- scripts
- src/main
- patches
- site
- public
- src
- components
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
143 | | - | |
| 142 | + | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
143 | | - | |
| 142 | + | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
0 commit comments