Feat/opencode zen provider#4467
Conversation
|
Thanks @snail-vs for taking the time to contribute. This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered. Please read |
|
Intake note: this covers the OpenCode Zen half of #1481, which is milestone-assigned to v0.9.3 (the OpenCode Go half shipped in #4420; Zen + the Messages-protocol route follow in the v0.9.3 window). Setting the milestone accordingly — no action needed from you; we'll do the full review pass when v0.9.3 opens. Thanks for taking this on! |
|
Thanks — this is what a complete provider addition looks like: Where it stands: per the intake note, this is the Zen half of #1481 (Go shipped in #4420) and sits on the v0.9.3 milestone; v0.9.1 is freezing and v0.9.2 is the active lane, so the full review pass comes when v0.9.3 opens. The full CI matrix has not run on this head yet — fork PRs only get the intake gate and GitGuardian until review. To keep the branch landable in the meantime:
Related demand your work serves: #1481 and #4526. Generated by Claude Code |
|
Status update from the v0.9.2 maintainer pass, @snail-vs — this is a deferral to v0.9.3, not a rejection, and I'd rather say so than leave it sitting silently. The review verdict is that this is a complete provider addition — enum variant, defaults, credential help, registry, and docs — which is exactly the shape we want and is rarer than it sounds. Most provider PRs arrive as partial plumbing that cannot build. Why it isn't landing in v0.9.2: the conflict against current Nothing here needs redoing. If you want to rebase onto current |
|
Thanks for the OpenCode Zen provider work, @snail-vs. This has fallen behind |
052e4f2 to
6ea82f2
Compare
Represent provider wire selection as either fixed or model-aware. Resolve model-aware protocols from catalog endpoint keys and fail closed when an endpoint does not prove a supported request shape.\n\nExisting providers remain fixed-policy routes, so this creates the Zen routing seam without changing current provider behavior. Signed-off-by: snailoniu <snailoniu@gmail.com>
Register OpenCode Zen across config, CLI, secrets, and TUI surfaces with provider-scoped API key guidance. Keep its wire policy model-aware and fail closed until a catalog offering proves the selected model protocol. Signed-off-by: snailoniu <snailoniu@gmail.com>
Route the documented Zen catalog across Responses, Anthropic Messages, and Chat Completions by model. Normalize the official opencode/model selector and reject Gemini or unknown models until their request protocol is supported and proven. Signed-off-by: snailoniu <snailoniu@gmail.com>
Bind clients to the resolver-proven request protocol and send Zen models through Responses, Anthropic Messages, or Chat Completions as appropriate. Keep Zen on bearer authentication, exclude Codex OAuth headers, and fail closed when a request changes protocol or uses an unproven FIM route. Signed-off-by: snailoniu <snailoniu@gmail.com>
Document Zen as a separate API-key provider with model-scoped Responses, Messages, and Chat Completions groups. Record the unsupported Gemini boundary and teach the provider registry drift check about the manual model-aware provider implementation. Signed-off-by: snailoniu <snailoniu@gmail.com>
OpenCode Zen routes Anthropic models through the Messages API, which expects the native x-api-key header. Sending Zen keys as Authorization bearer tokens produced upstream 401 Missing API key errors for Claude models. Refresh the request-shape test to lock the Zen Messages auth dialect while keeping bearer auth for Zen Responses and Chat Completions routes. Signed-off-by: snailoniu <snailoniu@gmail.com>
The model-aware route guard now reports that the Anthropic-compatible route has no proven FIM wire contract. Keep the local-failure test aligned with that fail-closed behavior and continue asserting that no HTTP request is made. Signed-off-by: snailoniu <snailoniu@gmail.com>
Align the rebased provider with current route candidate accessors, offering capabilities, registry counts, and Responses URL construction. Rename custom-provider test fixtures now that opencode_zen is a built-in identity, and remove the superseded protocol helper. Signed-off-by: snailoniu <snailoniu@gmail.com>
Route the opt-in resource-admission test skip notice through tracing so the all-targets Clippy gate respects the TUI module's print_stderr deny policy. Signed-off-by: snailoniu <snailoniu@gmail.com>
State explicitly that Zen Responses and Chat Completions use Bearer authorization while Anthropic Messages uses x-api-key, matching the request-shape implementation and detailed protocol section. Signed-off-by: snailoniu <snailoniu@gmail.com>
82337e6 to
19e47a6
Compare
|
|
Maintainer review — I merged this branch with current The one failure, and why it is not a routing bugIt passes in isolation and fails in the full run — which matches the note in your PR description about a test that passed on rerun. The cause: Every other resolution test in #[test]
fn opencode_zen_configures_model_aware_provider_with_catalog_proof() {
+ let _lock = env_lock();
+ let _env = EnvGuard::without_deepseek_runtime_overrides();
for alias in [
"opencode-zen",With that applied, Full local results on your branch merged with current main
Please push that two-line change and CI should go green. I deliberately have not harvested this into a maintainer branch — the work is yours and it is close to landing. Thanks for the careful transport split across Responses / Anthropic Messages / Chat Completions, and for keeping OpenCode Go out of scope. |
Serialize the model-aware provider test with other environment-mutating config tests and clear runtime provider overrides so parallel runs cannot leak a sibling test's provider selection. Signed-off-by: snailoniu <snailoniu@gmail.com>
|
Hmbown
left a comment
There was a problem hiding this comment.
Maintainer approval: the contributor applied the requested environment-isolation fix in fbbedbe. The branch is mergeable; approving the fork workflows so the full hosted gates can run. Thank you for the careful OpenCode Zen implementation.
Keep the public provider facts and source-candidate count aligned with the new ApiProvider variant so the hosted web gate remains truthful. Verified: npm run check:facts; npm run check:docs; npm test (137/137); npm run lint; npm run build.
# Conflicts: # docs/public-surface-facts.json # web/lib/facts.generated.ts
|
Maintainer follow-up: I added the missing OpenCode Zen web facts mapping in c3647fe, regenerated the source-candidate facts, and merged current |
Summary
x-api-key.Testing
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-featurescargo test --workspace --all-featuresFull workspace tests were run serially. One unrelated TUI test failed in the full suite but passed when rerun in isolation:
non_recoverable_engine_error_enters_offline_modeChecklist
No-Issue: Implements only the OpenCode Zen half of #1481; OpenCode Go remains out of scope, so the umbrella issue must stay open.