Skip to content

fix: capture error from loadAiCatalog in selectNewModel - #6831

Merged
trangevi merged 4 commits into
trangevi/init-from-codefrom
copilot/sub-pr-6828-another-one
Feb 20, 2026
Merged

fix: capture error from loadAiCatalog in selectNewModel#6831
trangevi merged 4 commits into
trangevi/init-from-codefrom
copilot/sub-pr-6828-another-one

Conversation

Copilot AI commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

The error returned from loadAiCatalog was silently discarded. The outer err variable was never assigned because spinner.Start used short variable declaration (:=), scoping its err to that block. The subsequent if err != nil check was therefore always false.

Changes

  • selectNewModel: assign loadAiCatalog return value to the outer err variable so catalog load failures are correctly propagated to the caller
  • go.mod/go.sum: reverted unintended changes to azure.ai.agents and microsoft.azd.concurx module files

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>
Copilot AI changed the title [WIP] Update to address feedback on 'init from code' flow fix: capture error from loadAiCatalog in selectNewModel Feb 20, 2026
Copilot AI requested a review from trangevi February 20, 2026 22:34
github.com/mark3labs/mcp-go v0.41.1
github.com/spf13/cobra v1.10.1
github.com/spf13/pflag v1.0.10
github.com/stretchr/testify v1.11.1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot don't make changes to these go.mod and go.sum files

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted in 347469e.

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go
…or loadAiCatalog failure

Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>
Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>
@trangevi
trangevi merged commit aaab505 into trangevi/init-from-code Feb 20, 2026
13 checks passed
trangevi added a commit that referenced this pull request Feb 24, 2026
* Add support for init from code

Signed-off-by: trangevi <trangevi@microsoft.com>

* Code comment

Signed-off-by: trangevi <trangevi@microsoft.com>

* Addressing some comments

Signed-off-by: trangevi <trangevi@microsoft.com>

* make sure src is provided for local code story for now

Signed-off-by: trangevi <trangevi@microsoft.com>

* some fixes

Signed-off-by: trangevi <trangevi@microsoft.com>

* Add manual defaulting

Signed-off-by: trangevi <trangevi@microsoft.com>

* Refactoring a bunch based on expected experience

Signed-off-by: trangevi <trangevi@microsoft.com>

* broken spinner

Signed-off-by: trangevi <trangevi@microsoft.com>

* Remove env var print

* Add support for --project-id

Signed-off-by: trangevi <trangevi@microsoft.com>

* Missing env var

Signed-off-by: trangevi <trangevi@microsoft.com>

* Address feedback

Signed-off-by: trangevi <trangevi@microsoft.com>

* Switch to public repo

Signed-off-by: trangevi <trangevi@microsoft.com>

* Changes for existing ACR

Signed-off-by: trangevi <trangevi@microsoft.com>

* More for existing ACR support

Signed-off-by: trangevi <trangevi@microsoft.com>

* app insights changes

Signed-off-by: trangevi <trangevi@microsoft.com>

* Point to branch for now

Signed-off-by: trangevi <trangevi@microsoft.com>

* tests

Signed-off-by: trangevi <trangevi@microsoft.com>

* Integrate with azd extension model handling

Signed-off-by: trangevi <trangevi@microsoft.com>

* Move model handling

Signed-off-by: trangevi <trangevi@microsoft.com>

* Update cli/azd/extensions/azure.ai.agents/internal/cmd/init_from_code.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Proper http client handling

Signed-off-by: trangevi <trangevi@microsoft.com>

* Remove custom string matching helpers in favor of strings.Contains (#6829)

* Initial plan

* Replace containsString/searchString with strings.Contains in test file

Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>

* Revert unrelated go.mod/go.sum changes

Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>

* cspell

Signed-off-by: trangevi <trangevi@microsoft.com>

* Fix path traversal vulnerability in init_from_code template file download (#6830)

* Initial plan

* Use filepath.Clean() for path validation to prevent path traversal attacks

Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>

* Revert unrelated go.mod/go.sum changes

Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>

* fix: capture error from loadAiCatalog in selectNewModel (#6831)

* Initial plan

* fix: capture error from loadAiCatalog in selectNewModel

Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>

* fix: revert go.mod/go.sum changes and add user-facing error message for loadAiCatalog failure

Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>

* fix: remove fmt.Printf from loadAiCatalog error path

Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>

* Code review

Signed-off-by: trangevi <trangevi@microsoft.com>

* Put the status check before attempting to use the response

Signed-off-by: trangevi <trangevi@microsoft.com>

* Fix path handling

Signed-off-by: trangevi <trangevi@microsoft.com>

* Remove unused code

Signed-off-by: trangevi <trangevi@microsoft.com>

* cspell

Signed-off-by: trangevi <trangevi@microsoft.com>

* Address PR comment

Signed-off-by: trangevi <trangevi@microsoft.com>

---------

Signed-off-by: trangevi <trangevi@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: trangevi <26490000+trangevi@users.noreply.github.com>
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.

2 participants