Environment
- devspace: 1.0.8 (npm global,
@waishnav/devspace)
- opencode: 1.18.29 (upgraded from 1.14.30 while debugging)
- @opencode-ai/sdk bundled with devspace 1.0.8: 1.18.29
- OS: Ubuntu 22.04 (x86_64), Node v24.14.0
- Subagent provider: opencode (enabled in
~/.devspace/config.json), agent profile with an explicit model: in its frontmatter
What happened
With subagents enabled and a profile that pins a model (e.g. model: alibaba-token-plan-cn/glm-5.2), every devspace agents run <profile> "..." fails at session drain time with:
SessionRunnerModel.ModelUnavailableError: Model unavailable: alibaba-token-plan-cn/glm-5.2
The run surfaces as either PROVIDER_EXECUTION_ERROR: OpenCode agent execution failed. or PROVIDER_PROTOCOL_ERROR: OpenCode did not finish the session before the provider timeout. — the prompt is admitted, but the turn never produces an assistant message.
What I verified (to rule out the obvious causes)
- The model is present in the spawned server's
/config/providers — confirmed by querying http://127.0.0.1:4096/config/providers on the daemon-spawned instance: alibaba-token-plan-cn lists glm-5.2, status active.
opencode run -m alibaba-token-plan-cn/glm-5.2 "..." in the same project directory works fine and returns a reply — so auth for the provider is valid.
- Session creation via SDK v2 succeeds:
client.v2.session.create({ location: { directory: <project> }, agent: "devspace_read_only" | "devspace_allowed", model: { providerID, id } }) returns a session id, and the session row in opencode's sqlite DB stores exactly {"id":"glm-5.2","providerID":"alibaba-token-plan-cn","variant":"default"}.
- The failure happens right after
booting location services in the opencode log, with Failed to drain Session ... ModelUnavailableError — i.e. the server-side SessionRunner rejects the model reference even though that same model id is listed under that provider.
- Creating the session without an explicit model (letting the agent/project default apply) gets past model resolution — the turn then runs and reaches the LLM (in my case it then failed on an unrelated free-tier 429 from the default model). So the problem looks specific to resolving the explicit model ref handed over by devspace, not auth or networking.
- Tried the model ref with and without
variant (no variant / variant: "high"); both fail the same way.
Minimal repro
# ~/.devspace/config.json
{ "subagents": { "enabled": true }, "providers": [ { "id": "opencode", "enabled": true } ] }
# ~/.devspace/agents/my-profile.md
---
schema: devspace-agent/v1
name: my-profile
description: ...
provider: opencode
model: alibaba-token-plan-cn/glm-5.2
---
cd <some git project under allowedRoots>
devspace agents run my-profile "What language is this project?"
# -> agent run fails; opencode log shows ModelUnavailableError for that model
The provider in question is a custom OpenAI-compatible provider defined in ~/.config/opencode/opencode.json (aliyun token-plan endpoint) — but the same behaviour appeared with deepseek/deepseek-v4-flash (official DeepSeek provider), so it does not look provider-specific.
Happy to provide full daemon logs (~/.local/share/devspace/agentd.log) or opencode server logs if useful.
Environment
@waishnav/devspace)~/.devspace/config.json), agent profile with an explicitmodel:in its frontmatterWhat happened
With subagents enabled and a profile that pins a model (e.g.
model: alibaba-token-plan-cn/glm-5.2), everydevspace agents run <profile> "..."fails at session drain time with:The run surfaces as either
PROVIDER_EXECUTION_ERROR: OpenCode agent execution failed.orPROVIDER_PROTOCOL_ERROR: OpenCode did not finish the session before the provider timeout.— the prompt is admitted, but the turn never produces an assistant message.What I verified (to rule out the obvious causes)
/config/providers— confirmed by queryinghttp://127.0.0.1:4096/config/providerson the daemon-spawned instance:alibaba-token-plan-cnlistsglm-5.2, status active.opencode run -m alibaba-token-plan-cn/glm-5.2 "..."in the same project directory works fine and returns a reply — so auth for the provider is valid.client.v2.session.create({ location: { directory: <project> }, agent: "devspace_read_only" | "devspace_allowed", model: { providerID, id } })returns a session id, and the session row in opencode's sqlite DB stores exactly{"id":"glm-5.2","providerID":"alibaba-token-plan-cn","variant":"default"}.booting location servicesin the opencode log, withFailed to drain Session ... ModelUnavailableError— i.e. the server-side SessionRunner rejects the model reference even though that same model id is listed under that provider.variant(no variant /variant: "high"); both fail the same way.Minimal repro
The provider in question is a custom OpenAI-compatible provider defined in
~/.config/opencode/opencode.json(aliyun token-plan endpoint) — but the same behaviour appeared withdeepseek/deepseek-v4-flash(official DeepSeek provider), so it does not look provider-specific.Happy to provide full daemon logs (
~/.local/share/devspace/agentd.log) or opencode server logs if useful.