Skip to content

Conversation

@tamuratak
Copy link
Contributor

Add inline reference handling for markdown conversion in RunSubagentTool. Fix #282509

CC: @roblourens

Copilot AI review requested due to automatic review settings December 25, 2025 08:53
Copy link
Contributor

Copilot AI left a comment

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 fixes issue #282509 where inline references (file paths) from subagents were being lost during markdown conversion. The fix ensures that when a subagent returns inline references as part of its response, these references are properly preserved and converted to markdown links in the tool result that gets sent back to the orchestrator.

Key Changes:

  • Added handling for inlineReference kind in the response processing loop alongside markdownContent
  • Implemented a new inlineReferenceToMarkdown function to convert inline reference objects into markdown link format
  • Added necessary imports for URI, basename, and isLocation utilities

Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

label = reference.name ?? basename(reference.location.uri);
}
const escapedLabel = label.replace(/[[\]()\\]/g, '\\$&');
return `[${escapedLabel}](${refUri.toString()})\n`;
Copy link
Member

Choose a reason for hiding this comment

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

I think the formatting is a bit overkill, I think that just giving uri.fsPath would be best, rather than doing a md-link and stringifying a URI. We shouldn't stringify the URI here on the frontend because it will use the internal remote scheme vscode-remote when on a remote. I think the logic can be copied from here: https://github.com/microsoft/vscode-copilot-chat/blob/f809049bb00c86f54f7a2eb0b0be772b8da2ee79/src/platform/prompts/common/promptPathRepresentationService.ts#L47-L52

(fsPath for typical URIs but toString anything out of the ordinary)

@roblourens roblourens added this to the December / January 2026 milestone Dec 30, 2025
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.

Subagent file path context is missing in response to orchestrator

2 participants