fix(cli,lib): wire PROTOCOL_VERSION import + track pyproject for __version__ - #22
Merged
Merged
Conversation
…rsion__ - admin/version_info.py: import PROTOCOL_VERSION from amplifier_agent_lib.protocol instead of hardcoding "0.1.0". This fixes the lie in `amplifier-agent version --json` which reported wire 0.1.0 while the engine speaks 0.2.0 (surfaced by reality-check). Prevents future drift: now uses the same source of truth as modes/single_turn.py. - amplifier_agent_lib.__version__: resolve from importlib.metadata instead of hardcoding "0.2.0" vs pyproject.toml's "0.3.0". Fixes --version, version command, serverInfo payload, and prepared-bundle cache key reporting stale version. - tests: update protocol version assertions from 0.1.0 to 0.2.0 after ea51d05 bump. test_cli_version_subcommand.py now imports PROTOCOL_VERSION from protocol package so it can never go stale again. Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
manojp99
added a commit
that referenced
this pull request
May 29, 2026
…_API_KEY, accept legacy AZURE_OPENAI_KEY) (#23) Aligns the CLI's Azure provider detection with the rest of the project. The README, architecture presentation, cheatsheet, upstream amplifier-module-provider-azure-openai, and Azure OpenAI Python SDK all use AZURE_OPENAI_API_KEY, but the CLI was only honoring AZURE_OPENAI_KEY. After this change, the CLI prefers AZURE_OPENAI_API_KEY, accepts AZURE_OPENAI_KEY as a deprecated legacy alias with a one-time [WARN] on stderr, and preserves detection precedence (ANTHROPIC_API_KEY > OPENAI_API_KEY > AZURE_OPENAI_API_KEY > OLLAMA_HOST). Mirrors the upstream Azure provider module's dual-accept pattern (see __init__.py lines 119-120), which already prefers AZURE_OPENAI_API_KEY and falls back to AZURE_OPENAI_KEY. Verification: python_check clean on all 8 changed .py files, 53 tests pass on targeted test suite, full pytest shows same 23 pre-existing failures as origin/main (+2 new tests passing, no new failures). Manual verification confirms detection works with both spellings, legacy fallback triggers deprecation warning. Separate from PR #22 (version-info-and-error-message). 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-authored-by: Manoj Prabhakar Paidiparthy <mpaidiparthy@microsoft.com> Co-authored-by: Amplifier <240397093+microsoft-amplifier@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.
What. Three drift fixes on the
amplifier-agent versionsurface. (1)admin/version_info.pyhad a hardcodedPROTOCOL_VERSION = "0.1.0"left behind from before the0.2.0protocol bump (commit ea51d05), causingamplifier-agent version --jsonto advertise a wire version the engine no longer speaks. It now importsPROTOCOL_VERSIONdirectly fromamplifier_agent_lib.protocol— the same constant the engine andmodes/single_turn.pyalready use as truth — so the two can never drift again. (2)amplifier_agent_lib.__version__was hardcoded to"0.2.0"whilepyproject.tomlhad moved to0.3.0, soversion,--version, theserverInfopayload, and the prepared-bundle cache key all reported a stale version. It now resolves viaimportlib.metadata.version("amplifier-agent")with a hardcoded fallback only for the source-tree-without-dist-info edge case. (3) Three tests still asserted"0.1.0"post-protocol bump; updated to"0.2.0", andtest_cli_version_subcommand.pynow importsPROTOCOL_VERSIONfrom the protocol package so it cannot go stale again.Why. The reality-check that surfaced these caught two user-visible lies on a published-facing endpoint: wrappers do pre-spawn protocol probes via
version --json, so a wrongprotocolVersionpayload risks engine/wrapper handshake failures with confusing diagnostics. Tying__version__to packaging metadata (rather than restating it) also closes the door on every future drift instance — including in places we didn't touch this round (engineserverInfo, cache key, doctor output).How verified.
uv run amplifier-agent version --jsonnow emits{"version": "0.3.0", "protocolVersion": "0.2.0"}matchingpyproject.tomlandprotocol/methods.pyrespectively.uv run amplifier-agent --versionemitsamplifier-agent, version 0.3.0. Targeted pytest pass (34/34) across the affected test files; full suite passes everywhere it passed onmain(22 pre-existing failures unrelated to this PR — Mode A v2 envelope,--mcp-serversflag, spec.md staleness — exist before and after).python_checkclean on all changed files.