Skip to content

fix: route GitLab Duo Workflow system prompt via flowConfig#18928

Merged
rekram1-node merged 5 commits intoanomalyco:devfrom
vglafirov:fix/18841-gitlab-workflow-system-prompt
Mar 24, 2026
Merged

fix: route GitLab Duo Workflow system prompt via flowConfig#18928
rekram1-node merged 5 commits intoanomalyco:devfrom
vglafirov:fix/18841-gitlab-workflow-system-prompt

Conversation

@vglafirov
Copy link
Copy Markdown
Contributor

@vglafirov vglafirov commented Mar 24, 2026

Issue for this PR

Closes #18841

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

DWS workflow models receive conflicting system prompts because OpenCode sends its system prompt as { role: "system" } messages while DWS injects its own server-side — DWS wins, so the model identifies as "GitLab Duo". Additionally, plan mode <system-reminder> tags injected into user messages become part of the DWS goal, polluting the conversation.

gitlab-ai-provider 5.3.2 added a systemPrompt setter on GitLabWorkflowLanguageModel that sends the prompt via flowConfig.prompts[].prompt_template.system, which properly overrides the DWS default. It also strips <system-reminder> tags from the goal and routes them to additional_context.

This PR bumps the SDK to 5.3.2 and wires it up in llm.ts:

  1. Sets workflowModel.systemPrompt before each stream (alongside toolExecutor)
  2. Skips prepending system messages for workflow models (they go via flowConfig now)

This is ~4 lines of change vs the 400+ line approach in #18884, because the heavy lifting is in the SDK.

How did you verify your code works?

  • bun run typecheck — clean across all 13 workspace packages
  • bun test test/provider/gitlab-duo.test.ts — 13 tests pass
  • bun test test/session/llm.test.ts — 11 tests pass
  • Manual testing with duo-workflow-* models confirming correct identity and clean goals

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Send the system prompt to DWS workflow models via the SDK's
systemPrompt setter instead of prepending system messages to the
prompt array. This uses flowConfig.prompts[].prompt_template.system
to override DWS's default system prompt, fixing the identity conflict
where the model identifies as 'GitLab Duo' instead of 'OpenCode'.

Plan mode reminders injected as <system-reminder> tags in user
messages are automatically stripped from the DWS goal and routed
to additional_context by gitlab-ai-provider 5.3.2.

Closes anomalyco#18841
@github-actions github-actions Bot added contributor needs:compliance This means the issue will auto-close after 2 hours. labels Mar 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found a related PR:

Related PR:

Why it might be related: PR #18884 appears to be addressing the same issue with routing GitLab Duo Workflow prompts via flowConfig. This could be an earlier attempt at the same fix or an overlapping solution. The current PR (#18928) may be a refinement or alternative approach to the same problem (system prompt routing for DWS workflow models).

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@gaetan-puleo
Copy link
Copy Markdown

gaetan-puleo commented Mar 24, 2026

Hi @vglafirov do you have any issues with the additional_context if you switch from plan to build to plan and then to build again?

I think system reminders are persisted during the entire workflow and it confuse the LLM.

This issue was replicated here #18884 (comment)

@vglafirov
Copy link
Copy Markdown
Contributor Author

Hi @vglafirov do you have any issues with the additional_context if you switch from plan to build to plan and then to build again?

I think system reminders are persisted during the entire workflow and it confuse the LLM.

This issue was replicated here #18884 (comment)

It works with changing agents. I've tested: plan->build->plan->build->plan flow by asking to add and remove myself from CODEOWNERS file. It worked as expected.

@gaetan-puleo
Copy link
Copy Markdown

Hi @vglafirov do you have any issues with the additional_context if you switch from plan to build to plan and then to build again?
I think system reminders are persisted during the entire workflow and it confuse the LLM.
This issue was replicated here #18884 (comment)

It works with changing agents. I've tested: plan->build->plan->build->plan flow by asking to add and remove myself from CODEOWNERS file. It worked as expected.

Nice thank you!

@rekram1-node rekram1-node merged commit 9330bc5 into anomalyco:dev Mar 24, 2026
8 of 9 checks passed
Andres77872 pushed a commit to Andres77872/opencode that referenced this pull request Mar 26, 2026
dzianisv pushed a commit to dzianisv/opencode that referenced this pull request Mar 26, 2026
dzianisv pushed a commit to dzianisv/opencode that referenced this pull request Apr 2, 2026
balcsida pushed a commit to balcsida/opencode that referenced this pull request Apr 8, 2026
dzianisv pushed a commit to dzianisv/opencode that referenced this pull request Apr 9, 2026
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Rwanbt pushed a commit to Rwanbt/opencode that referenced this pull request May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitLab Duo Workflow models receive conflicting system prompts and plan mode leaks as user message

3 participants