Repository navigation
Fix #1797: bug(hermes): _bridge_ok cache permanently disables provider after transient star - #2001
Merged
Merged
Conversation
The module-level _bridge_ok cache in daemon_manager.py had no expiry, so a single transient _node_available() failure during Hermes gateway startup (subprocess race, .env loaded after the first probe) permanently pinned MemTensorProvider.is_available() to False. MemOS stayed silently offline for the lifetime of the gateway even after the bridge daemon came up healthy. This change introduces a 60s TTL on the cached answer and adds a _probe_viewer() fallback: when _node_available() fails but a MemOS bridge is already alive on :18800, treat the environment as viable (the bridge itself was launched via Node). shutdown_bridge() now also clears the timestamp so a later re-init starts from a clean slate. Adds BridgeOkCacheTests covering cache hit, TTL expiry recovery, running- bridge fallback, shutdown reset, and full-call revalidation. 48/48 python tests pass. Closes #1797
Memtensor-AI
requested review from
CarltonXiang,
MatthewZhuang,
World-controller and
syzsunshine219
June 30, 2026 16:45
Collaborator
Author
✅ Automated Test Results: PASSEDNo applicable test scope for the changed files — automated tests skipped. Changed paths do not map to any configured scope (env.yaml source_mapping). Manual review recommended. Branch: |
Collaborator
Author
❌ Automated Test Results: FAILED
Failed tests:
Error detailsBranch: |
Collaborator
Author
|
Automated Test Results: PASSED Cloud test-engine rerun against
This replaces the earlier no-scope/failed signal for this PR. Manual code review is still required before merge. |
steven-stack-s
pushed a commit
to steven-stack-s/dsh-memos-local
that referenced
this pull request
Sep 18, 2026
…s provider after transient star (MemTensor#2001) fix(hermes): expire _bridge_ok cache so MemTensorProvider self-heals The module-level _bridge_ok cache in daemon_manager.py had no expiry, so a single transient _node_available() failure during Hermes gateway startup (subprocess race, .env loaded after the first probe) permanently pinned MemTensorProvider.is_available() to False. MemOS stayed silently offline for the lifetime of the gateway even after the bridge daemon came up healthy. This change introduces a 60s TTL on the cached answer and adds a _probe_viewer() fallback: when _node_available() fails but a MemOS bridge is already alive on :18800, treat the environment as viable (the bridge itself was launched via Node). shutdown_bridge() now also clears the timestamp so a later re-init starts from a clean slate. Adds BridgeOkCacheTests covering cache hit, TTL expiry recovery, running- bridge fallback, shutdown reset, and full-call revalidation. 48/48 python tests pass. Closes MemTensor#1797 Co-authored-by: MemOS AutoDev <autodev@memtensor.local>
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.
Description
Fixes #1797:
_bridge_okcache inapps/memos-local-plugin/adapters/hermes/memos_provider/daemon_manager.pyhad no expiry, so a single transient_node_available()failure during Hermes gateway startup permanently disabledMemTensorProvider. The cache now expires after 60 seconds, and_node_available()failures fall through to a_probe_viewer()check that accepts an already-running MemOS bridge on :18800 as proof the environment is viable.shutdown_bridge()also resets the new_bridge_ok_attimestamp.Added regression tests (
BridgeOkCacheTests, 6 cases) covering cold-start revalidation, cache-hit short-circuit within TTL, TTL-expiry recovery, running-bridge fallback, shutdown reset, and full-call (non-probe) revalidation. Full plugin python suite green: 48 passed (42 existing + 6 new). Ruff lint and format both clean. Branchbugfix/autodev-1797pushed toorigin; openspec artifacts archived tomemos-autodev-specs.Related Issue (Required): Fixes #1797
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Automated tests are pending.
Checklist
@MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller please review this PR.
Reviewer Checklist