Skip to content

feat: opencode go channel, close #1614#1682

Merged
looplj merged 1 commit into
unstablefrom
dev-tmp
May 20, 2026
Merged

feat: opencode go channel, close #1614#1682
looplj merged 1 commit into
unstablefrom
dev-tmp

Conversation

@looplj

@looplj looplj commented May 20, 2026

Copy link
Copy Markdown
Owner

No description provided.

@greptile-apps

greptile-apps Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds the OpenCode Go channel (opencode_go), wiring it end-to-end across the frontend schema, provider/channel config, localisations, the ent database enum, the GraphQL schema, and the backend transformer/endpoint registrations. The new channel follows the OpenAI chat-completions format and reuses the existing generic OpenAI-compatible transformer path.

  • Backend: opencode_go is added to the ent enum and auto-generated code, registered under the channel.TypeOpenai-compatible transformer in channel_llm.go, and assigned openAIChatOnlyDefaultEndpoints in channel_endpoint.go — consistent with other single-format providers such as fireworks and cerebras.
  • Frontend: The channel is added to channelTypeSchema, CHANNEL_CONFIGS, CHANNEL_TYPE_TO_PROVIDER, and PROVIDER_CONFIGS with the OpenCode icon sourced from @lobehub/icons@5.8.0, which required bumping the icon package from ^3.0.0 to ^5.8.0; this version jump introduces a peer dependency conflict with @lobehub/ui (v3 installed vs. v5 required) that should be investigated.

Confidence Score: 3/5

The new channel implementation is complete and consistent across backend and frontend, but the two-major-version icon package bump introduces a peer dependency conflict that could cause runtime rendering failures for icon components.

The Go backend changes are clean and follow established patterns exactly. The concern is on the frontend: bumping @lobehub/icons from v3 to v5 just to import one new icon brings in a stated peer requirement of @lobehub/ui@^5.0.0, while the project only has @lobehub/ui@3.4.6. pnpm resolves this without error depending on strict-peer-deps config, but any icon that calls into v5-only @lobehub/ui APIs at runtime would silently break. All existing channel icons are also served by the upgraded package, so the blast radius is not limited to the OpenCode symbol alone.

frontend/package.json and frontend/pnpm-lock.yaml — the @lobehub/icons upgrade and the resulting @lobehub/ui peer dependency mismatch deserve a second look before merging.

Important Files Changed

Filename Overview
frontend/package.json Bumps @lobehub/icons from ^3.0.0 to ^5.8.0 (two major versions) to access the new OpenCode icon; the new v5 package declares @lobehub/ui ^5.0.0 as a peer dependency, but the project installs @lobehub/ui@3.4.6.
frontend/src/features/channels/data/config_channels.ts Adds opencode_go channel config with correct base URL, default model, OpenAI chat completion API format, and OpenCode icon; also adds opencode_go to Provider type union and CHANNEL_TYPE_TO_PROVIDER map.
frontend/src/features/channels/data/schema.ts Adds opencode_go to the channelTypeSchema Zod enum; no changes to validation rules or credential handling, which is appropriate for a standard API-key channel.
internal/ent/schema/channel.go Adds opencode_go to the ent enum field; generates the DB-level migration column value.
internal/server/biz/channel_llm.go Wires TypeOpencodeGo into the generic OpenAI-compatible transformer case alongside openai, deepinfra, aihubmix, etc.; correct given the channel uses openai/chat_completions format.
internal/server/biz/channel_endpoint.go Registers openAIChatOnlyDefaultEndpoints for TypeOpencodeGo; matches the single openai/chat_completions format declared in the frontend config.

Sequence Diagram

sequenceDiagram
    participant Client
    participant AxonHub
    participant ChannelService
    participant OpenAITransformer
    participant OpenCodeAPI

    Client->>AxonHub: POST /v1/chat/completions (model: opencode-go-v1)
    AxonHub->>ChannelService: Route to opencode_go channel
    ChannelService->>ChannelService: buildChannelWithTransformer (TypeOpencodeGo → OpenAI-compatible path)
    ChannelService->>OpenAITransformer: NewOutboundTransformerWithConfig(PlatformOpenAI, baseURL)
    AxonHub->>OpenAITransformer: Transform request
    OpenAITransformer->>OpenCodeAPI: POST /chat/completions (Bearer key)
    OpenCodeAPI-->>OpenAITransformer: Streaming response
    OpenAITransformer-->>Client: Forwarded response
Loading

Comments Outside Diff (1)

  1. frontend/package.json, line 10 (link)

    P1 Peer dependency mismatch with @lobehub/ui

    @lobehub/icons@5.8.0 declares @lobehub/ui: ^5.0.0 as a peer dependency, but the project installs @lobehub/ui@3.4.6 (two major versions behind). The pnpm lockfile resolves the icon package against 3.4.6 anyway, which pnpm permits with a warning when strict-peer-dependencies is not enforced. If any icon component used in this PR (or any pre-existing icon) calls into @lobehub/ui v5 APIs at runtime, it will fail silently or throw. The entire icons bundle changed from v3 to v5 just to pick up the OpenCode symbol — consider whether @lobehub/ui should be upgraded in tandem, or whether there is a way to obtain the OpenCode icon without the major-version bump.

Reviews (1): Last reviewed commit: "feat: opencode go channel, close #1614" | Re-trigger Greptile

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the "OpenCode Go" channel provider, which includes updating the @lobehub/icons dependency, adding configuration settings, and updating the backend schema and logic to support the new provider. Feedback was provided to externalize the hardcoded base URL and default models for the new provider into environment variables to improve flexibility across different environments.

Comment on lines +602 to +603
channelType: 'opencode_go',
baseURL: 'https://opencode.ai/zen/go/v1',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hardcoding baseURL and defaultModels directly within the CHANNEL_CONFIGS object can make it less flexible for different deployment environments (e.g., development, staging, production) or if these values need to be updated frequently. Consider externalizing these configuration values, perhaps through environment variables or a dedicated configuration service, to improve maintainability and adaptability.

Suggested change
channelType: 'opencode_go',
baseURL: 'https://opencode.ai/zen/go/v1',
baseURL: process.env.OPENCODE_GO_BASE_URL || 'https://opencode.ai/zen/go/v1',
defaultModels: process.env.OPENCODE_GO_DEFAULT_MODELS?.split(',') || ['opencode-go-v1'],

@looplj looplj merged commit 0972478 into unstable May 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant