Skip to content

Fix "tool undefined completed" accessibility announcement in chat #251442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 13, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 13, 2025

When a chat tool completes but has no confirmationMessages.title, screen readers were announcing "Tool undefined completed" instead of providing meaningful information.

Root Cause

The accessibility provider was attempting to access the .value property on an undefined title object:

// Before: This would result in "Tool undefined completed"
typeof invocation.confirmationMessages?.title === 'string' 
  ? invocation.confirmationMessages?.title 
  : invocation.confirmationMessages?.title.value  // ← .value on undefined

Solution

Added proper null checks and fallback logic to handle all title scenarios:

// After: Proper validation with fallback to toolId
const titleObj = invocation.confirmationMessages?.title;
let title = '';
if (typeof titleObj === 'string' && titleObj.trim()) {
    title = titleObj;
} else if (titleObj && typeof titleObj === 'object' && 'value' in titleObj && titleObj.value && titleObj.value.trim()) {
    title = titleObj.value;
} else {
    // Fallback to toolId if no valid title
    title = invocation.toolId;
}

The fix now handles:

  • ✅ Undefined confirmationMessages
  • ✅ Undefined title property
  • ✅ Empty or whitespace-only titles
  • ✅ Valid string titles
  • ✅ Valid MarkdownString titles with .value property
  • ✅ Graceful fallback to toolId when needed

Testing

Added comprehensive test cases covering all scenarios to prevent regressions.

Fixes #251439.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • electronjs.org
    • Triggering command: node-gyp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits June 13, 2025 20:10
Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
Co-authored-by: meganrogge <29464607+meganrogge@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Tool undefined completed Fix "tool undefined completed" accessibility announcement in chat Jun 13, 2025
@Copilot Copilot AI requested a review from meganrogge June 13, 2025 20:15
Copilot finished work on behalf of meganrogge June 13, 2025 20:15
@meganrogge meganrogge marked this pull request as ready for review June 13, 2025 20:50
@meganrogge meganrogge added this to the June 2025 milestone Jun 13, 2025
@meganrogge meganrogge marked this pull request as draft June 13, 2025 20:51
@meganrogge meganrogge marked this pull request as ready for review June 13, 2025 20:52
@meganrogge meganrogge enabled auto-merge (squash) June 13, 2025 20:52
@meganrogge meganrogge merged commit 9a0a54c into main Jun 13, 2025
8 checks passed
@meganrogge meganrogge deleted the copilot/fix-251439 branch June 13, 2025 21:06
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.

Tool undefined completed
3 participants