feat: integrate GitLab Duo Agent Platform (DAP) workflow models#15573
feat: integrate GitLab Duo Agent Platform (DAP) workflow models#15573vglafirov wants to merge 61 commits intoanomalyco:devfrom
Conversation
Wire GitLab DWS (Duo Workflow Service) workflow models into the provider and session layers: - Route duo-workflow-* models to workflowChat() in provider config - Bridge DWS tool execution requests through OpenCode's tool system - Use local file reference for gitlab-ai-provider during development
…nd caching Wire duo-workflow model selection through server routes, TUI dialog, and Bus events so users can pick from discovered GitLab models with root namespace resolution, caching, and default fallback.
- Add finish event handler to update usage/cost/tokens - Use totalUsage from finish event (AI SDK spec) - Add debug logging for finish event processing - Fixes token counter not updating for workflow models
…ame default - Dismiss 'Discovering workflow models...' toast when status is cached, default, or asked - Rename fallback model name from 'Default' to 'Namespace Default' - Add namespace fallback via top-level group query when project detection fails
Use GitLabModelCache to persist and restore workflow model selection, eliminating the discovery toast on startup when a cached selection exists. The model banner now shows the selected submodel immediately from cache.
…nd fix model banner Rename all workflow-model-select files, namespaces, routes, and events to use gitlab- prefix to minimize exposure of GitLab-specific changes. Fix model banner showing stale sub-model name for non-workflow models by guarding with isWorkflowModel() check in the parsed memo. Add comprehensive test suite (42 tests) for gitlab workflow integration.
✅ APPROVEAfter thorough code review and comprehensive testing, this PR is approved for merge. Test Results
Code Review SummaryChanges Validated:
Key Strengths
Files Changed
This PR successfully integrates GitLab Duo Agent Platform (DAP) workflow models into OpenCode while maintaining backward compatibility and code quality standards. Recommendation: Merge 🚀 |
|
@rekram1-node Added review from Agent Platform (Gemini 3.1 Pro Preview - Vertex) GitLab Duo model to help you to make decision on approval. Thanks, this is very important milestone in Gitlab Agent Platform integration. PS: I also had to recreate PR to comply with your PR standards and use the template, sorry for noise. :) |
|
E2E tests failures are unrelated to this PR. |
Issue for this PR
Closes #15577
Type of change
What does this PR do?
Integrates GitLab Duo Agent Platform (DAP) workflow models into OpenCode and migrates GitLab npm packages to new unscoped names.
DAP Workflow Integration:
duo-workflow-*models toworkflowChat()in the provider layer with OAuth instance matching via URL normalizationfinishevent for workflow model token counting and improves tool-error formatting in the processorenterpriseUrlfrom OAuth callback for correct instance matching (defaults tohttps://gitlab.com)isWorkflowModel()to prevent stale data for non-workflow modelsgitlab-prefix to minimize upstream footprintNew files:
session/gitlab-workflow-model-select.ts— Domain logic: ask/reply/cache for DAP model selectionserver/routes/gitlab-workflow-model-select.ts— HTTP routes: list, discover, clear, replytui/component/dialog-gitlab-workflow-model.tsx— TUI dialog for model selection pickerPackage Migrations (scope removal):
All three GitLab npm packages were migrated from the
@gitlab/scope to unscoped names under a new GitLab namespace. The old scoped packages are deprecated on npmjs with a message pointing to the new names. This does not break existing users — npm deprecation is a warning only, not a block.@gitlab/gitlab-ai-provider→gitlab-ai-provider@5.0.0— updated dependency and provider registry key inprovider.ts, test fixtures@gitlab/opencode-gitlab-auth→opencode-gitlab-auth@2.0.0— updated dependency and imports inplugin/index.ts@gitlab/opencode-gitlab-plugin→opencode-gitlab-plugin— runtime plugin (loaded via user config), no source changes needed in opencodeDocumentation Updates:
providers.mdx(English + 17 translated locales) with new unscoped package namesgitlab.mdxchanges are intentionally excluded (separate PR)How did you verify your code works?
test/session/gitlab-workflow-model-select.test.ts— 14 tests: ask/reply lifecycle, caching, event publishing, concurrent requeststest/session/gitlab-workflow-processor.test.ts— 9 tests: finish event handling, tool-error formattingtest/provider/gitlab-duo-workflow.test.ts— 10 tests: isWorkflowModel, OAuth instance matching, feature flagstest/server/gitlab-workflow-model-select.test.ts— 5 tests: HTTP routes (list, clear, discover, reply)Screenshots / recordings
N/A — no UI changes beyond the model selection picker dialog (terminal TUI).
Checklist