fix(eval): support azd ai agent eval generate with init fallback#320
Merged
Conversation
azure.ai.agents extension 0.1.40 renamed 'azd ai agent eval init' to 'azd ai agent eval generate', causing 'agentops eval init' to hard-fail on the deprecation error. run_azd_eval_init now tries 'generate' first and falls back to the legacy 'init' subcommand only when the installed extension reports the subcommand name as unknown/unrecognized/deprecated. Genuine failures (auth, endpoint, timeout) are surfaced immediately. All preserved flags and recipe discovery/persistence behaviour are unchanged. Adds _eval_subcommand_unsupported / _run_eval_subcommand helpers and unit tests covering the new-extension, old-extension fallback, deprecation, and real-error-passthrough paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
agentops eval inithard-failing on theazure.ai.agentsazd extension 0.1.40, which renamed the eval subcommandazd ai agent eval init->azd ai agent eval generate.Repro on 0.1.40:
Change
run_azd_eval_initnow builds the command without a hardcoded subcommand and delegates to a new_run_eval_subcommandhelper that:generatefirst (extension >= 0.1.40),initonly when the extension reports the subcommand name as unknown/unrecognized/deprecated (centralized, unit-tested_eval_subcommand_unsupportedmatcher),--project-endpoint,--agent,--gen-instruction-file,--eval-model,--dataset, repeated--evaluator) and recipe discovery/persistence are preserved.Tests
init->generate).initnever called), old-extension fallback (asserts both argvs + identical flags), deprecation-not-hard-fail, genuine-error-passthrough, and a_eval_subcommand_unsupportedtruth-table test.uv run pytest tests/),ruff checkclean,mypyclean.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com