feat: integrate GitLab Duo Agent Platform (DAP) workflow models#15573
feat: integrate GitLab Duo Agent Platform (DAP) workflow models#15573vglafirov wants to merge 25 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 alongside existing agentic chat models. Specifically:
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 footprint@gitlab/gitlab-ai-providerfrom3.6.0to4.0.0New 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 pickerHow 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