Skip to content

fix(agents): report agent import failures instead of "not installed" - #4587

Closed
github-actions[bot] wants to merge 1 commit into
mainfrom
autofix/issue-4586
Closed

github-actions[bot] wants to merge 1 commit into
mainfrom
autofix/issue-4586

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Before: when an agent wheel was installed but failed to import, gaia chat, the email paths, the Agent UI and the email evals all said the agent was "not installed". The usual cause is an agent from main running against a released core. The suggested source-install command then pulled main again, which brought back the same failure. After: an installed-but-broken agent is reported as such, with the real import error, both package versions and a --force-reinstall pinned to the core's release tag. A genuinely missing agent still gets the "not installed" hint, now pinned to the same tag.

Closes #4586

Test plan

  • python -m pytest tests/unit/agents/test_install_hints.py passes (adds cases for installed-but-broken, both versions, pinned URL)
  • python util/lint.py --all passes
  • python -m pytest tests/unit/ shows no failures in touched areas. The remaining failures come from missing optional deps (dateutil, cvss, sherpa_onnx, fitz, responses) and sandbox read-only paths, and reproduce on main.
  • On amd-gaia==0.24.1, install gaia-agent-chat from main, run gaia chat, and confirm the error names cannot import name 'gaia_home', shows both versions, and suggests [email protected]#subdirectory=...
  • Uninstall gaia-agent-chat, run gaia chat, and confirm the "not installed" hint now uses the @v0.24.1 URL
  • Run the suggested --force-reinstall command and confirm gaia chat starts
🔍 Technical details
  • All changes go through src/gaia/agents/install_hints.py. source_install_command() now pins @v{gaia.version.__version__} and accepts force_reinstall=. agent_not_installed_message() gains an error= kwarg and checks importlib.metadata.version(wheel). If the wheel is installed, it returns the skew message instead of the caller's "not installed" subject.
  • The call sites (cli.py ×3, ui/server.py, ui/agent_loop.py, ui/_chat_helpers.py streaming path) now pass error=e. The five email eval modules replace their ad-hoc next_step="Original import error: …" with error=exc, so the error is no longer duplicated.
  • _chat_helpers._agent_unavailable_message only fires when find_spec("gaia_agent_chat") is None, so it has no exception to pass. It gets the pinned URL automatically, as do init_command.py and api/agent_registry.py, which call source_install_command directly.
  • Caveat: a core built from main still reports its last release version (e.g. 0.24.1), so the hint there points at the last release tag. Dev checkouts normally install the agents in editable mode and don't see this hint.
  • This doesn't change the amd-gaia>=0.22.0 floor in gaia-agent-chat. As the issue notes, the correct floor can't be named until a core release that includes Honor GAIA_HOME for cache chat and index write paths #4381 ships.

An agent wheel that was installed but failed to import (usually because it
came from main and needs core symbols the released amd-gaia lacks) was
reported as "not installed", and the suggested source-install URL was
unpinned, so following it pulled main again and reproduced the failure.

The hint now detects an installed wheel and reports the real ImportError,
both package versions, and a --force-reinstall pinned to the core's tag.
The source-install URL is pinned to v<core version> everywhere.

Closes #4586
@kovtcharov

Copy link
Copy Markdown
Contributor

Closing as a duplicate of #4588, which fixes the same "not installed" misreport for #4586 and is already reviewed.

@kovtcharov

Copy link
Copy Markdown
Contributor

Duplicate of #4588, which fixes the same "not installed" misreport for #4586 and is already reviewed — this one can be closed.

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Closing: duplicate of #4588, which addresses the same #4586 misreport and has already gone through review.

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.

[Bug]: agent ImportError is misreported as "agent is not installed", and following the hint recreates the problem

2 participants