Repository navigation
Description
Area
apps/server
Steps to reproduce
- Run an OpenCode 2 server on another machine (
opencode serveon machine B, user/Users/<server-user>, password set). - In T3 Code desktop on machine A (packaged build, server cwd =
$HOME=/Users/tom), configure the OpenCode provider with that Server URL and password. - Open the model picker / let the provider refresh.
Expected behavior
Model list loads from the remote server. The model catalog does not depend on a project directory, so T3 should not require any local path to exist on the remote machine.
Actual behavior
Provider reports that OpenCode could not load its model list.
packages/provider-opencode/src/server/driver.ts:296 loads the catalog with the T3 host's own cwd:
openCode2Server.withConnection(({ client }) => loadOpenCode2Catalog(client, host.paths.cwd)),host.paths.cwd is process.cwd() of the T3 server process on machine A. It is sent as location.directory (the Effect client encodes it as the location[directory] query param; the header form behaves the same). That path does not exist on machine B, so the server rejects the request.
Reproduced directly against the remote server:
# T3's directory (exists only on machine A)
curl -u opencode:$PW -H 'x-opencode-directory: %2FUsers%2Ftom' http://<host>:4096/api/model
# 404 {"_tag":"LocationNotFoundError","location":{"directory":"/Users/tom"},"message":"Location not found: /Users/tom"}
# Same with the query param the Effect client actually sends
curl -u opencode:$PW 'http://<host>:4096/api/model?location%5Bdirectory%5D=%2FUsers%2Ftom'
# 404 LocationNotFoundError
# No location
curl -u opencode:$PW http://<host>:4096/api/model
# 200, full model list for the server's default directory
# A directory that exists on machine B
curl -u opencode:$PW -H 'x-opencode-directory: %2FUsers%2F<server-user>' http://<host>:4096/api/model
# 200, full model listSuggested fix: when serverUrl is set, call the catalog without a location (let the server use its own default directory), or at least don't send a client-local path.
Related, broader: sessions with an external server also send the local project path, so they only work when the project lives at the identical absolute path on the server. A server-side path per project (or a path mapping) would be needed for a real remote setup. Happy to split this into a separate discussion. Also related to #2867 (packaged builds set server cwd to $HOME).
Impact
Blocks work completely (external OpenCode 2 server unusable unless the client's cwd happens to exist on the server)
Version or commit
T3 Code (Beta) 0.1.7 desktop; same code on main @ 9e85538
Environment
macOS (client and server on different Macs over Tailscale), OpenCode 2 server v2.2.5
Workaround
Create the client's cwd on the server, e.g. sudo mkdir /Users/tom && sudo chown <server-user> /Users/tom.
Activity