Merged
Conversation
…es from non-user messages Fixes #5845 - Goose randomly becomes unresponsive when using GitHub Copilot provider. This commit addresses two related issues: 1. Streaming error handling in GitHub Copilot provider: - Added proper HTTP status code checking before processing streaming responses - Added error response parsing to surface meaningful error messages - Added empty response detection 2. Image filtering for non-user messages: - Replace MessageContent::Image in non-user messages with placeholder text - Only detect and load embedded images from text paths in user messages - Prevents "image urls not allowed in non-user messages" errors Added tests: - test_format_messages_filters_images_in_non_user_messages - test_format_messages_assistant_text_with_image_path_no_image_loading 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: albina-popova <97168987+albina-popova@users.noreply.github.com>
Resolved conflicts by adopting main's refactored post() method which already uses handle_status_openai_compat for error handling.
Changed the comment about image filtering to clarify that extracting images from text is an outdated hack that should never be randomly applied to assistant messages, rather than focusing on provider limitations. This addresses review feedback from DOsinga.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes GitHub Copilot provider becoming unresponsive (issue #5845) by preventing images from being included in non-user messages, which causes provider errors. The fix adds filtering logic to ensure images are only sent in user messages, preventing the "image urls not allowed in non-user messages" error that was causing Goose to hang.
Changes:
- Modified image path detection to only apply to user messages (prevents assistant messages from accidentally loading images when mentioning file paths)
- Added filtering for explicit
MessageContent::Imagein non-user messages, replacing them with placeholder text - Added comprehensive tests for both filtering scenarios
Comments suppressed due to low confidence (1)
crates/goose/src/providers/formats/openai.rs:90
- The PR description mentions "Added proper HTTP status code checking before processing streaming responses, error response parsing, and empty response detection" in githubcopilot.rs, but this change is not present in the diff. The only changes are the image filtering logic in this file. Either the PR description is outdated or the streaming error handling changes are missing from this PR.
// Extracting images from text is an outdated hack that should never
// be randomly applied to assistant messages
if message.role == Role::User {
if let Some(image_path) = detect_image_path(&text.text) {
if let Ok(image) = load_image_file(image_path) {
content_array.push(json!({"type": "text", "text": text.text}));
content_array.push(convert_image(&image, image_format));
} else {
text_array.push(text.text.clone());
}
} else {
text_array.push(text.text.clone());
}
} else {
text_array.push(text.text.clone());
}
added 2 commits
January 28, 2026 10:18
Extended test_format_messages_with_image_path to also verify that assistant messages with image paths in text do NOT trigger image loading. This consolidates the test coverage into a single test.
alexhancock
approved these changes
Jan 28, 2026
zanesq
added a commit
that referenced
this pull request
Jan 28, 2026
…ensions * 'main' of github.com:block/goose: chore: re-sync package-lock.json (#6783) upgrade electron to 39.3.0 (#6779) allow skipping providers in test_providers.sh (#6778) fix: enable custom model entry for OpenRouter provider (#6761) Remove codex skills flag support (#6775) Improve mcp test (#6671) Feat/anthropic custom headers (#6774) Fix/GitHub copilot error handling 5845 (#6771) fix(ui): respect width parameter in MCP app size-changed notifications (#6376) fix: address compilation issue in main (#6776)
lifeizhou-ap
added a commit
that referenced
this pull request
Jan 28, 2026
* main: (47 commits) Upgrade error handling (#6747) Fix/filter audience 6703 local (#6773) chore: re-sync package-lock.json (#6783) upgrade electron to 39.3.0 (#6779) allow skipping providers in test_providers.sh (#6778) fix: enable custom model entry for OpenRouter provider (#6761) Remove codex skills flag support (#6775) Improve mcp test (#6671) Feat/anthropic custom headers (#6774) Fix/GitHub copilot error handling 5845 (#6771) fix(ui): respect width parameter in MCP app size-changed notifications (#6376) fix: address compilation issue in main (#6776) Upgrade GitHub Actions for Node 24 compatibility (#6699) fix(google): preserve thought signatures in streaming responses (#6708) added reduce motion support for css animations and streaming text (#6551) fix: Re-enable subagents for Gemini models (#6513) fix(google): use parametersJsonSchema for full JSON Schema support (#6555) fix: respect GOOSE_CLI_MIN_PRIORITY for shell streaming output (#6558) feat: add requires_auth flag for custom providers without authentication (#6705) fix: normalize extension names consistently in ExtensionManager (#6529) ...
michaelneale
added a commit
that referenced
this pull request
Jan 29, 2026
* main: (30 commits) Different approach to determining final confidence level of prompt injection evaluation outcomes (#6729) fix: read_resource_tool deadlock causing test_compaction to hang (#6737) Upgrade error handling (#6747) Fix/filter audience 6703 local (#6773) chore: re-sync package-lock.json (#6783) upgrade electron to 39.3.0 (#6779) allow skipping providers in test_providers.sh (#6778) fix: enable custom model entry for OpenRouter provider (#6761) Remove codex skills flag support (#6775) Improve mcp test (#6671) Feat/anthropic custom headers (#6774) Fix/GitHub copilot error handling 5845 (#6771) fix(ui): respect width parameter in MCP app size-changed notifications (#6376) fix: address compilation issue in main (#6776) Upgrade GitHub Actions for Node 24 compatibility (#6699) fix(google): preserve thought signatures in streaming responses (#6708) added reduce motion support for css animations and streaming text (#6551) fix: Re-enable subagents for Gemini models (#6513) fix(google): use parametersJsonSchema for full JSON Schema support (#6555) fix: respect GOOSE_CLI_MIN_PRIORITY for shell streaming output (#6558) ...
This was referenced Jan 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5845
replaces: #6212