-
Notifications
You must be signed in to change notification settings - Fork 268
Export WaitForDebugger for extension command debugging
#6433
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
Conversation
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
There was a problem hiding this 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 enables debugging support for custom extension commands by exporting the WaitForDebugger function in the azdext package. Previously, AZD_EXT_DEBUG=true only worked for service target extensions, but not for custom extension commands like azd ai agent init. The refactoring extracts the extension ID from the context within the function itself, removing the need for callers to pass it as a parameter.
Key Changes:
- Exported
waitForDebuggerasWaitForDebuggerfor public use by extension commands - Refactored function signature to extract
extensionIdfrom context internally rather than requiring it as a parameter - Updated documentation to indicate the function should be called at the start of extension command implementations
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
cli/azd/pkg/azdext/debugger.go |
Exported WaitForDebugger function, moved extension ID extraction inside the function, and enhanced documentation |
cli/azd/pkg/azdext/extension_host.go |
Updated to call the new WaitForDebugger signature without passing extension ID parameter |
Fixes #6432
This PR enables
AZD_EXT_DEBUGsupport for custom extension commands likeazd ai agent init, allowing one to attach a debugger to the extension process at startup. This is done by exportingWaitForDebugger(ctx, azdClient)in theazdextpackage to be used by extension commands.Previously,
AZD_EXT_DEBUG=trueonly worked when extensions were invoked as service targets (e.g., viaazd deploy), but not for custom extension commands.Validation
Tested
AZD_EXT_DEBUG=true azd ai agent init, which now displays the debug prompt with PID: