fix(tests): repair stale test suite failures and a broken MCP import - #84
Merged
Conversation
Fixes a batch of pre-existing, unrelated test failures found while doing a general repair/cleanup pass: - tools/mcp_tool.py: `agent.secret_scope` doesn't exist anywhere in the repo, so every `_interpolate_env_vars()` call (i.e. every MCP config load) crashed with ImportError. Restore the documented os.environ fallback for when the module is unavailable. - acp_registry/agent.json: version was stale (0.14.0) vs pyproject.toml (0.15.0). - tests/hermes_cli/test_gateway.py, test_gateway_service.py: update mocks/assertions for legitimate features the tests hadn't caught up to yet -- the `non_interactive` systemd_install() param, the temp-HERMES_HOME service-write guard, the D-Bus reachability preflight check, the HERMES_HOME-anchored WorkingDirectory (replacing the old rot-prone source-checkout path), the launchd self-preservation PID lookup, and an `_HERMES_GATEWAY` env var leaking across tests via a module-level import side effect in gateway/run.py. - tests/test_hermes_state.py: get_messages_as_conversation() now includes a `timestamp` key by design; and the declarative _reconcile_columns() schema-sync pattern intentionally supersedes the old version-gated "don't auto-add columns" migration test. - tests/hermes_cli/test_setup.py: setup_gateway() now drives platform selection through an interactive checkbox picker (prompt_checklist) instead of per-platform prompt_yes_no calls. Also documents (.plans/missing-platform-plugin-shims.md, not fixed per explicit decision) that telegram/slack/matrix/whatsapp/email/sms/wecom/ feishu are missing from the `hermes setup gateway` picker -- their plugin-registration shims were never created after a refactor removed the old inline _PLATFORMS definitions, even though the underlying gateway/platforms/*.py adapters are all still present and functional.
🔎 Lint report:
|
- test_gateway_linger.py::test_systemd_install_calls_linger_helper: same temp-HERMES_HOME write guard gap already fixed for its sibling tests in test_gateway_service.py -- this one just wasn't caught in the first pass. - test_kanban_db.py::test_connect_falls_back_to_delete_on_locking_protocol: the kanban_home fixture's kb.init_db() already persists journal_mode=wal onto the DB file (a SQLite header property, not per-connection state), so apply_wal_with_fallback()'s read-only probe saw "wal" already set and returned early -- the mocked PRAGMA journal_mode=WAL failure this test exercises never actually ran. Delete the pre-existing db/-wal/-shm files so the mocked connect() creates a genuinely fresh one, and clear the (db_label -> already warned) dedup cache since it's keyed only on filename, not full path.
…e tests - hermes_state.py: the same "chore: sync working changes" commit that added the timestamp field to conversation messages also dropped "disk i/o error" from _WAL_INCOMPAT_MARKERS -- a real regression, not test staleness. Restored it so flaky-network-FS disk I/O errors during WAL setup still trigger the DELETE-mode fallback instead of propagating. - tests/acp/test_session.py: two more tests hit by the same get_messages_as_conversation() timestamp addition already handled in tests/test_hermes_state.py. - tests/hermes_cli/test_auth_commands.py: _format_exhausted_status() now unconditionally reads entry.extra (per-model exhaustion tracking), but the test's hand-rolled _Entry mock didn't define it. - tests/tools/test_mcp_tool.py: test_default_timeout asserted both the _DEFAULT_TOOL_TIMEOUT constant AND a stale hardcoded 120, left over from before the constant was bumped to 300. Also updates .plans/missing-platform-plugin-shims.md with two more casualties of the missing plugin shims found while triaging CI: tests/hermes_cli/test_setup_openclaw_migration.py (Telegram/WhatsApp missing from the config summary) and tests/gateway/test_setup_feishu.py (the interactive_setup function itself was removed, not just picker metadata -- all 14 tests fail on import).
dizhaky
marked this pull request as ready for review
July 17, 2026 10:38
dizhaky
added a commit
that referenced
this pull request
Jul 17, 2026
…restoration Main independently landed most of this branch's repairs while it was in flight (platform picker restore #89, bespoke setup dispatch #94, stale test repairs #84, agent.json bump). Resolution takes main's side everywhere; the only remaining delta is restoring _setup_feishu (deleted by the incomplete plugin-migration rewrite e39b468 — the plugins/platforms/feishu/ dir it supposedly moved to never existed) and its _builtin_setup_fn mapping. tests/gateway/test_setup_feishu.py is the last red file on main's CI (run 29596109244). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Repairs a batch of pre-existing, unrelated test failures found during a general "fix Hermes errors / find more things to clean up" pass, plus one real production bug.
Related Issue
Fixes #
Type of Change
Changes Made
tools/mcp_tool.py:_interpolate_env_vars()unconditionally importedagent.secret_scope, a module that doesn't exist anywhere in the repo — every call (i.e. every MCP config load) crashed withImportError. Restored the documentedos.environfallback for when the module is unavailable, matching the function's own docstring contract.acp_registry/agent.json: version was stale (0.14.0) vspyproject.toml(0.15.0);scripts/release.pyalready keeps these in lockstep on a proper version bump, this one drifted from a manual edit.tests/hermes_cli/test_gateway.py,test_gateway_service.py: updated mocks/assertions for legitimate recent features the tests hadn't caught up to — thenon_interactivesystemd_install()param, the temp-HERMES_HOMEservice-write guard, the D-Bus reachability preflight check, theHERMES_HOME-anchoredWorkingDirectory(replacing the old rot-prone source-checkout path — see_stable_service_working_dir()'s docstring), the launchd self-preservation PID lookup, and an_HERMES_GATEWAYenv var leaking across tests via a module-level import side effect ingateway/run.py.tests/test_hermes_state.py:get_messages_as_conversation()now includes atimestampkey by design; and the declarative_reconcile_columns()schema-sync pattern (Beets/sqlite-utils style) intentionally supersedes the old version-gated "don't auto-add columns" migration test — updated the test to assert the new, documented behavior instead.tests/hermes_cli/test_setup.py:setup_gateway()now drives platform selection through an interactive checkbox picker (prompt_checklist) instead of per-platformprompt_yes_nocalls.Also documents (
.plans/missing-platform-plugin-shims.md, not fixed — explicit decision, not in scope for this PR) that telegram/slack/matrix/whatsapp/email/sms/wecom/feishu are missing from thehermes setup gatewaypicker: their plugin-registration shims (plugins/platforms/<name>/adapter.py) were never created after a refactor removed the old inline_PLATFORMSdefinitions, even though the underlyinggateway/platforms/*.pyadapters are all still present and functional (so live message routing is unaffected — only the setup wizard's picker/status display for these 8 platforms).How to Test
TZ=UTC LANG=C.UTF-8 PYTHONHASHSEED=0 python3 -m pytest tests/hermes_cli/test_gateway.py tests/hermes_cli/test_mcp_config.py tests/hermes_cli/test_gateway_service.py tests/test_hermes_state.py tests/acp/test_registry_manifest.py tests/hermes_cli/test_setup.py -q— all pass (previously 37 failing across these files)ruff checkon all changed files — all checks passedChecklist
Code
fix(scope):)Documentation & Housekeeping
.plans/per repo convention (seeconfig-integrity-watchdog.mdfor precedent) rather than silently fixing or ignoring itGenerated by Claude Code