Skip to content

fix: Dev to main PR - #1146

Open
Dhruvkumar-Microsoft wants to merge 5 commits into
mainfrom
dev
Open

fix: Dev to main PR#1146
Dhruvkumar-Microsoft wants to merge 5 commits into
mainfrom
dev

Conversation

@Dhruvkumar-Microsoft

Copy link
Copy Markdown
Contributor

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:

  • Added a _KNOWLEDGE_BASE_NO_CITATIONS_PROMPT string to agent_factory.py that instructs agents not to include any citation markers, source-reference tokens, attribution markers, or footnotes in their responses.
  • Updated create_agent_from_config in agent_factory.py to append the no-citations prompt to agent instructions when a knowledge base is configured.

Prompt and Helper Updates:

  • Added the no-citations instruction to the final answer prompt in get_magentic_prompt_kwargs to ensure plan review summaries also suppress citations.

Testing Enhancements:

  • Mocked KnowledgeBaseConfig in test setup and ensured agent objects support use_knowledge_base and knowledge_base_name fields. [1] [2] [3]
  • Added and extended tests in test_agent_factory.py to verify that knowledge-base-backed agents receive the new citation suppression instructions. [1] [2]
  • Added a test in test_plan_review_helpers.py to confirm that final prompts suppress citations as intended.

Does this introduce a breaking change?

  • Yes
  • No

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

Ayaz-Microsoft and others added 5 commits August 14, 2026 12:19
…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.
Reverts commits 11cc79e and f69db2a.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 156d17a7-8650-4c22-b4e3-b83fa00ef7be
@github-actions

Copy link
Copy Markdown

Coverage

Coverage Report •
FileStmtsMissCoverMissing
agents
   agent_factory.py75198%148
orchestration
   plan_review_helpers.py1293275%306, 310, 312–313, 319, 323–326, 328–329, 332, 334–341, 343–344, 346–347, 349–354, 527–528
TOTAL383555285% 

Tests Skipped Failures Errors Time
837 0 💤 0 ❌ 0 🔥 6.473s ⏱️

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/backend/orchestration/plan_review_helpers.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants