Skip to content

fix: citation marker in response - #1143

Merged
Roopan-Microsoft merged 4 commits into
devfrom
bugfix/citation-fix
Aug 17, 2026
Merged

fix: citation marker in response#1143
Roopan-Microsoft merged 4 commits into
devfrom
bugfix/citation-fix

Conversation

@Ayaz-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This PR fixed citation marker which was appending in agent response.

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

…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.
@github-actions

github-actions Bot commented Aug 14, 2026

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 🔥 10.080s ⏱️

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 PR updates the backend response handling to strip Azure Foundry-style citation markers (e.g., [5:0†source]) from both final and streaming agent output, and adds/updates tests to cover the new citation format and chunk-splitting behavior.

Changes:

  • Expand clean_citations() to remove Foundry citation markers with optional spacing/casing.
  • Add buffering logic in streaming_agent_response_callback() to prevent split citation markers from leaking across streamed chunks, plus explicit buffer clearing hooks from the orchestration manager.
  • Add/adjust tests to validate Foundry citation cleaning and split-chunk streaming behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/backend/callbacks/response_handlers.py Adds streaming citation buffer management and expands citation-cleaning regex to handle Foundry markers.
src/backend/orchestration/orchestration_manager.py Clears streaming citation buffers at orchestration boundaries and cleans manager final output citations.
src/tests/backend/callbacks/test_response_handlers.py Adds coverage for Foundry citation formats and split-across-chunks streaming cleanup.
src/tests/backend/orchestration/test_orchestration_manager.py Mocks new callback exports and adds a test ensuring manager final output is citation-cleaned.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/backend/callbacks/response_handlers.py Outdated
Reverts commits 11cc79e and f69db2a.

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

Copilot-Session: 156d17a7-8650-4c22-b4e3-b83fa00ef7be
@Roopan-Microsoft
Roopan-Microsoft merged commit 1c4dd45 into dev Aug 17, 2026
7 checks passed
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.

3 participants