[PR #7333] feat: Add GitLab Duo Agentic Chat Provider Support #12352

Closed
opened 2026-02-16 18:17:16 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7333

State: closed
Merged: Yes


Add GitLab Duo Provider Support

Problem

In-line with GitLab's open-core strategy, we want to officially integrate GitLab Duo with OpenCode as a supported provider, operable with both GitLab.com and self-hosted GitLab instances. To streamline our users' journey across tools and enable access to GitLab's AI capabilities including agentic chat with native tool calling, GitLab is upstreaming the required provider packages to this repository.

Solution

This PR adds GitLab as a supported provider with three agentic chat model variants (Haiku, Sonnet, Opus), enabling seamless integration with GitLab.com and self-hosted instances.

Changes

Dependencies Added

  • @gitlab/gitlab-ai-provider@3.0.9 - Provider implementation
  • @gitlab/opencode-gitlab-auth@1.2.1 - OAuth/PAT authentication
  • @gitlab/opencode-gitlab-plugin@1.0.6 - GitLab API tools

Provider Implementation

  • Added GitLab to bundled providers in provider.ts
  • Implemented custom loader with multi-source auth (env, config, OAuth, PAT)
  • Registered three Claude-based models: haiku-4-5, sonnet-4-5, opus-4-5
  • OAuth token refresh support
  • Self-hosted GitLab instance support via GITLAB_INSTANCE_URL

Plugin Auto-Loading

  • GitLab auth/tools plugins load automatically when GitLab is configured
  • Checks environment variables, config, and auth.json
  • Respects OPENCODE_DISABLE_DEFAULT_PLUGINS flag

Tests

  • Added 8 provider-specific tests covering auth methods, config options, and model availability
  • All 619 existing tests pass

Files Changed

  • packages/opencode/package.json - Added 3 GitLab dependencies
  • packages/opencode/src/provider/provider.ts - GitLab provider implementation
  • packages/opencode/src/plugin/index.ts - Auto-loading logic
  • packages/opencode/test/provider/gitlab-duo.test.ts - New tests (8 tests)
  • packages/docs/essentials/gitlab-duo.mdx - Documentation

Usage

Basic setup with environment variable:

export GITLAB_TOKEN="glpat-xxxxxxxxxxxx"

Then use in config:

{
  "model": "gitlab/duo-chat-sonnet-4-5"
}

Self-hosted GitLab:

export GITLAB_INSTANCE_URL="https://gitlab.company.internal"
export GITLAB_TOKEN="glpat-xxxxxxxxxxxx"

Testing

  • All 619 existing tests pass
  • Added 8 provider-specific tests
  • Tested with GitLab.com and environment variable auth

Closes #7455

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7333 **State:** closed **Merged:** Yes --- # Add GitLab Duo Provider Support ## Problem In-line with GitLab's open-core strategy, we want to officially integrate GitLab Duo with OpenCode as a supported provider, operable with both GitLab.com and self-hosted GitLab instances. To streamline our users' journey across tools and enable access to GitLab's AI capabilities including agentic chat with native tool calling, GitLab is upstreaming the required provider packages to this repository. ## Solution This PR adds GitLab as a supported provider with three agentic chat model variants (Haiku, Sonnet, Opus), enabling seamless integration with GitLab.com and self-hosted instances. ## Changes ### Dependencies Added - `@gitlab/gitlab-ai-provider@3.0.9` - Provider implementation - `@gitlab/opencode-gitlab-auth@1.2.1` - OAuth/PAT authentication - `@gitlab/opencode-gitlab-plugin@1.0.6` - GitLab API tools ### Provider Implementation - Added GitLab to bundled providers in `provider.ts` - Implemented custom loader with multi-source auth (env, config, OAuth, PAT) - Registered three Claude-based models: haiku-4-5, sonnet-4-5, opus-4-5 - OAuth token refresh support - Self-hosted GitLab instance support via `GITLAB_INSTANCE_URL` ### Plugin Auto-Loading - GitLab auth/tools plugins load automatically when GitLab is configured - Checks environment variables, config, and auth.json - Respects `OPENCODE_DISABLE_DEFAULT_PLUGINS` flag ### Tests - Added 8 provider-specific tests covering auth methods, config options, and model availability - All 619 existing tests pass ## Files Changed - `packages/opencode/package.json` - Added 3 GitLab dependencies - `packages/opencode/src/provider/provider.ts` - GitLab provider implementation - `packages/opencode/src/plugin/index.ts` - Auto-loading logic - `packages/opencode/test/provider/gitlab-duo.test.ts` - New tests (8 tests) - `packages/docs/essentials/gitlab-duo.mdx` - Documentation ## Usage Basic setup with environment variable: ```bash export GITLAB_TOKEN="glpat-xxxxxxxxxxxx" ``` Then use in config: ```json { "model": "gitlab/duo-chat-sonnet-4-5" } ``` Self-hosted GitLab: ```bash export GITLAB_INSTANCE_URL="https://gitlab.company.internal" export GITLAB_TOKEN="glpat-xxxxxxxxxxxx" ``` ## Testing - All 619 existing tests pass - Added 8 provider-specific tests - Tested with GitLab.com and environment variable auth Closes #7455
yindo added the pull-request label 2026-02-16 18:17:16 -05:00
yindo closed this issue 2026-02-16 18:17:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12352