refactor(agents): migrate chat to hub (#1102)#1456
Conversation
Code Review —
|
|
🟡 Every other file changed in this PR wraps # verify_path_validator.py line 16
from gaia_agent_chat.agent import ChatAgent, ChatAgentConfigRunning either script in a framework-only environment now throws a bare Same fix applies to |
|
🟡 When
Same gap exists in the two lazy-import sites in |
Resolves the actionable items from the PR #1456 bot review: - agent_loop.py + the two _chat_helpers lazy-import sites translated a missing gaia-agent-chat wheel into a swallowed ImportError / opaque 500; they now raise an actionable RuntimeError naming the install command, matching the CLI. - verify_path_validator.py / verify_shell_security.py guarded their bare gaia_agent_chat import with a SystemExit install hint (importorskip is unavailable in standalone scripts). - FRAMEWORK_PATHS dropped the now-dead gaia/agents/chat substring and filters the hub package generically (hub/agents/python/ + gaia_agent_chat) so chat-agent frames stay out of user-facing tracebacks; test updated to match.
8d29835 to
3442b53
Compare
|
🟡 Five broken GitHub hyperlinks in the published docs will 404 as soon as this merges. The path 🔍 Technical details
Broken clickable links (will 404):
Non-linked prose references in |
|
Rebased onto current Review items resolved:
Post-rebase drift the original branch never saw (new Verified: registry discovers |
3442b53 to
81a4b15
Compare
Resolves the actionable items from the PR #1456 bot review: - agent_loop.py + the two _chat_helpers lazy-import sites translated a missing gaia-agent-chat wheel into a swallowed ImportError / opaque 500; they now raise an actionable RuntimeError naming the install command, matching the CLI. - verify_path_validator.py / verify_shell_security.py guarded their bare gaia_agent_chat import with a SystemExit install hint (importorskip is unavailable in standalone scripts). - FRAMEWORK_PATHS dropped the now-dead gaia/agents/chat substring and filters the hub package generically (hub/agents/python/ + gaia_agent_chat) so chat-agent frames stay out of user-facing tracebacks; test updated to match.
|
🟡 Several GitHub source-code links in the updated docs will 404 — they use a Affected files: 🔍 Technical details
should be:
Quick fix — in all three files, replace
|
|
Fixed in a4fe24a — good catch, this was a sweep bug on my end (the rewrite of Dropped the stray Verified:
|
ChatAgent — the flagship conversational agent backing the chat/doc/file profiles — was the last family of registry builtins still hardcoded in the core framework wheel. It now ships as the standalone gaia-agent-chat wheel under hub/agents/python/chat/, exposing chat/doc/file as three gaia.agent entry points discovered by the registry. The core wheel no longer hardcodes them and the agent versions independently. `gaia chat` (incl. --ui) resolves through the registry and fails loudly with an install hint when the wheel is absent. Full+lite model tiers and the per-profile prompt/tool wiring are preserved exactly via registry.build_model_tiers. Continues the #1102 hub restructure after analyst/browser (#1446).
…t wheel The original chat→hub migration (#1102) was authored 122 commits back. Main has since grown new ChatAgent touch-points the replayed commit never saw: the scheduled-run executor and the dynamic-tools UI toggle imported ChatAgent from the now-deleted gaia.agents.chat, and tool_cost plus several tool-loader tests imported tool_bundles/ChatAgentConfig from the same dead path — every one would ImportError the moment the wheel landed. Repoint them at gaia_agent_chat (matching the migration's own lazy-import + install-hint pattern), guard the affected test modules with pytest.importorskip("gaia_agent_chat") so framework-only envs skip rather than error, and move tool_bundles into the hub package alongside session.
Resolves the actionable items from the PR #1456 bot review: - agent_loop.py + the two _chat_helpers lazy-import sites translated a missing gaia-agent-chat wheel into a swallowed ImportError / opaque 500; they now raise an actionable RuntimeError naming the install command, matching the CLI. - verify_path_validator.py / verify_shell_security.py guarded their bare gaia_agent_chat import with a SystemExit install hint (importorskip is unavailable in standalone scripts). - FRAMEWORK_PATHS dropped the now-dead gaia/agents/chat substring and filters the hub package generically (hub/agents/python/ + gaia_agent_chat) so chat-agent frames stay out of user-facing tracebacks; test updated to match.
…1102) The chat→hub migration moved ChatAgent's runnable examples out from under gaia.agents.chat. Repoint every doc reference so copy-paste examples resolve: agent/session/tool_bundles/lite_agent → gaia_agent_chat; the promoted FileToolsMixin/RAGToolsMixin/ShellToolsMixin → gaia.agents.tools; source-code links and file paths → hub/agents/python/chat/. Also corrects a long-stale PathValidator import (gaia.agents.chat.path_validator → gaia.security).
…ests CI's framework-only jobs (Unit Tests on `.[api]`, Security Tests on `.[dev,rag]`) run without gaia-agent-chat, which surfaced regressions the wheel-present local run masked: - The dynamic-tools UI toggle 500'd without the wheel: `dynamic_tools_env_override` had moved into the chat wheel but the core UI settings router imports it. Moved the helper to the core `tool_loader` (its feature home) and re-export it from the wheel's agent.py — the router no longer depends on the wheel, one truthy set preserved. - `test_chat_dynamic_tools` stubbed faiss/sentence_transformers as MagicMocks BEFORE the `importorskip`, so a skip (no wheel) leaked the stubs into the run and broke later memory/code-index tests. Moved the importorskip above the stub block so a skip leaves sys.modules untouched. - Guarded `test_dynamic_tool_filtering` (transitively builds a ChatAgent via `build_doc_agent_skeleton`) with importorskip. - Updated stale hub tests for the migration: chat/doc are no longer reserved ids or builtins, so `test_reserved_id_rejected` keeps only `builder`, `test_uninstall_builtin_refused` targets `builder`, and the agent-hub-metadata tests run full discovery + importorskip for the now-installed chat/doc agents. - test_security.yml installs the chat wheel (the verify_*.py guardrail scripts instantiate ChatAgent).
The earlier doc sweep rewrote `src/gaia/agents/chat/` → the hub path on lines that carried a `src/` prefix, producing `src/hub/agents/python/chat/...` — a path that does not exist in the repo, so the GitHub source-code links 404. Drop the stray `src/` so they point at the real `hub/agents/python/chat/...` tree. Verified: no `src/hub/` left in the repo, check_doc_links --internal-only reports 0 broken (949 OK), and the target file exists at the linked path.
|
🟡 The rename from Files that were missed and need the same
Additionally, 🔍 Technical details
Any user who runs |
a4fe24a to
0084488
Compare
Why this matters
ChatAgent — the flagship conversational agent powering
gaia chat(andgaia chat --ui) under itschat,doc, andfileprofiles — was the last family of registry builtins still hardcoded inside the core framework wheel. It now ships as the standalonegaia-agent-chatwheel underhub/agents/python/chat/, withchat/doc/fileregistered as threegaia.agententry points that the registry discovers automatically. The core wheel no longer hardcodes them, so the chat family versions independently like every other migrated agent.gaia chatresolves the agent through the registry and fails loudly with an install hint if the wheel is absent (mirroring how #1446 madegaia browse/gaia analyzeresolve). All three profiles, their full+lite model tiers (viaregistry.build_model_tiers), and their per-profile prompt/tool wiring are preserved exactly.Continues the #1102 Agent Hub restructure after connectors-demo (#1442) and analyst/browser (#1446). The shared
FileToolsMixin(directory monitoring) stays framework-side — promoted togaia.agents.tools.file_monitor_tools— since tool mixins are framework code (#1396).Test plan
python util/lint.py --all— black/isort clean (the only pylint hit,os.geteuidinlemonade_installer.py, is a pre-existing Windows-only false positive; mypy is warning-only)pytest tests/unit/agents/test_registry.py tests/unit/test_agents_split.py tests/unit/cli/test_cli_smoke.py— registry + split green; the 4cli_smokegaia-code/gaia-emrconsole-script hits are pre-existing shared-env pollution (verified passing on the base checkout), unrelated to chatpip install -e hub/agents/python/chat && pytest hub/agents/python/chat/tests/— 7 passed (registration shapes for chat/doc/file, lazy re-exports, discovery,installed:namespacing)pytestacross the chat-touched framework suites (chat agent, integration, system-prompt budget, browser tools, multi-device, required-connectors, registry factory, chat-UI helpers) — 182 passed with the wheel installed; all skip cleanly viaimportorskipin a framework-only envchat/doc/fileassource=installedwithinstalled:chatnamespace;builder/emailremain the only resident builtinsChat Agent Testsworkflow installs the wheel and runs both the package smoke tests and the framework session/RAG/path-validation suites