{"content":"fix(opencode-glm-model-protocol): ride the model-supported protocol on the OpenCode Go gateway\n\nIncident: on the OpenCode provider, glm-5.3-flash failed every CoWork turn with `DSH turn failed: opencode API error (400): {\"type\":\"ModelProtocolUnsupported\",\"message\":\"Model does not support this protocol.\"}` while deepseek-v4.1-flash worked on the very same provider. The reasoning-effort pick (max) was coincidental — the protocol was the failure.\n\nRoot cause: the OpenCode Go gateway serves each model over exactly ONE wire protocol (pi-ai's installed opencode-go.json catalog declares it per model) and answers every other protocol with HTTP 400 ModelProtocolUnsupported. The app configures ONE provider-level apiFormat; the 'responses' default was chosen for DeepSeek Flash (which does carry reasoning on /v1/responses and is verified working there) — but the gateway serves the GLM line only over chat completions, so the model catalog outgrew the provider-level setting.\n\nFix: resolveOpenCodeGoApiFormat (src/main/libs/opencodeGoProtocol.ts + renderer mirror src/renderer/services/opencodeGoProtocol.ts) corrects routes per model, gated on the opencode.ai host so custom relays keep the configured format. GLM family (glm-4.5+/5.x) rides chat completions, where dshModelReasoningDeclaration supplies the explicit zai thinking dialect — the effort selector keeps working (low/high/max map to the single 'enabled' wire state, like the zhipu GLM routes). The responses-only set (gpt-*-luna, grok-4.6/4.7, muse-spark-*) is corrected up to the Responses wire. Unknown models pass through untouched — a wrong correction would break a working route.\n\nWired into every protocol decision point that can target the gateway: DSH turn-route composition (dshTurnProviderFromRoute, warn-once cowork.log line), the A2A/private-chat proxy resolveUpstreamAPIType, the IM handler, and the Settings connection test. Exported isGlmFamilyModelId from dshModelReasoning.ts as the shared GLM predicate.\n\nVerification: new tests/opencodeGoProtocol.test.mjs (helper + proxy), tests/coworkDshOpencodeProtocol.test.mjs (real CoworkRunner route wiring: glm -> openai with effort still attached, deepseek -> responses untouched, luna -> responses), renderer mirror test. test:cowork-proxy suite 94/94 green, dsh reasoning tests 14/14, renderer tsc and eslint clean.","contentType":"text/plain;utf-8","attachments":[],"quotePin":""}