Fix #2096: [Bug] hermes adapter broken on main: MemosHttpClient is imported but not defined#2097
Conversation
…emTensor#2096) The hermes adapter's __init__.py imports MemosHttpClient from bridge_client, but the class was never committed — every plugin python test fails at collection and any real Hermes host loading memos_provider hits ImportError at module load. Reverting the four usages and the two HTTP-first branches in initialize/_reconnect_bridge restores the adapter to its pre-half-merge stdio-only behavior. A dedicated test_module_imports_cleanly regression test asserts the module surface (MemTensorProvider / MemosBridgeClient / BridgeError present, MemosHttpClient absent) so this class of import-level breakage cannot silently return. Fixes MemTensor#2096
🤖 Open Code ReviewTarget: PR #2097 🔍 OpenCodeReview found 2 issue(s) in this PR. 1.
|
Address two Open Code Review findings on the test_module_imports_cleanly regression test added in MemTensor#2097: * The positive hasattr assertions on memos_provider.MemosBridgeClient and memos_provider.BridgeError were locking in an implementation detail — those names only appear on the memos_provider namespace because __init__.py uses a bare 'from bridge_client import ...'. If __init__.py ever switched to 'import bridge_client', the test would fail even though the module is correct. Assert the real contract on bridge_client directly via importlib. * The docstring claimed a role the test body does not uniquely fill: since test_module_imports_cleanly is the first test in the suite, a collection-level ImportError would already prevent every test from running. Rewrite the docstring to spell out that the only unique guard the body provides is the negative assertion that MemosHttpClient is absent (plus a positive MemTensorProvider check for the class Hermes actually instantiates). Refs MemTensor#2096.
🤖 Open Code ReviewTarget: PR #2097 🔍 OpenCodeReview found 1 issue(s) in this PR. 1.
|
…e_client Round 2 OCR fix on PR MemTensor#2097. The prior negative guard only checked memos_provider — but memos_provider only sees MemosHttpClient through a bare 'from bridge_client import ...' in __init__.py. If the class were re-added to bridge_client without a matching re-export (e.g. an aliased import, or used internally), the assertion would still pass and the half-merged feature could silently re-enter the codebase. Add the complementary assertFalse(hasattr(bc, 'MemosHttpClient')) so the class cannot land in bridge_client at all until it is intentionally committed as a complete feature. Update the docstring to note the guard now covers both surfaces. Refs MemTensor#2096.
🤖 Open Code ReviewTarget: PR #2097 ✅ OpenCodeReview: No comments generated. Looks good to me. Generated by cloud-assistant via Open Code Review. |
|
Verified locally as the reporter of #2096:
The revert removes the phantom import together with every code path that referenced it ( One sequencing note for maintainers: #2095 touches the same two files ( |
Description
Fixes #2096. The hermes adapter at
apps/memos-local-plugin/adapters/hermes/memos_provider/__init__.pywas importingMemosHttpClientfrombridge_client, but the class was never committed — every plugin python test failed at collection withImportErrorand any real Hermes host loadingmemos_providerhit the same failure at module load. The offending references arrived via thepr/may27-fixesmerge (0398e0e) as a half-committed HTTP-bridge feature.Chose the "revert usages" option from the issue's two suggested fixes because writing a real
MemosHttpClient(subprocess lifecycle, keep-alive, viewer probe, host-handler reverse channel) is a feature commit not a bug hotfix, and a stub raisingNotImplementedErrorwould spam warning logs on every reconnect since_connect_http_bridgecatches all exceptions and falls back to stdio. Removed theMemosHttpClientimport, the type union onself._bridge, the_connect_http_bridgehelper, and the HTTP-first branches ininitializeand_reconnect_bridge. Also removed the now-unusedprobe_viewer_status/startup_lock_activeimports (their definitions indaemon_manager.pyare untouched for a future HTTP PR). Net diff: 31 additions / 54 deletions across the adapter plus the new regression test.Added
test_module_imports_cleanlytotests/python/test_hermes_provider_pipeline.pyassertingMemTensorProvider/MemosBridgeClient/BridgeErrorare on the module surface andMemosHttpClientis not — this way a future half-merge fails with a targeted message instead of a cascade of unrelated collection errors.Verification:
python3 -m unittest discover -s apps/memos-local-plugin/tests/pythonruns 78 tests, all OK (was: collection ImportError).ruff check+ruff format --checkclean on both modified files. opsp artifacts (task.md, proposal.md, spec.md, design.md, verification-report.md) archived tomemos-autodev-specsmain. Reviewers @whipser030 and @hijzy to be added by scheduler.Related Issue (Required): Fixes #2096
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Automated tests are pending.
Checklist
@whipser030, @hijzy please review this PR.
Reviewer Checklist