Conversation
…ction OpenCode Go rejects requests without a stable x-opencode-session header (HTTP 400). Odysseus never sent it, and _detect_provider() could never return opencode-go/opencode-zen because _host_match() is hostname-only while 'zen' and 'zen/go' are path segments. Add host+path detection, inject Odysseus/1.0 User-Agent and per-conversation session header (fallback odysseus-global for probes), and cover with regression tests.
|
Changed-file classification: backend/runtime. Author-reported runtime / visual state
Checkboxes are author attestations. GitHub Actions results remain the execution evidence for CI; this check does not prove that a local command ran. This comment updates automatically when the description or changed files change. |
Go serves gpt-5.6-luna, grok-4.6 and muse-spark on the OpenAI Responses API, but Odysseus sent every Go model to /chat/completions (HTTP 500). Classify responses-models, build Responses payloads, reuse the validated Responses SSE streaming path, parse non-stream output text, and probe the right URL per model.
6 tasks
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.
Summary
OpenCode Go rejects chat requests without a stable
x-opencode-sessionheader (HTTP 400), and Odysseus never sent it — plus_detect_provider()could never returnopencode-go/opencode-zenbecause_host_match()is hostname-only whilezen/zen/goare path segments. This adds host+path Go/Zen detection, injects anOdysseus/1.0User-Agent with the per-conversation session id (fallbackodysseus-globalfor probes/model listing), routes Go responses-models (gpt-5.6-luna, grok-4.6, muse-spark) to.../v1/responseswith an OpenAI Responses payload, and adds regression tests.Target branch
dev, notmain. All PRs land indev;mainis curated by the maintainer at each release. If your PR is onmainby accident, click "Edit" on this PR and change the base.Linked Issue
Fixes #6281. Related to #4450.
Type of Change
Checklist
devdocker compose uporuvicorn app:app) and verified the change works end-to-end. Type-checks and unit tests are not enough.How to Test
https://opencode.ai/zen/go/v1and a valid Go API key.hey) on a Go model such aslongcat-2.0— before this fix it fails with400 ... missing x-opencode-session, after it the request carriesUser-Agent: Odysseus/1.0andx-opencode-session: <chat session id>.pytest tests/test_opencode_go_responses.py tests/test_opencode_go_headers.py tests/test_provider_detection_detect.py tests/test_provider_detection_host_match.py tests/test_provider_detection_builders.py tests/test_provider_classification.py tests/test_copilot.py tests/test_llm_core_ollama.py -q(from the repo venv) — 129 passed. Alsopython -m py_compile src/llm_core.py src/endpoint_resolver.py routes/model_routes.py.docker compose up/uvicorn) or a live Go key end-to-end — no Go subscription key available in this environment — so live verification againstopencode.ai/zen/gois still needed by a reviewer with a key.gpt-5.6-lunaand Muse Spark (muse-spark) previously returned Go500 Internal server errorbecause Odysseus sent all Go traffic to.../v1/chat/completionswhile Go serves those models on.../v1/responses(https://opencode.ai/docs/go/#endpoints). This PR now routes them to/responseswith a Responses payload (reusing the validated Responses SSE path); live re-verification with a Go key is still needed. The/v1/messagesGo models (qwen, minimax) remain out of scope.Visual / UI changes — REQUIRED if you touched anything that renders
No UI/rendering changes (backend
src/+tests/only).Screenshots / clips
N/A — no visual change.