fix: Dev to main PR - #1146
Merged
Merged
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.
fix: Configured Microsoft Package Feed Proxy
fix: Dev Container venv path to avoid Docker bind-mount OSError
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 27 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/tests/backend/orchestration/test_plan_review_helpers.py:240
- Test name is misleading: this test doesn’t vary the team, it just verifies the default
final_answer_promptcontains the citation-suppression rule whenhas_user_responses=False. Renaming it to reflect the actual condition would make the suite easier to scan and keep consistent with nearby test names.
def test_given_any_team_when_called_then_final_suppresses_citations(self):
Roopan-Microsoft
approved these changes
Aug 27, 2026
Avijit-Microsoft
approved these changes
Aug 27, 2026
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