fix: Dev to main PR - #1146
Open
Dhruvkumar-Microsoft wants to merge 5 commits into
Open
Conversation
…hestration manager - Add functions to manage streaming citation buffers and clean citations. - Update orchestration manager to clear citation buffers and clean final text. - Enhance unit tests for citation cleaning and streaming callbacks.
… and add unit tests for citation handling
fix: citation marker in response
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request enforces a “no citations / no attribution markers” response policy for knowledge-base-backed agents and for the orchestrator’s final answer prompt, and updates unit tests to validate the new prompt behavior.
Changes:
- Added a KB-specific “RESPONSE CITATION POLICY” prompt segment and appended it to agent instructions when a knowledge base is configured.
- Updated the orchestrator final-answer prompt rules to suppress citation/attribution markers.
- Expanded unit tests to cover KB config wiring and to assert the citation-suppression policy is present in generated prompts.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/backend/agents/agent_factory.py | Adds and conditionally appends a KB-specific no-citations prompt to agent instructions when kb_config is present. |
| src/backend/orchestration/plan_review_helpers.py | Extends final answer rules to suppress citation markers/attribution in orchestrator responses. |
| src/tests/backend/agents/test_agent_factory.py | Updates module stubs and adds a test asserting KB-backed agents receive the no-citations instructions. |
| src/tests/backend/orchestration/test_plan_review_helpers.py | Adds a test asserting the final prompt includes the no-citations instruction. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request adds and enforces a strict policy to suppress citation markers and attribution in agent responses, particularly for agents using a knowledge base. It also updates tests to ensure these new instructions are correctly applied. The main changes are grouped below:
Knowledge Base Citation Suppression:
_KNOWLEDGE_BASE_NO_CITATIONS_PROMPTstring toagent_factory.pythat instructs agents not to include any citation markers, source-reference tokens, attribution markers, or footnotes in their responses.create_agent_from_configinagent_factory.pyto append the no-citations prompt to agent instructions when a knowledge base is configured.Prompt and Helper Updates:
get_magentic_prompt_kwargsto ensure plan review summaries also suppress citations.Testing Enhancements:
KnowledgeBaseConfigin test setup and ensured agent objects supportuse_knowledge_baseandknowledge_base_namefields. [1] [2] [3]test_agent_factory.pyto verify that knowledge-base-backed agents receive the new citation suppression instructions. [1] [2]test_plan_review_helpers.pyto confirm that final prompts suppress citations as intended.Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information