Skip to content

fix(tests): remove silent skips in test_sdk.py (#877 Part A) - #1190

Merged
itomek merged 2 commits into
mainfrom
fix/issue-877-part-a-test-sdk-silent-skips
May 21, 2026
Merged

itomek merged 2 commits into
mainfrom
fix/issue-877-part-a-test-sdk-silent-skips

Conversation

@itomek

@itomek itomek commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Before: four Test* classes in tests/test_sdk.py silently skipped on every CI run due to wrong import paths and stale xfails — TestToolMixins, TestSDKDocumentation, TestRoutingAgent, and TestFileChangeHandler were asserting nothing. After: all four produce real signal; TestPluginRegistry (which xfailed against a module that never existed) is deleted.

Test plan

  • pytest --collect-only -q tests/test_sdk.py → item count drops by exactly 2 vs baseline (TestPluginRegistry deletion + TestRoutingAgent rewrite from 2 methods to 1)
  • pytest tests/test_sdk.py::TestToolMixins::test_file_search_mixin_exists -v → PASSED
  • pytest tests/test_sdk.py::TestRoutingAgent::test_routing_agent_exposes_process_query -v → PASSED
  • pytest tests/test_sdk.py::TestFileChangeHandler -v → PASSED (not XPASSED)
  • grep "TestPluginRegistry" tests/test_sdk.py → no output
  • python util/lint.py --all → clean

Part of #877. Part A only — B (jira conversion), C (conftest hygiene), D (xdist + reruns) tracked separately.

Four test classes in tests/test_sdk.py silently skipped or stale-xfailed
against modules at wrong paths, hiding real production code from CI. Now
they execute and produce real signal.

- TestToolMixins::test_file_search_mixin_exists (line 639): wrong path
  gaia.agents.tools.file_search -> gaia.agents.tools.file_tools (the
  canonical path per src/gaia/agents/registry.py KNOWN_TOOLS).
- TestSDKDocumentation::test_all_imports_in_sdk_are_valid (line 893):
  same wrong path, fixed alongside.
- TestRoutingAgent: imported from non-existent gaia.agents.routing.routing_agent
  and asserted three methods that don't exist (register_agent, route_query,
  list_available_agents). Rewritten as a single smoke test importing from
  gaia.agents.routing.agent and asserting hasattr(RoutingAgent, "process_query")
  -- the only public dispatch method. Comprehensive behavioral coverage
  lives in #880.
- TestPluginRegistry: xfailed against gaia.plugins.registry which has never
  existed in this repo. Deleted entirely.
- TestFileChangeHandler: @pytest.mark.xfail decorator was stale --
  FileChangeHandler exists at src/gaia/utils/file_watcher.py. Removed.

Verification:
- pytest collection: 110 -> 108 items (-1 from TestPluginRegistry deletion,
  -1 from TestRoutingAgent 2->1 method rewrite).
- pytest run delta: -2 failed, +3 passed, -1 skipped, -1 xfailed, -1 xpassed.
- No regressions on the 105+ other tests in the file.

Scope: Part A of #877 only. Parts B (jira), C (conftest hygiene),
D (xdist + reruns) tracked separately. The file has 6+ additional
try/except ImportError: pytest.skip patterns at lines 1300, 1402, 1416,
1430, 1505, 1517 that are pre-existing tech debt out of scope here --
candidate for a follow-up "Part A-extended" issue.

Refs #877
@itomek itomek self-assigned this May 21, 2026
@itomek
itomek marked this pull request as ready for review May 21, 2026 14:43
@itomek
itomek requested a review from kovtcharov-amd as a code owner May 21, 2026 14:43
@itomek
itomek enabled auto-merge May 21, 2026 14:43
@github-actions github-actions Bot added the tests Test changes label May 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Clean, surgical fix — all four previously-silent test classes now produce real signal, and the one that guarded against a module that never existed (TestPluginRegistry) is properly deleted. The diff is narrow (10 additions, 39 deletions) and every changed import path checks out against the actual source tree.

Issues Found

None blocking.

🟢 Minor — test_file_change_handler_will_exist name is now slightly stale (tests/test_sdk.py:1168)

The method was named …_will_exist (future-tense, matching its original xfail intent). Now that the xfail is gone and the class is live, the name implies the feature is still pending. Renaming to test_file_change_handler_exists keeps the test name honest.

    def test_file_change_handler_exists(self):

🟢 Minor — TestRoutingAgent docstring says "Behavioural tests are #880's scope" (tests/test_sdk.py:1256)

