Abadawi/send has image to router#308321
Merged
aashna merged 13 commits intoApr 15, 2026
Merged
Conversation
The server-side auto-intent-service now handles has_image via a vision-aware pre-filter instead of returning HTTP 400. Remove the client-side hasImage early return in _tryRouterSelection() and send has_image: true in the router request body when images are present. Changes: - automodeService.ts: remove hasImage bail-out, pass hasImage to router - routerDecisionFetcher.ts: accept hasImage param, include has_image in request body, parse error code from 400 responses - automodeService.ts: handle no_vision_models error as a distinct fallback reason; _applyVisionFallback remains as safety net - automodeService.spec.ts: replace skip-router test with send-has_image test, add no_vision_models error handling test, update transient fallback test
Replace (err as any).errorCode pattern with a typed RouterDecisionError class that carries the errorCode as a proper property.
Add emptyPrompt and emptyCandidateList to the comment so telemetry documentation matches runtime behavior.
Verify the router was actually called and the error was logged with the noVisionModels fallback reason, not just that the model is gpt-4o.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Copilot extension’s auto-mode routing flow so image-bearing chat turns are routed server-side (by sending has_image) instead of being short-circuited client-side, and adds a dedicated fallback classification when the router reports no available vision models.
Changes:
- Remove the client-side image-based router bail-out and always send
has_imageto the router when images are present. - Add
RouterDecisionErrorwith parsed error codes from HTTP 400 responses to enable more specific fallback reasons (e.g.noVisionModels). - Update automode routing tests to validate
has_imagebehavior andno_vision_modelsfallback handling.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/platform/endpoint/node/automodeService.ts | Sends hasImage into router requests and maps no_vision_models to a distinct fallback reason. |
| extensions/copilot/src/platform/endpoint/node/routerDecisionFetcher.ts | Adds has_image to the router request body and introduces RouterDecisionError with parsed error codes. |
| extensions/copilot/src/platform/endpoint/node/test/automodeService.spec.ts | Updates/extends tests to cover routing for image turns and the no_vision_models fallback case. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 4
- Add this.name to RouterDecisionError - Fall back to raw errorText when error body is not JSON - Replace nested ternary with if/else for fallback reason - Pass server error codes through directly instead of mapping to client-side names, so future codes surface automatically - Add hasImage property to automode.routerFallback telemetry - Update GDPR annotation for new hasImage property
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tcher.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…vice.spec.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…vice.spec.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Copilot extension’s “auto mode” routing flow to let the server-side auto-intent/router handle image-containing requests (via a has_image flag) rather than having the client skip routing when images are present.
Changes:
- Remove the client-side early router bail-out for image requests and include
has_image: truein router request bodies when references contain images. - Introduce
RouterDecisionErrorto propagate a server-provided router error code and use it as a distinct router fallback reason. - Update automode unit tests to assert router invocation with
has_imageand to validate fallback behavior forno_vision_models.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/platform/endpoint/node/automodeService.ts | Sends has_image to the router, adds telemetry for hasImage, and treats server router error codes as fallback reasons. |
| extensions/copilot/src/platform/endpoint/node/routerDecisionFetcher.ts | Adds has_image request support and parses router error codes from non-OK responses via RouterDecisionError. |
| extensions/copilot/src/platform/endpoint/node/test/automodeService.spec.ts | Adjusts router/vision-related tests to validate has_image routing and no_vision_models fallback behavior. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 2
bhavyaus
reviewed
Apr 10, 2026
Only pass parsed errorCode to RouterDecisionError, not raw errorText. When the router returns a non-JSON body (e.g. HTML gateway timeout), the catch block in automodeService falls through to 'routerError' instead of emitting the raw response body as the telemetry reason. Add tests for non-JSON error body and JSON-without-error-field paths.
Both hasImage (this PR) and routingMethod (from main) modify the getRouterDecision signature and request body. Merged to include both parameters.
jinu-jang
suggested changes
Apr 10, 2026
bhavyaus
approved these changes
Apr 13, 2026
roblourens
approved these changes
Apr 13, 2026
jinu-jang
approved these changes
Apr 15, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Delegate image routing to server-side auto-intent-service
The server-side auto-intent-service now handles
has_imagevia a vision-aware pre-filter instead of returning HTTP 400. Remove the client-sidehasImageearly return in_tryRouterSelection()and sendhas_image: truein the router request body when images are present.Changes
automodeService.ts: removehasImagebail-out, passhasImageto routerrouterDecisionFetcher.ts: accepthasImageparam, includehas_imagein request body, parse error code from 400 responsesautomodeService.ts: handleno_vision_modelserror as a distinct fallback reason;_applyVisionFallbackremains as safety netautomodeService.spec.ts: replace skip-router test with send-has_imagetest, addno_vision_modelserror handling test, update transient fallback test