-
Notifications
You must be signed in to change notification settings - Fork 276
GitLab Duo provider #772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
igorwwwwwwwwwwwwwwwwwwww
wants to merge
15
commits into
badlogic:main
Choose a base branch
from
igorwwwwwwwwwwwwwwwwwwww:gitlab-duo-provider
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
GitLab Duo provider #772
igorwwwwwwwwwwwwwwwwwwww
wants to merge
15
commits into
badlogic:main
from
igorwwwwwwwwwwwwwwwwwwww:gitlab-duo-provider
Conversation
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
Uses @gitlab/gitlab-ai-provider for native tool calling via GitLab's Anthropic proxy. Supports Claude Opus 4.5, Sonnet 4.5, and Haiku 4.5 models with automatic OAuth token management. - Add gitlab-duo API type and provider - Add duo-chat, duo-chat-opus-4-5, duo-chat-sonnet-4-5, duo-chat-haiku-4-5 models - Support GITLAB_TOKEN and GITLAB_DUO_TOKEN env vars - Support self-hosted GitLab via instanceUrl option - Add streaming support for text, reasoning, and tool calls
Track processed tool call IDs to prevent emitting the same tool call twice - once from streaming events and again from the final tool-call event.
- Add loginGitLabDuo and refreshGitLabDuoToken functions - Add gitlab-duo to OAuth provider list - Update CLI to handle gitlab-duo login flow - Support self-hosted GitLab via GITLAB_INSTANCE_URL env var - Update documentation with OAuth instructions
Use the opencode-gitlab-auth client ID which is registered with http://127.0.0.1:8080/callback redirect URI. Implements a lightweight callback server using Node's http module. The bundled VS Code extension client ID only supports vscode:// scheme redirects which don't work for CLI applications.
- Add stream.test.ts tests for GitLab Duo provider - Fix model config: reasoning=false, input=[text] only - GitLab Duo doesn't support thinking/reasoning mode - GitLab Duo proxy doesn't support image input
Add gitlab-duo provider tests to: - abort.test.ts - context-overflow.test.ts - empty.test.ts - tokens.test.ts - tool-call-without-result.test.ts - total-tokens.test.ts - unicode-surrogate.test.ts Note: image-tool-result.test.ts not updated since GitLab Duo doesn't support image input.
- Skip cost assertions for gitlab-duo (subscription-based, no per-token cost) - Skip unpaired surrogate test (GitLab proxy rejects malformed unicode) - Skip context-overflow test (error patterns may differ from direct Anthropic)
Extract the cause from TOKEN_REFRESH_NEEDED errors to show the actual API error (e.g., 'prompt is too long: X tokens > Y maximum') instead of a generic auth failure message.
Sanitize unpaired surrogate characters in system prompts, user messages, assistant text, and tool results to prevent API errors from malformed unicode.
The test requires longer timeout due to GitLab proxy latency.
Author
|
@badlogic In order to get test credits for an integration test you can go through https://contributors.gitlab.com/start. Please link to this comment if you do. GitLab team members reading this: Ping me in Slack for more context if needed. cc @terrorobe |
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.
Follow-up to #759, now with tests.
Uses @gitlab/gitlab-ai-provider for native tool calling via GitLab's Anthropic proxy. Supports Claude Opus 4.5, Sonnet 4.5, and Haiku 4.5 models.
This is based on the opencode implementation: anomalyco/opencode#7333. I tried to use @gitlab/opencode-gitlab-auth directly, but it takes a dep on @opencode-ai/plugin and I didn't want to drag in all of those transitive deps.