Skip to content

Conversation

@alexhancock
Copy link
Collaborator

@alexhancock alexhancock commented Nov 11, 2025

Fixes #5497 by sending the Copilot-Vision-Request header with a value of true when there is a processed image in the message

Working example after the change:

Screenshot 2025-11-11 at 3 50 58 PM

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 image processing in the GitHub Copilot provider by adding the Copilot-Vision-Request header when images are detected in the request payload.

  • Introduces payload_contains_image() helper function to detect images in message content
  • Modifies get_github_headers() to accept optional payload and conditionally add the vision header
  • Updates all call sites to pass None when payload inspection is not needed

Reviewed Changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
crates/goose/src/providers/githubcopilot.rs Added image detection logic and updated header generation to include Copilot-Vision-Request header when images are present in the payload
ui/desktop/openapi.json Added newline at end of file for proper formatting

fn payload_contains_image(payload: &Value) -> bool {
if let Some(messages) = payload.get("messages").and_then(|m| m.as_array()) {
for msg in messages {
if let Some(content) = msg.get("content") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

you could do this more functional, like messages.iter.any and then cast the is_object to a single list but up to you

let url = url::Url::parse(&format!("{}/chat/completions", endpoint))
.map_err(|e| ProviderError::RequestFailed(format!("Invalid base URL: {e}")))?;

// Build headers and include Copilot-Vision-Request when payload contains processed images
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd drop this comment, but do what it says :)

adding payload to get_github_headers seems a tad awkward. if you just break up that builder below you just go:

let mut request = self.client.post(..).headers()
if has_images:
  request = request.header(that_header)
response = request.header(..).send.await?

or some such

then you can leave the other bits alone

@alexhancock alexhancock force-pushed the alexhancock/copilot-openai-image-processing branch from 863febf to 290e845 Compare November 12, 2025 15:10
@alexhancock alexhancock merged commit cd33b23 into main Nov 12, 2025
15 checks passed
tlongwell-block added a commit that referenced this pull request Nov 12, 2025
* origin/main: (29 commits)
  chore: Update governance to include Discord (#5690)
  Ollama improvements (#5609)
  feat: add Supabase MCP server to registry (#5629)
  Unlist VS Code extension tutorials from MCP and experimental sections (#5677)
  fix: make image processing work in github copilot provider (#5687)
  fix: do not take into account gitignore in developer mcp (#5688)
  docs: session storage migration (#5682)
  New maintainers (#5685)
  chore: Update governance (#5660)
  chore(release): release version 1.14.0 (minor) (#5676)
  fix : action icons overlap session title in chat history (#5684)
  Document recent goose PRs (#5683)
  docs: add GOOSE_PATH_ROOT environment variable documentation (#5678)
  feat: SessionManager integration for acp sessions (#5657)
  teach copilot our CI (#5672)
  bump openapi version directly (#5674)
  governance: update MAINTAINERS.md to reflect new maintainers (#5675)
  chore: upgrade rmcp to 0.8.5 (#5673)
  Update release instructions (#5662)
  Swapped out to_string_lossy with display for user facing text (#5666)
  ...
zanesq added a commit that referenced this pull request Nov 12, 2025
* 'main' of github.com:block/goose:
  Fix: Always show autocompact threshold ui (#5701)
  chore: Update governance to include Discord (#5690)
  Ollama improvements (#5609)
  feat: add Supabase MCP server to registry (#5629)
  Unlist VS Code extension tutorials from MCP and experimental sections (#5677)
  fix: make image processing work in github copilot provider (#5687)
  fix: do not take into account gitignore in developer mcp (#5688)
  docs: session storage migration (#5682)
  New maintainers (#5685)
  chore: Update governance (#5660)
  chore(release): release version 1.14.0 (minor) (#5676)
michaelneale added a commit that referenced this pull request Nov 13, 2025
* main: (27 commits)
  hackathon banner  (#5710)
  Fix documentation-only change detection for push events (#5712)
  Added transaction commits to multi sql functions in session_manager (#5693)
  fix: improve and simplify tool call chain rendering (#5704)
  Fix: Always show autocompact threshold ui (#5701)
  chore: Update governance to include Discord (#5690)
  Ollama improvements (#5609)
  feat: add Supabase MCP server to registry (#5629)
  Unlist VS Code extension tutorials from MCP and experimental sections (#5677)
  fix: make image processing work in github copilot provider (#5687)
  fix: do not take into account gitignore in developer mcp (#5688)
  docs: session storage migration (#5682)
  New maintainers (#5685)
  chore: Update governance (#5660)
  chore(release): release version 1.14.0 (minor) (#5676)
  fix : action icons overlap session title in chat history (#5684)
  Document recent goose PRs (#5683)
  docs: add GOOSE_PATH_ROOT environment variable documentation (#5678)
  feat: SessionManager integration for acp sessions (#5657)
  teach copilot our CI (#5672)
  ...
katzdave added a commit that referenced this pull request Nov 13, 2025
…eanup

* 'main' of github.com:block/goose: (46 commits)
  Fix context progress bar not resetting after /clear command (#5652)
  docs: removing double announcements (#5714)
  docs: mcp sampling support (#5708)
  hackathon banner  (#5710)
  Fix documentation-only change detection for push events (#5712)
  Added transaction commits to multi sql functions in session_manager (#5693)
  fix: improve and simplify tool call chain rendering (#5704)
  Fix: Always show autocompact threshold ui (#5701)
  chore: Update governance to include Discord (#5690)
  Ollama improvements (#5609)
  feat: add Supabase MCP server to registry (#5629)
  Unlist VS Code extension tutorials from MCP and experimental sections (#5677)
  fix: make image processing work in github copilot provider (#5687)
  fix: do not take into account gitignore in developer mcp (#5688)
  docs: session storage migration (#5682)
  New maintainers (#5685)
  chore: Update governance (#5660)
  chore(release): release version 1.14.0 (minor) (#5676)
  fix : action icons overlap session title in chat history (#5684)
  Document recent goose PRs (#5683)
  ...
tlongwell-block added a commit that referenced this pull request Nov 14, 2025
* origin/main: (51 commits)
  Compaction resiliency improvements (#5618)
  docs: ask goose button (#5730)
  Update prompt injection detection metrics (due to errors exporting to datadog) (#5692)
  Spence/icon2 tokyo drift (#5728)
  docs: logs rotation and misc updates (#5727)
  docs: automatic ollama model detection (#5725)
  Fix context progress bar not resetting after /clear command (#5652)
  docs: removing double announcements (#5714)
  docs: mcp sampling support (#5708)
  hackathon banner  (#5710)
  Fix documentation-only change detection for push events (#5712)
  Added transaction commits to multi sql functions in session_manager (#5693)
  fix: improve and simplify tool call chain rendering (#5704)
  Fix: Always show autocompact threshold ui (#5701)
  chore: Update governance to include Discord (#5690)
  Ollama improvements (#5609)
  feat: add Supabase MCP server to registry (#5629)
  Unlist VS Code extension tutorials from MCP and experimental sections (#5677)
  fix: make image processing work in github copilot provider (#5687)
  fix: do not take into account gitignore in developer mcp (#5688)
  ...
Surendhar-N-D pushed a commit to Surendhar-N-D/goose that referenced this pull request Nov 17, 2025
arul-cc pushed a commit to arul-cc/goose that referenced this pull request Nov 17, 2025
BlairAllan pushed a commit to BlairAllan/goose that referenced this pull request Nov 29, 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.

Image processing fails when using GitHub CoPilot as LLM provider

3 participants