Wrong prompt is used for Custom Agents
Summary
When switching between Duo Agent Chat (default chat) and a custom/foundation agent the wrong prompt is used on the backend
Steps to reproduce
- Navigate to a project, open a new chat window with Duo Agentic Chat, and ask a simple question - e.g. "Summarize this project"
- Select a new agent to chat with my clicking the new chat and select an agent such as the Security Analyst Agent
- Ask the custom agent the prompt "who are you?". It will correctly respond with details of the custom agent.
- Start a fresh session, which typically would be done by a user wanting to clear the context window and history, again selecting the custom agent
- Again, ask the agent "who are you". Note that this new session will respond as the normal Duo Agentic Chat agent.
- to double check the prompt used you can find your session(s) in LangSmith and verify the prompts sent to the model. For the last "Who are you", you will see the default agent prompt
Example Project
What is the current bug behavior?
The wrong Chat Prompt Template appears to be used on the backend
What is the expected correct behavior?
The prompt template associated with the custom agent is used
Relevant logs and/or screenshots
See images embedded above
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
Patch release information for backports
If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.
Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.
High-severity bug remediation
To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.



