← 输入框|github.com|刷新
Skip to content

Investigation only: VS Code's Agent Host drops GitHub issues attached from the "+" menu (no changes in this repo) - #9146

Draft
Alex Ross (alexr00) with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-context-invisibility-issue
Draft

Alex Ross (alexr00) with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-context-invisibility-issue

Conversation

Copilot AI commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

A GitHub issue attached from + → GitHub Issues... shows up as a chip in chat, but the model never gets its content. The model only sees other context, such as the open file (view.js in the report). The reporter says it works when the issue is open in its own editor tab.

This PR has no code changes. The extension produces the issue content correctly; VS Code drops it before the request reaches the model, so the fix has to go into microsoft/vscode.

Root cause

  • The extension side works. IssueContextProvider.resolveAttachChatContext fills value with JSON containing the title, body and comments. The chip only appears after this succeeds.
  • VS Code labels picked items as "generic" attachments. ChatContextService._asPicker → asAttachment (chatContextService.ts, release/1.143 lines 243–250) does this for every chat context provider. The extension can't choose a different kind.
  • The Agent Host drops generic attachments. agentHostSessionHandler._convertVariableToAttachment (release/1.143 lines 7426–7432; main lines 8064–8070) only passes a generic attachment on if it carries _meta['copilot.attachmentDetail']. Anything else returns undefined.
  • Why an open tab works: an open issue tab is offered as implicit context, which becomes kind: 'string' (chatImplicitContext.ts lines 550–556). The Agent Host passes those on (line 7423).
  • Other paths are fine: in the extension-host Copilot agent, the generic text value goes through ChatPromptReference.to and is shown to the model as an <attachment>. This rules out a bug in the extension.
  • "GitHub Pull Requests..." attachments, and any other extension's attach-context provider, are dropped the same way.

Suggested fix (microsoft/vscode)

Pass generic attachments with a text value through as simple attachments:

// agentHostSessionHandler._convertVariableToAttachment
if (v.kind === 'generic') {
	const detail = readAttachmentDetail(v);
	if (detail) { /* existing */ }
	if (typeof v.value === 'string') {
		return this._toSimpleAttachment(v.name, v.value, v._meta, undefined, referenceRange);
	}
}

Agent Host skill and command completions are also generic attachments, but their value is an object ({ $mid: 'agentHostCompletion', ... }), so this check leaves them alone. Another option is to have asAttachment create kind: 'string' attachments. That requires filling uri and handle, so it's a bigger change.

Workaround

Open the issue in its editor tab before sending the request.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI linked an issue Nov 2, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix issues attached as context being invisible to Copilot Investigation only: VS Code's Agent Host drops GitHub issues attached from the "+" menu (no changes in this repo) Nov 2, 2026
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.

Issues attached as context are invisible to Copilot

2 participants