fix(gateway): harden restart resume recovery - #30030
Conversation
387ec85 to
a7fa549
Compare
|
Rebased on current Local verification:
CI has been retriggered on |
|
Cherry-picked onto our v0.15.2-based fork (Discord gateway) together with #37669. The two compose cleanly — only a small benign overlap in |
e5069a6 to
a4e81bd
Compare
a4e81bd to
57598bf
Compare
42e581a to
a2bc864
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused recovery hardening. The reported behavior is still present on current main: gateway/run.py:6603-6606 schedules from marker freshness without examining completed transcript state, gateway/run.py:10288-10306 invokes the goal hook for any non-empty result, and gateway/run.py:10878-10886 drops restart metadata when topic binding switches sessions.
Problems
- The PR makes
_schedule_resume_pending_sessions()async but calls synchronousSessionStoreI/O directly atgateway/run.py:6720,:6736,:6760, and:6775in PR headc05ab12. Current main commit9d38a2309establishedAsyncSessionStoreas the gateway-loop boundary (gateway/session.py:969-983), so this needs a port rather than a direct cherry-pick.
Suggested changes
- Use the current async SessionStore facade for transcript loads and resume-marker clears, with an async-safe candidate snapshot.
- Add a call-site test for a non-empty failed/provider-error result to prove
_post_turn_goal_continuationis not invoked.
Automated hermes-sweeper review.
b27d3da to
8c9f0dd
Compare
8c9f0dd to
68b9c9c
Compare
|
Rebased onto current Preserved main's delivery-ledger redelivery path (
Local verification: python -m pytest -q -o 'addopts=' \
tests/gateway/test_restart_resume_pending.py \
tests/gateway/test_platform_reconnect.py \
tests/gateway/test_goal_verdict_send.py
# 149 passed |
Late findings follow-upPushed
Local verification: restart-resume / delivery-ledger / reconnect suites green. |
Final independent-review follow-upPushed
Local verification: 156 passed; ruff clean. |
735ba21 to
0b7a65b
Compare
|
Rebuilt the branch on current The resume scheduler now uses a public The refreshed version also preserves the remaining recovery behavior: Telegram topic binding/compression-tip resolution, latest-user reply anchors, completed-assistant-tail suppression, startup pre-claim, live shutdown anchors, and ledger-before-resume ordering after reconnect. Immutable verification: 102 tests passed across restart/resume/reconnect/delivery suites; Ruff, |
Summary
Refreshes restart-resume recovery for the current async session architecture.
SessionStore.list_resume_pending()snapshot and theAsyncSessionStorefacade; the gateway no longer takes the store lock or reads_entriesdirectly on the event loop.AsyncSessionStore.load_transcript().resume_pendingwithout a new model turn when the transcript already ends in a completed assistant response.Verification
Immutable current-main test archive:
py_compile, andgit diff --check: passedFixes #10163.
Related: #23314, #29713, #46963, #46997.