Skip to content

Fix/GitHub copilot error handling 5845#6771

Merged
DOsinga merged 5 commits intomainfrom
fix/github-copilot-error-handling-5845
Jan 28, 2026
Merged

Fix/GitHub copilot error handling 5845#6771
DOsinga merged 5 commits intomainfrom
fix/github-copilot-error-handling-5845

Conversation

@DOsinga
Copy link
Collaborator

@DOsinga DOsinga commented Jan 28, 2026

Summary

Fixes #5845

replaces: #6212

albina-popova and others added 3 commits December 20, 2025 17:13
…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.
Copilot AI review requested due to automatic review settings January 28, 2026 15:12
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 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::Image in 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());
                        }

Douwe Osinga 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.
@DOsinga DOsinga requested a review from jh-block January 28, 2026 15:20
@DOsinga DOsinga merged commit 0270dd3 into main Jan 28, 2026
16 of 18 checks passed
@DOsinga DOsinga deleted the fix/github-copilot-error-handling-5845 branch January 28, 2026 17:55
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)
  ...
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.

goose randomly stops responding

3 participants