From 0217a901ddbae2bc95156120bb541d318843493c Mon Sep 17 00:00:00 2001 From: krypticmouse Date: Wed, 20 May 2026 03:37:09 +0000 Subject: [PATCH] test(energy_wiring): opt out of #294 default-agent fallback in _energy_config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up on @TX-Huang's PR #294. The default-agent fallback now routes `jarvis ask "..."` (no --agent) through `config.agent.default_agent`, which dataclass-defaults to `"simple"`. The autouse `_clean_registries` fixture in tests/conftest.py clears AgentRegistry between tests, so the fallback then fails with `Unknown agent: simple` and every CLI-driven test_energy_wiring test exits with code 1. These tests exercise engine-level instrumentation, not agent dispatch — ``test_engine_wrapped_with_instrumented``, the energy-monitor lifecycle tests, and the end-to-end pipeline tests all care that the engine gets wrapped and telemetry lands in SQLite, regardless of whether the call goes through an agent. Set ``cfg.agent.default_agent = ""`` in ``_energy_config`` to keep these tests on the direct-engine path they were originally designed for. The dedicated ``test_agent_mode_uses_instrumented_engine`` (which explicitly passes ``--agent``) is unaffected. Same pattern PR #294 already uses in tests/cli/test_ask_router.py for the two MagicMock-config tests. Co-Authored-By: Claude Opus 4.7 (1M context) --- tests/telemetry/test_energy_wiring.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/telemetry/test_energy_wiring.py b/tests/telemetry/test_energy_wiring.py index 399b717d..06ec1cb6 100644 --- a/tests/telemetry/test_energy_wiring.py +++ b/tests/telemetry/test_energy_wiring.py @@ -88,6 +88,11 @@ def _energy_config(tmp_path, gpu_metrics=True): cfg.telemetry.gpu_metrics = gpu_metrics cfg.telemetry.energy_vendor = "" cfg.telemetry.db_path = str(tmp_path / "telemetry.db") + # These tests exercise engine-level instrumentation, not agent dispatch. + # `jarvis ask` (no --agent) now falls back to ``agent.default_agent`` + # which defaults to "simple", and conftest clears the registry per test. + # Opt out explicitly so the CLI uses direct-engine mode here. + cfg.agent.default_agent = "" return cfg