Issue references in inline comments rot. Prefer a forward-pointer comment only if the issue number is tracked somewhere durable (e.g. a # TODO(#880): on the assertion line). As a class docstring with no actionable hook, it will confuse future readers who don't have that context.

    """Smoke coverage for RoutingAgent — behavioural routing tests live in a dedicated suite."""

Strengths

  • Import fixes are verified against the real module layout (gaia.agents.tools.file_tools, gaia.agents.routing.agent, gaia.utils.file_watcher) — no guesswork, no silent fallback paths.
  • Replacing the two-branch try/except ImportError → pytest.skip guard in TestRoutingAgent with a direct import is exactly right: if the module path ever breaks again, the test will fail loudly instead of silently passing.
  • TestPluginRegistry deletion is the correct call — removing a test that xfailed against a non-existent module is strictly better than leaving the xfail expectation open indefinitely.

Verdict

Approve — the two nits above are cosmetic and safe to address in a follow-up. The substantive goal (no more silent skips) is achieved cleanly.

@itomek

itomek commented May 21, 2026

Copy link
Copy Markdown
Collaborator Author

Both nits addressed in the follow-up commit (0c481bd):

  • test_file_change_handler_will_exist → test_file_change_handler_exists
  • TestRoutingAgent docstring updated to drop the issue reference

@github-actions

Copy link
Copy Markdown
Contributor

All four fixes are correct — the import paths, the new test names, and the xfail removals all match the actual codebase. This is a clean, focused cleanup with no noise.

Summary

Four test classes in tests/test_sdk.py were silently asserting nothing due to stale import paths and speculative xfail markers; this PR makes them produce real signal. Every changed import, class path, and method reference was verified against the live source tree. TestPluginRegistry is correctly deleted — gaia.plugins.registry does not exist and never shipped.

Issues Found

None.

Strengths

  • Verified against reality, not assumptions. The two import-path fixes (file_search → file_tools, routing.routing_agent → routing.agent) and the process_query method assertion all match the live source; nothing was guessed.
  • TestPluginRegistry deletion is the right call. The module it referenced (gaia.plugins.registry) does not exist in the source tree; keeping an xfail test for a module that never shipped is pure noise, and removing it makes the test suite's signal-to-noise ratio better.
  • TestRoutingAgent rewrite is correctly scoped. The new test avoids instantiating RoutingAgent (which would construct a LemonadeClient and fail in CI) while still asserting the public interface (process_query) is present — exactly the right tradeoff for a smoke test.
  • Docstring cleanup on TestFileChangeHandler drops the stale "(when implemented)" hedge; the updated class docstring and method name now describe what the test actually does.

Verdict

Approve. No blocking issues. The PR does exactly what it says — removes silent skips, fixes stale imports, and deletes a test for code that does not exist — and the test plan verification steps in the PR description are all independently checkable. Ready to merge.

@itomek
itomek added this pull request to the merge queue May 21, 2026
Merged via the queue into main with commit 70d75b7 May 21, 2026
24 checks passed
@itomek
itomek deleted the fix/issue-877-part-a-test-sdk-silent-skips branch May 21, 2026 16:41
@itomek itomek mentioned this pull request May 21, 2026
5 of 6 tasks
antmikinka pushed a commit to antmikinka/gaia that referenced this pull request May 21, 2026
# GAIA v0.19.0 Release Notes

GAIA v0.19.0 tightens the agent loop against silent-failure regressions
and continues the focused-agent split. A new `gaia eval agent`
reliability harness exercises tool selection end-to-end against the
local Agent UI MCP backend and surfaced four agent-loop bugs that
previously produced silently-wrong "Task completed" answers — all four
are fixed in this release. Dedicated `BrowserAgent` and `AnalystAgent`
replace the ChatAgent-backed web and data profiles. Agents can now
declare a `REQUIRED_HARDWARE` capability tier that is validated at
startup against the running Lemonade server. GAIA can connect to a
remote Lemonade Server protected by an API key. And a new CI job
auto-implements PRs for bulletproof bug issues in parallel with the
existing triage path.

**Why upgrade:**
- **MCP tool-calling reliability framework + four framework fixes** —
`gaia eval agent` runs a user-simulator + judge against the local MCP
backend; the harness uncovered and fixed silent loop-break lies, a
~85-token JSON-envelope leak in tool-calling-model prompts, a missed
native-path failure check, and an over-broad eval rubric.
- **Specialized agents** — `BrowserAgent` and `AnalystAgent` ship as
dedicated implementations behind the `gaia browse` and `gaia analyze`
CLIs, replacing the monolithic ChatAgent-backed profiles.
- **Hardware-requirement validation** — agents can declare
`REQUIRED_HARDWARE` and fail fast at startup when the host's device tier
(CPU/iGPU/dGPU/NPU/hybrid) does not satisfy it, instead of silently
degrading.
- **Remote Lemonade auth** — setting `LEMONADE_API_KEY` threads
`Authorization: Bearer <key>` through every Lemonade-bound HTTP path;
wrong/missing key surfaces an actionable error naming the variable.
- **CI auto-fix for bulletproof bug issues** — bug-labelled issues that
meet the "1-2 files, < 50 lines, 100% confidence" bar now get an
auto-implemented PR in parallel with the standard triage comment.


## What's New

### MCP Tool-Calling Reliability Framework

A new end-to-end eval harness lands at `src/gaia/eval/runner.py` (PR
[amd#718](amd#718)) and is invoked via `gaia
eval agent`. The runner spawns a subprocess that acts as user-simulator
+ LLM judge against the live Agent UI MCP backend, exercises 10 generic
scenarios (no-param, single-param, multi-step, conditional,
error-handling, "no tool needed"), and produces per-tool failure rollups
via `analyze_failures.py`. The judge rubric in `judge_turn.md` grades on
tool selection alone for `verbatim`-tagged scenarios — it explicitly
does not penalize the agent for underlying-service failures, which had
been conflating pipeline correctness with hardware availability.

Running the harness against the agent loop immediately exposed four
framework regressions, all fixed in this release:

- **Silent loop-break lie.** When small local models emitted just the
server prefix (`mcp_foo_mcp`) instead of the full registered tool name,
the agent retried four times and then hard-coded `"Task completed with
mcp_foo_mcp. No further action needed"` as the final answer despite zero
successful tool calls. Server-name sanitisation now strips redundant
`mcp` tokens before namespacing, and a new
`Agent._build_loop_break_summary` helper branches on whether the last
result was an error so the user sees the actual error wording. A new AST
guard in `tests/unit/agents/test_agent_source_invariants.py` prevents
the lie-on-loop literal from reappearing.
- **JSON envelope leak in tool-calling-model prompts.** The `{"tool":
..., "tool_args": ...}` template was supposed to be suppressed for
models that support native `tools=[]` calling, but `self.model_id` was
assigned *after* `_register_tools()` ran, so the suppression check
always returned False and ~85 redundant tokens shipped in every prompt.
Moving the `model_id = model_id` assignment ahead of registration closes
the gap; a regression test asserts the `==== RESPONSE FORMAT ====` block
does not appear in a tool-calling agent's system prompt.
- **Loop-break helper missed the native path.** The shared helper looked
at `step_results[-1]` to detect a failure streak, but the
native-tool-call path appends to `previous_outputs` instead (wrapper
dicts). On native callers the helper saw an empty list, missed every
failure, and returned `"Task completed"`. The fix unwraps
`previous_outputs` at the call site; the regression test exercises the
helper with a sequence of error results.
- **Eval rubric conflated pipeline and hardware.** Some MCP services
wrap real operation failures in a `status: success` envelope with the
failure buried in `data.content[*].text`. On dev hardware where
vendor-side features don't all work, the judge graded the agent as
failing even when it picked the right tool. The new STEP 0 in
`judge_turn.md` overrides the rubric for `verbatim`-tagged scenarios —
`correctness = 10` if the right tool was invoked, `0` if the wrong tool
was, regardless of underlying op success.

Eight new unit-test files cover the sanitiser matrix, loop-break helper,
candidate-list invariant, scenario validation, and `--iterations` flag.


### Dedicated Browser and Analyst Agents

The Agent UI's web and data entries previously routed to `ChatAgent`
profiles, which meant they carried the full monolithic agent surface
instead of the focused tool sets the use cases actually need. PR
[amd#1070](amd#1070) adds dedicated
`BrowserAgent` and `AnalystAgent` implementations and wires the built-in
web/data registrations (plus their `lite` variants) to them. Two new CLI
subcommands ship alongside: `gaia browse` for the browser flow and `gaia
analyze` for the analyst flow. Both compose the relevant tool mixins
explicitly rather than inheriting everything from the ChatAgent shim.


### Hardware-Requirement Validation for Agents

Agents can now declare a hardware capability tier via `REQUIRED_HARDWARE
= HardwareRequirement(min_device=...)` (PR
[amd#1057](amd#1057)). At agent startup,
`LemonadeManager.ensure_ready(required_min_device=...)` queries the
running Lemonade server through `LemonadeClient.get_system_info()` and
raises `HardwareRequirementError` if the host's reported device tier
does not satisfy the declaration. NPU-only or dGPU-only agents fail fast
at construction time instead of silently degrading at first inference.

This is Phase 1 — validation only. The resolved `recipe` is computed and
logged for debugging but is *not* applied to the Lemonade server startup
path; a follow-up will wire the resolved recipe through if the project
chooses to.


### `LEMONADE_API_KEY` for Authenticated Remote Lemonade

Before this release, GAIA could not connect to a remote Lemonade Server
protected by an API key — every request returned `401` regardless of the
user's configuration. PR [amd#1149](amd#1149)
(closes [amd#1139](amd#1139)) threads
`LEMONADE_API_KEY` (from `.env` or the shell environment) as
`Authorization: Bearer <key>` through every Lemonade-bound HTTP path in
GAIA: the central `LemonadeClient._send_request`, the four
`requests`-bypass sites, both OpenAI-SDK constructor sites,
`LemonadeProvider`, `VLMClient`, the Agent UI router (`system.py`),
Agent UI chat helpers, the server startup probes, and the base `Agent`
health probe.

Behaviour is fully additive — when the env var is unset, every call path
behaves identically to v0.18.1. A wrong or missing key produces a
fixed-string error naming `LEMONADE_API_KEY` (the response body is
intentionally not echoed back, to avoid leaking reflected
`Authorization` headers from misconfigured proxies).


### CI Auto-Fix for Bulletproof Bug Issues

PR [amd#1159](amd#1159) adds a Claude-powered
auto-fix job to `.github/workflows/claude.yml` that runs in parallel
with the existing `issue-handler` triage. When a new issue lands with
the `bug` label, Claude reads the report, and if the fix passes a strict
"bulletproof" bar — 1–2 files touched, fewer than 50 lines changed, 100%
confidence, no hardware-dependent verification needed — it implements
the change, validates with `python util/lint.py` and the relevant unit
tests, opens a PR, and posts the PR link plus step-by-step verification
instructions back on the originating issue. Bug reports that don't meet
the bar still get the standard triage comment from `issue-handler`; the
auto-fixer exits silently for the rest.


## Bug Fixes

- **BrowserAgent and AnalystAgent crashed instantly in the Agent UI**
(PR [amd#1202](amd#1202)) — Selecting either
of the new split agents and sending any message raised `AttributeError:
'<Agent>' object has no attribute '_mcp_manager'`. The MCP client
mixin's optional attribute was never initialised on the split agents,
and `get_mcp_status_report()` — invoked on every `/api/chat/send` — hit
the undefined dereference. The two-layer fix adds a class-level
`_mcp_manager: Optional[MCPClientManager] = None` on `MCPClientMixin`
(covering every future agent that inherits it) plus explicit per-agent
initialisation in the five affected agents (documenting intent at the
point of use). CLI paths were unaffected — only the Agent UI's
`/api/chat/send` triggered the bug.
- **`LEMONADE_BASE_URL` env var normalisation** (PR
[amd#1160](amd#1160)) — Setting
`LEMONADE_BASE_URL` to a value without the trailing `/api/v1` suffix
produced 404s deep in the request pipeline. The variable is now
normalised on load so both `http://host:8000` and
`http://host:8000/api/v1` resolve to the same canonical form.
- **Custom agents on disk now visible to the Agent UI** (PR
[amd#1138](amd#1138)) — `~/.gaia/agents/`
registrations were not surfacing to the Agent UI's agent list because
the registry discovery pass skipped the disk source on cold start. The
fix lists custom-directory agents alongside the built-ins on every
request.
- **`pr-review` CI re-enabled and credit-resilient** (PR
[amd#1163](amd#1163)) — The Claude-based
`pr-review` job had been disabled after an Anthropic credit window; all
Claude-backed jobs now treat 429 quota errors as non-fatal warnings so
CI keeps moving when the project hits its quota.
- **Silent skips in `test_sdk.py` removed** (PR
[amd#1190](amd#1190)) — Tests that depended on
an environment fixture were silently `pytest.skip()`-ing instead of
being explicitly conditional. The skips are now gated on the actual
fixture and surface as `XFAIL` when intentionally inapplicable. Closes
the first slice of [amd#877](amd#877).
- **`refresh-context7` fails loudly on unexpected status** (PR
[amd#1073](amd#1073)) — The terminal job of
the publish workflow previously masked non-cooldown HTTP responses as
"OK". It now distinguishes the known HTTP 400 cooldown window from any
other status code, so a regression that breaks the Context7 refresh is
no longer indistinguishable from the documented cooldown.


## Tooling & Docs

- **CLI smoke-test for every subcommand and console script** (PR
[amd#1193](amd#1193)) — Every `gaia
<subcommand>` and every console script declared in `setup.py` is now
exercised with `--help` in CI, catching import-time regressions and
shadowed entry points before they ship.
- **Fail-path coverage for `GovernedAgentMixin` and `CheckpointBridge`**
(PR [amd#1161](amd#1161)) — Adds unit tests
for the error/abort branches of the governance layer that were
previously only exercised on the happy path.
- **Custom-agent MCP harness for installer testing** (PR
[amd#1069](amd#1069)) — A reproducible
installer-level MCP harness for custom agents, so installer-affecting
changes are tested against the real agent-registration path rather than
mocks.
- **Dependabot revived, agent-ui entry added, patch auto-merge shipped**
(PR [amd#1191](amd#1191)) — Dependabot PRs are
flowing again, the Agent UI npm workspace is now covered, and patch-bump
PRs that pass CI auto-merge.


## Full Changelog

**17 commits** since v0.18.1:

- `6c6e4c34` — fix(agents): unbreak BrowserAgent/AnalystAgent in Agent
UI (amd#1202)
- `6379e183` — feat(agent-hub): discover installed agent entry points
(amd#1187)
- `a79acc88` — test(cli): smoke-test every subcommand and console script
with --help (amd#1193)
- `f7a75902` — ci(dependabot): revive PRs, add agent-ui entry, ship
patch auto-merge (amd#1191)
- `70d75b70` — fix(tests): remove silent skips in test_sdk.py (amd#877 Part
A) (amd#1190)
- `f8b2c1ab` — feat: MCP tool calling reliability test framework (amd#718)
- `f4270687` — feat(agent-hub): Agent Hub UI + platform plan + hub
skeleton (amd#1103)
- `6ef1feee` — fix(llm): normalize LEMONADE_BASE_URL env var to include
/api/v1 suffix (amd#1160)
- `72b77167` — fix(ci): re-enable pr-review and make all Claude jobs
credit-resilient (amd#1163)
- `b46bf654` — fix(agent-ui): list custom agents from disk (amd#1138)
- `63aedb47` — test: add fail-path coverage for GovernedAgentMixin and
CheckpointBridge (amd#1161)
- `7b8f22c0` — feat(llm): support LEMONADE_API_KEY for authenticated
remote Lemonade (amd#1149)
- `b22fa73d` — feat(ci): auto-fix job for bulletproof bug issues (amd#1159)
- `6b7b9e7d` — fix(ci): make refresh-context7 fail loudly on unexpected
status (amd#1073)
- `e2d4e2d7` — feat(sdk): hardware requirement validation for agents
(amd#1057)
- `1a73dcc5` — feat(agents): add browser and analyst agents (amd#1070)
- `2554424b` — test(installer): add custom agent MCP harness (amd#1069)

Full Changelog:
[v0.18.1...v0.19.0](amd/gaia@v0.18.1...v0.19.0)

## Release checklist

- [x] `util/validate_release_notes.py docs/releases/v0.19.0.mdx` passes
- [x] `src/gaia/version.py` → `0.19.0`
- [x] `src/gaia/apps/webui/package.json` → `0.19.0`
- [x] Navbar label in `docs/docs.json` → `v0.19.0 · Lemonade 10.2.0`
- [x] All 17 commits in range (v0.18.1..HEAD) are represented in the
notes
- [ ] Review from @kovtcharov-amd addressed
pull Bot pushed a commit to bhardwajRahul/gaia that referenced this pull request May 29, 2026
…ps, add shared fixture (amd#1241)

`pytest --collect-only tests/test_jira.py` was reporting 0 items because
the file is a standalone argparse smoke-test script (real Jira API
calls, own CLI flags, bool-returning methods) — not a pytest suite.
Meanwhile, `pytest-xdist` and `pytest-rerunfailures` were missing from
dev deps, and every test file that needed a `LemonadeClient` mock was
duplicating the same patch target.

Closes amd#877 Parts B, C, D (Part A shipped in amd#1190).

## Test plan

- [ ] `pytest --collect-only tests/test_jira.py` → "file or directory
not found" (no longer in tests/)
- [ ] `python scripts/jira_smoke.py --help` still works (file moved, not
deleted)
- [ ] `grep -E "pytest-xdist|pytest-rerunfailures" setup.py` shows both
deps
- [ ] `grep mock_lemonade_client tests/conftest.py` shows the shared
fixture
- [ ] `pytest --collect-only tests/conftest.py` parses without errors

---------

Co-authored-by: Ovtcharov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants