Fix chat image attachments silently dropped when signed out of GitHub - #323856
Conversation
Image attachments were silently dropped for signed-out users even when a vision-capable BYOK/local model was configured. The panel Image prompt element gated image inclusion on `copilotToken?.isEditorPreviewFeaturesEnabled()`, which is `undefined` when there is no Copilot token (i.e. not signed in), so the negation evaluated truthy and the image was omitted before the request was sent. `isEditorPreviewFeaturesEnabled()` represents an org policy that is only meaningful when a Copilot token exists; a missing token should not block the feature. Default the check to enabled when the token is absent, using the same `?? true` pattern already used in claudeChatSessionContentProvider. This preserves the org-policy behavior (explicit `editor_preview_features=0` still omits images) while letting signed-out / BYOK users send images to vision-capable models. Applied to both HistoricalImage and Image render paths, and added unit tests covering signed-out, signed-in, org-policy-disabled, and non-vision-model cases. Fixes microsoft#323854 Co-authored-by: SamirSaji <samirsaji13@gmail.com>
There was a problem hiding this comment.
Pull request overview
Fixes a regression in the Copilot Chat prompt pipeline where image attachments were being omitted when the user was signed out (no Copilot token), even if the configured endpoint supports vision (BYOK/local multimodal models). The change aligns the “editor preview features” org-policy gate with its intended semantics by defaulting to enabled when no token is present.
Changes:
- Update
ImageandHistoricalImageprompt-element guards to treat missing Copilot tokens as “preview features enabled” (?? true). - Add unit coverage for signed-out, signed-in, org-policy-disabled, and non-vision endpoint scenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| extensions/copilot/src/extension/prompts/node/panel/image.tsx | Fixes the guard logic so signed-out/BYOK users don’t have images dropped while preserving the org-policy disable path. |
| extensions/copilot/src/extension/prompts/node/panel/test/image.spec.ts | Adds regression tests ensuring images are included/omitted correctly across auth + policy + capability combinations. |
|
@microsoft-github-policy-service agree |
Address review feedback: when a vision-capable model has images omitted because org policy disables editor preview features, the omitted-reference status previously said the model "does not support images", which is misleading. Set the status description based on the actual cause (lack of vision vs. org policy). The catch/error path keeps the generic message. Co-authored-by: SamirSaji <samirsaji13@gmail.com>
|
Thanks for the review. Addressed the feedback:
All unit tests pass locally ( |
…ments-signed-out # Conflicts: # extensions/copilot/src/extension/prompts/node/panel/image.tsx
|
Justin Chen (@justschen) Merge conflict with |
|
giving this a look this iteration cc Vritant Bhardwaj (@vritant24) since this is BYOK related... |
Fixes #323854
Reported issue (#323854)
When using the built-in VS Code Chat without being signed in to a GitHub account, image attachments are not delivered to the configured model. The image renders in the composer, but on send the model responds as if nothing was attached:
+button / file picker.Minimax M3orQwen), so the model itself can consume image input.--disable-extensions, ruling out third-party extensions.Control experiment (signed-out vs signed-in), same model, same steps:
Minimax M3(multimodal)Minimax M3(multimodal)LocalImage.pngLocalImage.pngThe only variable is Chat sign-in state — the image is stripped client-side before the request reaches the provider.
Root cause
The panel
Imageprompt element (extensions/copilot/src/extension/prompts/node/panel/image.tsx) — which renders user-attached image variables into the outgoing request (viachatVariables.tsx) — gated image inclusion on:copilotTokenisundefinedwhen there is no Copilot token — i.e. when the user is signed out.undefined?.isEditorPreviewFeaturesEnabled()isundefined, so!undefinedistrue, and the image is omitted before the request is dispatched, regardless of the model's actual vision capability. This is exactly why the same vision-capable BYOK model works signed in but drops images signed out.isEditorPreviewFeaturesEnabled()represents an organization policy (it returnstrueunless a Copilot token explicitly setseditor_preview_features=0). It is only meaningful when a Copilot token exists. Applying it to the no-token case incorrectly blocks signed-out and BYOK users who have no Copilot entitlement at all.Fix
Default the preview-features check to enabled when no Copilot token is present, using the same
?? truepattern already used inclaudeChatSessionContentProvider.ts:Applied to both the
ImageandHistoricalImagerender paths.Behavior after the fix
editor_preview_features=0The organization-policy gate is fully preserved: a Copilot token that explicitly disables editor preview features still omits images.
Testing
Added
extensions/copilot/src/extension/prompts/node/panel/test/image.spec.tscovering all four scenarios above (signed-out, signed-in, org-policy-disabled, non-vision model), mirroring the existingfileVariable.spec.tsharness.Notes
image.tsxwas the only place using the!copilotToken?.isEditorPreviewFeaturesEnabled()form without an explicit fallback.