You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Restores persisted messaging sessions when Desktop calls session.resume after the gateway has restarted or its in-memory live entry was reaped. The session history remains visible and attachable instead of returning not_found.
gateway/session_authority.py — falls back from an absent API binding to durable messaging-session recovery on a live-registry miss.
gateway/session_messaging_recovery.py — validates the persisted routing origin, materializes the route, and restores its transport-profile identity before attaching a viewer.
tests/gateway/test_session_messaging_recovery.py — covers a cold Feishu group session, persisted transcript hydration, and multiplex transport identity restoration.
How to Test
Run scripts/run_tests.sh tests/gateway/test_local_session_recovery.py tests/gateway/test_session_messaging_recovery.py — 5 passed, 1 platform-specific test skipped on macOS.
Run $HERMES_PYTHON -m ruff check gateway/session_authority.py gateway/session_messaging_recovery.py tests/gateway/test_session_messaging_recovery.py — passed.
Evidence
BEFORE RED: a registry miss first tried local-policy recovery, then API-binding recovery. A persisted Feishu session has neither record, so session.resume returned not_found even though its session row and messages remained stored.
AFTER GREEN: the new cold-session regression creates a persisted Feishu group session with no live authority entry; attach() restores its history and keeps the persisted multiplex transport owner. The focused test command passed 5 tests.
CONTROL: existing local cold-recovery coverage passed in the same command; local and API recovery remain their dedicated paths.
Checklist
Code
I've read the Contributing Guide.
My commit message follows Conventional Commits.
I searched for competing PRs before implementation.
This PR contains only the session-resume recovery fix.
I've run the relevant tests locally (see How to Test).
I've added regression coverage for the reported recovery path.
I've tested on macOS.
Documentation & Housekeeping
Documentation update: N/A; this changes an internal recovery path only.
cli-config.yaml.example: N/A.
CONTRIBUTING.md and AGENTS.md: N/A.
Cross-platform impact considered; the Python recovery path is platform-neutral, while one Linux-marked control test remains for CI.
Tool descriptions and schemas: N/A.
Completed two rounds of P0 review; the final review reported P0=0.
Thanks for this. Package 7 (#140138) fixes RT-30 in #140183 without this PR because it only works when the stored origin matches exactly, ignores the live routing entry, and doesn't check which profile owns the row. I'll close this once #140183 merges.
Thanks @teknium1. I checked all three points against the original implementation and the current head. The original path required an exact origin_json match; it checked the existing route for conflicts but did not prefer its source, and lacked an explicit owning-profile fence.
#140183 merged as b91f7ae and is already an ancestor of this PR’s current head, f2abe0f. Its gateway/session_route_recovery.py prefers the routing entry, falls back to the stored origin/row columns, and checks the route’s profile against the serving authority. The original helper is gone, and this PR now has zero changed files (its tree equals base b3c2883).
Self-review: no further code change is needed for this discussion; the upstream replacement covers these concerns. Verified by code inspection, commit ancestry and tree comparison. No tests were run in this follow-up; this head has no check runs or reported status contexts. Leaving closure to the maintainers.
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
area/sessionsSession lifecycle, resume, persistence, historycomp/desktopElectron desktop app (apps/desktop/*)comp/gatewayGateway runner, session dispatch, deliveryP2Medium — degraded but workaround existsplatform/feishuFeishu / Lark adaptersweeper:risk-session-stateSweeper risk: may lose/corrupt/mis-associate session or context statetype/bugSomething isn't working
3 participants
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?
Restores persisted messaging sessions when Desktop calls
session.resumeafter the gateway has restarted or its in-memory live entry was reaped. The session history remains visible and attachable instead of returningnot_found.Related Issue
Fixes #139796
Type of Change
Changes Made
gateway/session_authority.py— falls back from an absent API binding to durable messaging-session recovery on a live-registry miss.gateway/session_messaging_recovery.py— validates the persisted routing origin, materializes the route, and restores its transport-profile identity before attaching a viewer.tests/gateway/test_session_messaging_recovery.py— covers a cold Feishu group session, persisted transcript hydration, and multiplex transport identity restoration.How to Test
Run
scripts/run_tests.sh tests/gateway/test_local_session_recovery.py tests/gateway/test_session_messaging_recovery.py— 5 passed, 1 platform-specific test skipped on macOS.Run
$HERMES_PYTHON -m ruff check gateway/session_authority.py gateway/session_messaging_recovery.py tests/gateway/test_session_messaging_recovery.py— passed.Evidence
BEFORE RED: a registry miss first tried local-policy recovery, then API-binding recovery. A persisted Feishu session has neither record, so
session.resumereturnednot_foundeven though its session row and messages remained stored.AFTER GREEN: the new cold-session regression creates a persisted Feishu group session with no live authority entry;
attach()restores its history and keeps the persisted multiplex transport owner. The focused test command passed 5 tests.CONTROL: existing local cold-recovery coverage passed in the same command; local and API recovery remain their dedicated paths.
Checklist
Code
Documentation & Housekeeping
cli-config.yaml.example: N/A.CONTRIBUTING.mdandAGENTS.md: N/A.