Skip to content

fix(amazonq): improve file change notifications and error handling#6176

Open
amit-lulla wants to merge 4 commits intoaws:mainfrom
amit-lulla:fix/file-notifications-error-handling
Open

fix(amazonq): improve file change notifications and error handling#6176
amit-lulla wants to merge 4 commits intoaws:mainfrom
amit-lulla:fix/file-notifications-error-handling

Conversation

@amit-lulla
Copy link
Copy Markdown

Summary

  • Fix file changes not being reflected in IDE after agent edits
  • Improve error handling in chat commands

Changes

File change notifications:

  • LspEditorUtil.kt: Save documents and refresh VFS after workspace edits are applied
  • AmazonQLanguageClientImpl.kt: Use synchronous VFS refresh for immediate change detection

Error handling:

  • BrowserConnector.kt: Add handleChatResponse helper to log errors instead of silently ignoring them

Test plan

  • Verify workspace edits are immediately reflected in the IDE without manual "Reload from Disk"
  • Verify error logs appear when chat commands fail
  • Compilation passes

Fixes aws#6039

This commit addresses two related issues:

1. IllegalStateException: "You don't have access to the resource"
   - Modified listRegionProfiles() to return null for empty profiles
     instead of throwing an IllegalStateException
   - Updated callers to handle null/empty profiles gracefully

2. EDT Threading Violation when selecting Q profile
   - Wrapped QRegionProfileDialog.show() in runInEdt to ensure
     dialog is shown on Event Dispatch Thread
   - Made AsyncComboBox.repaint() calls EDT-safe using invokeLater

Files changed:
- QRegionProfileManager.kt: Return null for empty profiles
- ChatCommunicationManager.kt: Add runInEdt wrapper for dialog
- CodeWhispererModelConfigurator.kt: Handle null profiles gracefully
- QRegionProfileDialog.kt: Handle empty profiles with telemetry
- AsyncComboBox.kt: EDT-safe repaint calls
- Fix VFS refresh in LspEditorUtil to save documents and refresh IDE
  after workspace edits are applied
- Use synchronous VFS refresh in AmazonQLanguageClientImpl for
  immediate file change detection
- Add handleChatResponse helper in BrowserConnector to properly log
  errors instead of silently ignoring them
@amit-lulla amit-lulla requested a review from a team as a code owner January 13, 2026 13:46
removeAllItems()
repaint()
// Ensure repaint happens on EDT for thread safety
ApplicationManager.getApplication().invokeLater { repaint() }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please add to the description what is the error that we get here?

?: error("Attempted to fetch profiles while there does not exist")
// Return empty list when no profiles available instead of throwing
if (profiles.isNullOrEmpty()) {
return@calculateIfIamIdentityCenterConnection emptyList()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not expected behavior. We need a profile to proceed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens in the case of null profiles?

mappedProfiles.takeIf { it.isNotEmpty() }?.also {
connectionIdToProfileCount[connection.id] = it.size
} ?: error("You don't have access to the resource")
// Return null for empty profiles instead of throwing, let callers handle gracefully
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need profiles for using the feature

amit-lulla and others added 2 commits January 14, 2026 20:46
…ments

- Add descriptive comments to AsyncComboBox explaining EDT threading errors
- Add debug logging when no profiles available for customization listing
- Improve null profile handling in QRegionProfileManager with clear logging
- Document that profiles are required for Q features
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.

3 participants