Repository navigation
test(api): pin the flagship construction the API server depends on - #3072
Conversation
The OpenAI-compatible server builds the one agent it serves by splatting AGENT_MODELS["gaia"]["init_params"] plus an output_handler straight into GaiaAgent, which funnels them into the GaiaAgentConfig dataclass. Any keyword the dataclass does not declare is a TypeError per request, and nothing covered it: renaming ChatAgentConfig.output_handler leaves all 115 existing API tests green while /v1/chat/completions 500s for every caller. The new test drives the real AgentRegistry.get_agent rather than re-implementing its body, so drift on either side of the contract fails — a dropped config field and a keyword added only in get_agent were both verified to fail it. A third case pins the extra keywords _apply_env_overrides injects for `gaia api start --debug`, which reach the constructor the same way. Also adds agent_registry.py to the workflow's path filter, without which editing the registry alone would not run the suite that guards it, and adds the flagship to the import smoke-check lists that still named only the chat agent.
|
Verdict: Approve This closes a real gap: the flagship agent is reached by the OpenAI-compatible API through a call that hands it every configured keyword blind, so a keyword the agent's config doesn't declare would have turned every I verified the contract the test asserts actually holds today (the config declares every keyword the registry can inject, including the debug-mode ones, and the streaming handler really does reach the agent's console). The three comment rewrites in the existing tests replace genuinely garbled sentences with accurate ones. Only minor suggestions, none blocking. The most useful: one of the three assertions is weaker than its own error message claims — it would still pass if the streaming flag stopped working, because that key is already present before the flag is applied. Real-world evidenceN/A — tests and CI configuration only; no user-visible surface changes. The verdict rests on static review plus reading the code under test to confirm the pinned contract holds. I could not execute the new tests in this environment (the review runner's shell is unavailable), so the pass/fail signal has to come from the PR's own CI run of the Gaia Agent Tests workflow. 🔍 Technical detailsIssues🟢
(Worth noting while you're in there: 🟢 Third copy, identical body. Worth lifting into a 🟢 The new CI trigger covers
Strengths
|
The flag-liveness check could not detect the failure it was named for. It compared init_params before and after _apply_env_overrides, but AGENT_MODELS already declares `streaming` and `silent_mode`, so those two never appear in the diff — GAIA_API_STREAMING could stop being read entirely and the assertion still passed. Asserting the expected key set instead has the same blind spot for the same reason: the key is present either way, only the value moves. Verified by simulating a dead GAIA_API_STREAMING; both key-based forms stayed green, the value check fails and names the flag. Comparing values also removes a spurious failure: with GAIA_API_DEBUG and GAIA_API_SHOW_PROMPTS set in the ambient environment, the import-time call had already applied them, leaving the before/after diff empty. Also widens the workflow path filter from agent_registry.py to src/gaia/api/**, since the same test pins sse_handler.py through the console assertion and a rename there would have skipped this suite.
|
Took two of the three suggestions; skipping the The flag-liveness fix needed to go further than suggested. Asserting the expected key set has the same blind spot as the original diff-based check — Widened the workflow filter to Skipped: the shared Also filed #3254: 🔍 Technical detailsWhy key presence can't work. Simulated a dead flag by replacing the
Now asserts On #3254 — worth knowing before anyone wires it up: Validation. Branch merges cleanly against |
Skill audit
✅ All audited skills cleared the tier they claim. Per-finding detail is withheld here on purpose. Read it in the Security > Code scanning tab, or download the |
# Conflicts: # .github/workflows/test_gaia_agent.yml
|
Conflicts cleared — this had been stuck for three weeks and the workflow half of it is now redundant, but the tests still earn the merge. While this sat, 🔍 Technical detailsMerged
Resolution keeps main's Tests run on the merge result, all passing: |
amd#4120) Five open PRs (amd#4096, amd#4108, amd#3937, amd#3122, amd#3072) are showing a red agent-eval lane for a scorecard that was never produced. The Anthropic account is over its weekly spend cap, and the rejection text changed to a wording the preflight classifier does not recognise, so instead of "quota exhausted, this says nothing about your PR" the job dies in ~37 seconds with "could not be classified" and looks like a measured quality regression. After this change the same outage is named as a quota outage and points at billing rather than at the PR or the repository secrets. The pattern matches on `weekly limit`, not on the reset date the message quotes — that date moves every reset. ## Test plan - [ ] `python -m pytest tests/unit/test_classify_claude_probe.py -q` — 30 passed - [ ] `test_real_weekly_limit_rejection_is_a_quota_problem` feeds the verbatim text from run 35681533582 (job 106629918099), BOM and U+00B7 included, and asserts `quota`; it fails on `main` - [ ] `test_the_weekly_limit_pattern_does_not_depend_on_the_reset_date` pins that a different reset date still classifies - [ ] `python util/lint.py --black --isort --flake8` passes - [ ] The classifier stays pure ASCII (`test_the_classifier_module_is_pure_ascii`), which the PowerShell eval step depends on Co-authored-by: Kalin Ovtcharov <[email protected]>
…4353) About 300 unit tests never ran in CI. Their files skip as a whole when a hub wheel (`gaia_agent_chat`, `gaia_agent`, `gaia_agent_email`) or an optional extra is missing. The unit lane lacks them, but it still names the files, so the lane check counted them as covered. With this PR, each file runs in a lane that installs what it needs, and a lane fails when a file skips as a whole without an allowlist entry saying which lane runs it. Stacked on #4344. Merge #4343 and #4344 first. - **The new guard runs inside each lane**, right after install. It collects the job's own pytest commands in that lane's environment, so it sees what the lane actually runs. It reports the skipping file by name. This matters because a file that imports a skipping helper is otherwise blamed on the helper's line: `test_chat_inline_web_ssrf.py` was hidden that way. - **Two moved files needed repairs to pass together.** `test_chat_fix_contracts.py` picked up file tools leaked from earlier tests. `test_chat_system_prompt_budget.py` evicted the chat agent module at collection, so other files' patches stopped hitting it. - **Two files stay allowlisted with no lane, for an owner to decide.** `test_profilespec_characterization.py` has 11 golden rows that drifted, and its docstring says golden updates need sign-off. `test_tool_loader_token_budget.py` has 4 token and tool-count pins that are stale, and even re-pinned, one ratio is over budget. Overlaps: #4350 is also stacked on #4344 and edits the offline-integration list and the allowlist, so expect a small conflict there. #4038, #3721, #3669, #3812 and #3072 touch other parts of `test_unit.yml` and `test_gaia_agent.yml`. ## Test plan - [x] Before: `python util/check_module_skips.py --workflow test_unit.yml --job unit-tests` with no `module_skips` entries reports 80 files skipping wholesale and exits 1 - [x] After: the guard exits 0 for all 7 guarded jobs, each run in a clean py3.12 venv built from that job's install step - [x] `python util/check_test_lane_coverage.py` and `python util/lint.py --test-lanes` pass (31 module-skip entries verified) - [x] New tests: `pytest tests/unit/test_check_module_skips.py tests/unit/test_check_test_lane_coverage.py` passes 64. They include a real `--collect-only` over a temp repo - [x] Chat-lane files in the chat env: 421 passed. Before the two test repairs, 2 failed when run together - [x] Flagship-lane files in the gaia env: 59 passed. `test_mcp2_server.py` plus the MCP transcript tests in the MCP env: 27 passed - [x] Email unit lane's full command plus `test_synthetic_mbox.py`: 4980 passed - [x] The 4 newly unskipped files in the unit job (docx, pptx, reportlab, slack): 60 passed. Full `tests/unit/` in that env: 14509 passed, 23 failed. The failures are in 3 files (uninstall, CLI smoke, Lemonade ASR) that also fail when run alone. They come from this Mac's setup: `GAIA_HOME` isolated and `gaia` not on PATH. This PR changes no code those files exercise - [x] `actionlint` is clean on the 6 edited workflows. `black`, `isort`, and `pylint --errors-only` are clean on the changed Python - [ ] Watch the MCP lane's Windows leg run `test_mcp2_server.py` and the guard. They were only run on macOS locally Fixes #4206 --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Ovtcharov <[email protected]> Co-authored-by: Claude Opus 5 <[email protected]> Co-authored-by: f <f@f> Co-authored-by: probe <probe@local>
Renaming one field on
ChatAgentConfigbreaks/v1/chat/completionsfor every caller — and the entire API test suite stays green. The server builds the one agent it serves by splatting the registry'sinit_paramsplus an SSEoutput_handlerstraight into the config dataclass, so any keyword the dataclass stops declaring is aTypeErrorraised per request; that construction had no test anywhere. It does now, and it drives the realget_agent()rather than a copy of its body, so drift on either side of the contract fails CI instead of shipping.Test plan
python -m pytest hub/agents/gaia/python/tests/test_api_construction.py -xvs— 3 passpython -m pytest hub/agents/gaia/python/tests/ tests/unit/api/ tests/test_api.py -q— no collateral damage (220 + 112 pass locally)output_handleronChatAgentConfig(hub/agents/chat/python/gaia_agent_chat/agent.py) and re-run — must fail withTypeError: GaiaAgentConfig.__init__() got an unexpected keyword argument 'output_handler'. Before this PR the same break left all 115 API tests passing.init_paramsinsideget_agent()only — must fail. This is why the test callsget_agent()instead of reproducing it.python util/lint.py --importswith and without the hub wheels installed — the new flagship entry reports[OK]when present and[SKIP]when not, never a failure.🔍 Technical details
Three cases in
hub/agents/gaia/python/tests/test_api_construction.py:get_agent("gaia")builds a realGaiaAgentand the SSE handler lands onagent.console—silent_mode=Truealso ships ininit_params, so construction not raising is only half the assertion.AGENT_MODELS["gaia"]["class_name"]still resolves toGaiaAgent;get_agentfolds a stale path'sImportErrorinto a genericValueError, so a rename would otherwise surface only as a runtime 500._apply_env_overrides()injectsdebug/silent_mode/show_prompts/streamingforgaia api start --debug; those keys are derived from the function rather than hardcoded, and asserted to be declared fields.Hermetic and ~14s: memory init is forced off via
GAIA_MEMORY_DISABLEDand the tool registry is isolated, matching the sibling tests in that directory. No model server needed.Two smaller items ride along.
test_gaia_agent.ymlgainssrc/gaia/api/agent_registry.pyin its path filter — without it, editing the registry alone would not run the suite that now guards it.tests/test_api.pyandtests/unit/api/test_sse_confirmation_gate.pyhad comments left garbled by #2995; note thetest_api.pystub is defensive rather than load-bearing (model_exists("gaia")is alreadyTrue), and the rewritten comment says so.