Skip to content

[Throwaway POC] Potential fix for supportsVision undefined#4888

Draft
jruales wants to merge 1 commit intomainfrom
jruales/2026.03-potential-fix
Draft

[Throwaway POC] Potential fix for supportsVision undefined#4888
jruales wants to merge 1 commit intomainfrom
jruales/2026.03-potential-fix

Conversation

@jruales
Copy link
Copy Markdown
Contributor

@jruales jruales commented Mar 31, 2026

I was seeing issues like TypeError: Cannot read properties of undefined (reading 'supportsVision') in logs when running local evals, so I asked Copilot to investigate and it suggested this fix. I asked copilot to come up with a PR description, and this is what it said:


Title: Fix crash in sendInvokedToolTelemetry when tool result contains images

Description:

When a tool (e.g. view_image) returns an image in its result, sendInvokedToolTelemetry crashes with:

TypeError: Cannot read properties of undefined (reading 'supportsVision')

Root cause: sendInvokedToolTelemetry creates a bare BasePromptRenderer to count tokens, but does not register IPromptEndpoint in the DI container. When the tool result contains a LanguageModelDataPart image, PrimitiveToolResult.render() calls onImage(), which accesses this.endpoint.supportsVision — but this.endpoint is undefined because it was never injected.

Fix: Filter out image data parts before passing the tool result content to PrimitiveToolResult. Image blobs are binary data that don't contribute to meaningful token counts, so they should be excluded from this telemetry path.Continued with Autopilot

Provided the PR title and description as requested.

@jruales jruales changed the title Potential fix for supportsVision undefined [Throwaway POC] Potential fix for supportsVision undefined Mar 31, 2026
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.

1 participant