fix(opencode): wire databricks-openai provider for GPT-5 / Codex#101
Open
dgokeeffe wants to merge 1 commit into
Open
fix(opencode): wire databricks-openai provider for GPT-5 / Codex#101dgokeeffe wants to merge 1 commit into
dgokeeffe wants to merge 1 commit into
Conversation
Configure the third Databricks model family for OpenCode. Mirrors the Pi adapter's pattern (which already supports all three families): @ai-sdk/openai against /ai-gateway/codex/v1 with per-model useResponsesApi=true. Before: ucode configure --agents opencode wrote only databricks-anthropic and databricks-google. databricks-gpt-5-5 / databricks-gpt-codex were unreachable from OpenCode. After: opencode.json includes databricks-openai with per-model useResponsesApi=true; default_model() falls back to codex before gemini. Fixes databricks#97
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.
Fixes #97.
Wires the third Databricks model family (GPT-5 / Codex Responses) into the
OpenCode adapter alongside Anthropic and Gemini. Mirrors the pattern the Pi
adapter (
src/ucode/agents/pi.py) already uses to support the same threefamilies.
What changed
Three small wires, one new test class, one supporting test in
test_databricks.src/ucode/cli.pywant_codexnow includesopencodein the consumer set; codex discovery results land inopencode_models["openai"].src/ucode/databricks.pybuild_opencode_base_urls(workspace)returns a third"openai"key pointing at/ai-gateway/codex/v1(matchesbuild_pi_base_urls).src/ucode/agents/opencode.pyrender_overlaywrites adatabricks-openaiprovider using@ai-sdk/openaiwith per-modeluseResponsesApi: true.default_model()falls back to codex before gemini (codex are the primary code models).PROVIDER_KEYSextended so stale-config cleanup tracks the new provider.tests/test_agent_opencode.pyTestRenderOverlayCodexclass — 12 assertions covering provider rendering, base URL, useResponsesApi per model, headers, model prefixing, managed keys. Also extendedTestOpencodeDefaultModelwith a codex-ahead-of-gemini fallback test.tests/test_databricks.pytest_returns_openai_codex_gatewayensuresbuild_opencode_base_urlsexposes the codex base URL.Net diff: +158 / -2 across 5 files.
Verification
Unit tests
(The one deselected case is a pre-existing local-environment break in the codex profile-config migration — fails identically on
origin/mainwithout these changes. Not a regression from this PR.)End-to-end against stock OpenCode
1.4.11I drove the live ucode internals against
logfood(AI Gateway v2 enabled,serving 3 Claude + 4 Gemini + 12 GPT-5 / Codex models), rendered an
opencode.jsoninto a tmpXDG_CONFIG_HOME, and ran the stockopencode-ai@1.4.11binary against it.Before this PR (the codex provider is absent from
opencode.json):After this PR (the provider is wired in):
The model is now reachable end-to-end. OpenCode connects, posts to
/ai-gateway/codex/v1/responses, receives a tool-call output, and then tripson a separate downstream bug (oversized response item IDs that violate
OpenAI's documented
<= 64limit on the Responses contract — filed as#99). That second hop is
out of scope for this PR; the relevant change here is that the connection
now succeeds where it previously errored before any wire activity.
Claude and Gemini paths through the same managed config still respond
successfully against
logfoodandlakemeter— no regressions in theexisting two families:
Acknowledgement of related issues
This PR addresses #97 only. It is one of three blockers identified for using
ucode + stock OpenCode without a Databricks-aware fork:
Forbidden: Invalid Tokenagainst stock OpenCode1.4.11. Cannot reproduce as of 2026-05-28 withopencode-ai@1.4.11against logfood or lakemeter; Claude requests succeed with the currentapiKey+headers.Authorizationshape. Will follow up on the issue with detail.itemIdrejection on multi-turn GPT-5 conversations. Independent server- and client-side workaround required; would be addressed in OpenCode upstream, not here.