[PR #9856] chore(deps): update GitLab packages for better self-hosted instance support #13248

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

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

State: closed
Merged: Yes


What does this PR do?

Summary

Update @gitlab/gitlab-ai-provider and @gitlab/opencode-gitlab-auth packages to fix authentication with self-hosted GitLab instances.

Changes

@gitlab/gitlab-ai-provider

  • Fix authentication when using AI Gateway as an Anthropic proxy
  • Set apiKey: null on Anthropic client to prevent environment variable override
  • Filter out x-api-key header to use Bearer token authentication instead
  • Replace console.log with noop to avoid breaking TUI output

@gitlab/opencode-gitlab-auth

  • OAuth authorize flow now respects GITLAB_INSTANCE_URL environment variable
  • Enables authentication with self-hosted GitLab instances without requiring UI prompts

Why?

When connecting opencode to a self-hosted GitLab instance with Duo enabled:

  1. The Anthropic SDK was incorrectly sending x-api-key header instead of using Bearer token auth expected by AI Gateway proxy
  2. The OAuth flow was ignoring GITLAB_INSTANCE_URL env var and always redirecting to gitlab.com
    Testing

How did you verify your code works?

  1. Deployed a self-hosted GitLab instance with Duo enabled
  2. Set environment variables:
    • GITLAB_INSTANCE_URL=https://your-gitlab-instance.com

Related issue: https://github.com/anomalyco/opencode/issues/8655

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9856 **State:** closed **Merged:** Yes --- ### What does this PR do? ### Summary Update `@gitlab/gitlab-ai-provider` and `@gitlab/opencode-gitlab-auth` packages to fix authentication with self-hosted GitLab instances. #### Changes @gitlab/gitlab-ai-provider - Fix authentication when using AI Gateway as an Anthropic proxy - Set `apiKey: null` on Anthropic client to prevent environment variable override - Filter out `x-api-key` header to use Bearer token authentication instead - Replace console.log with noop to avoid breaking TUI output @gitlab/opencode-gitlab-auth - OAuth authorize flow now respects `GITLAB_INSTANCE_URL` environment variable - Enables authentication with self-hosted GitLab instances without requiring UI prompts ### Why? When connecting opencode to a self-hosted GitLab instance with Duo enabled: 1. The Anthropic SDK was incorrectly sending `x-api-key` header instead of using Bearer token auth expected by AI Gateway proxy 2. The OAuth flow was ignoring `GITLAB_INSTANCE_URL` env var and always redirecting to gitlab.com Testing ### How did you verify your code works? 1. Deployed a self-hosted GitLab instance with Duo enabled 2. Set environment variables: - `GITLAB_INSTANCE_URL=https://your-gitlab-instance.com` Related issue: https://github.com/anomalyco/opencode/issues/8655
yindo added the pull-request label 2026-02-16 18:18:07 -05:00
yindo closed this issue 2026-02-16 18:18:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13248