Skip to content

Make vision permissions consistent#4885

Draft
jruales wants to merge 1 commit intomainfrom
jruales/2026.03-consistent-permissions-images
Draft

Make vision permissions consistent#4885
jruales wants to merge 1 commit intomainfrom
jruales/2026.03-consistent-permissions-images

Conversation

@jruales
Copy link
Copy Markdown
Contributor

@jruales jruales commented Mar 31, 2026

Currently we have inconsistent permissions. In the case where an endpoint supports Vision but the organization preview features disabled, image attachments will not work (because of the preview features disabled) but View Image Tool permissions will succeed because it doesn't check for preview features. This PR makes the two consistent by also checking for preview features for scenarios like the View Image Tool.

Here are some screenshots that show the different behaviors:
image

image

And a video from where the screenshots were taken:

agent-screenshot-inconsistency.2.mp4

Copilot AI review requested due to automatic review settings March 31, 2026 22:08
Copy link
Copy Markdown
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

Updates panel prompt rendering so that image handling during tool-result rendering respects both model vision capability and organizational policy for preview features, aligning behavior with other image-related prompt components.

Changes:

  • Gate tool-result image rendering on endpoint.supportsVision and copilotToken.isEditorPreviewFeaturesEnabled().
  • Return a consistent placeholder string when tool-result images are unavailable due to model capability or org policy.

Comment on lines +698 to 699
if (!this.endpoint.supportsVision || !this.authService.copilotToken?.isEditorPreviewFeaturesEnabled()) {
return '[Image content is not available because vision is not supported by the current model or is disabled by your organization.]';
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

This adds the org-policy gate (copilotToken.isEditorPreviewFeaturesEnabled()) for tool-result images, but other image paths in panel prompts (e.g. FileVariable attaches @vscode/prompt-tsx Image directly) don’t apply this check, so images may still be sent even when preview features are disabled. Consider applying the same permission check everywhere images can enter the prompt (or centralizing the decision) to avoid policy bypass/inconsistent behavior.

Copilot uses AI. Check for mistakes.
Comment on lines +698 to 699
if (!this.endpoint.supportsVision || !this.authService.copilotToken?.isEditorPreviewFeaturesEnabled()) {
return '[Image content is not available because vision is not supported by the current model or is disabled by your organization.]';
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

There’s no unit coverage for PrimitiveToolResult.onImage() behavior when vision is blocked by org policy (isEditorPreviewFeaturesEnabled() === false). Since this changes prompt output, add a focused test that renders a tool result containing an image LanguageModelDataPart and asserts the placeholder string is produced when preview features are disabled (and that image rendering still occurs when enabled).

Copilot uses AI. Check for mistakes.
@jruales jruales requested a review from justschen March 31, 2026 22:29
@jruales jruales marked this pull request as draft April 3, 2026 22:24
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