Repository navigation
feat(desktop): give sandboxes the gateway's whole model list - #253
Merged
Merged
Conversation
A sandbox guest's provider block was built from the auth file alone, which
records only the one model chosen at login, so Work offered a single model
while Code offered the whole catalogue -- the SSO flow passes fetchModels'
result into the same buildGatewayConfig for the local server.
resolveSandboxEgress now asks the gateway for the list at start and passes
it through, so both sides come from the same source. The lookup goes
through Chromium's stack like every other host-side call made on a guest's
behalf, so enterprise proxies, PAC files and trust roots apply to it too;
that wrapper moves out of the returned egress object to module scope now
that the broker is not its only caller.
The answer is cached, keyed by the credentials themselves: sandboxes start
together at launch and would otherwise each ask, and a machine that cannot
reach the gateway would pay the fetch timeout once per sandbox. A rotated
token or a different gateway misses the cache by construction, so a stale
catalogue cannot outlive the login it came from.
A failed lookup resolves to no models rather than rejecting -- the guest
falls back to the recorded model, which is exactly what it had before --
and drops the cache entry so the next start retries. Since fetchModels
throws rather than returning an empty list, an empty result is exactly the
failure signal, and it is logged: a short picker otherwise looks the same
as a gateway that really does offer one model.
Verified in the app against the real sandbox: the guest config is built
from a live lookup ("resolved the gateway model list { models: 1 }"), and
this account's gateway does expose exactly one model, matching the local
server's config.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
quickbeard
force-pushed
the
feat/sandbox-model-list
branch
from
August 17, 2026 06:54
32c9eef to
8818fe5
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.
Follow-up to #238. A sandbox guest's provider block was built from the auth file alone, and that file records only the one model chosen at login — so Work offered a single model while Code offered the whole catalogue, since the SSO flow passes
fetchModels' result into the samebuildGatewayConfigfor the local server.resolveSandboxEgressnow asks the gateway for the list at sandbox start and passes it through, so both sides come from the same source.Details
gateway-models.ts). Sandboxes start together at launch and would otherwise each ask; a machine that can't reach the gateway would pay the 10s fetch timeout once per sandbox. A rotated token or a different gateway misses the cache by construction, so a stale catalogue can't outlive the login it came from.fetchModelsthrows rather than returning an empty list, so an empty result is the failure signal. Without a line in the log, a short picker looks identical to a gateway that genuinely offers one model, which is the first question when Work looks thinner than Code.Notes
packages/desktop/src/main/sandbox/), so DIVERGENCES.md needs no new row. The package README'segress.tsbullet gains the model catalogue.fetchModels' existing 10s timeout, once per credential set per app run.Testing
packages/desktop: 108 tests pass,bun typecheckclean. Newgateway-models.test.tscovers the three behaviours worth pinning: concurrent starts share one lookup, new credentials miss the cache, a failure yields no models and is retried rather than cached.test1sandbox: the guest config is now built from a live lookup —(sandbox) › resolved the gateway model list { models: 1 }, ~300ms, sandbox ready 1.6s later. This account's gateway exposes exactly one model (MiniMax/MiniMax-M3), confirmed by hitting/v1/modelsdirectly, and the local server'scodev.jsonclists the same one — so Work and Code now match, which is the point. An account with a wider key is where the difference shows.🤖 Generated with Claude Code