fix(gateway): preserve delegation completion across compression - #65780
fix(gateway): preserve delegation completion across compression#65780allenkaplan wants to merge 2 commits into
Conversation
|
okay I asked my Hermes agent to investigate why we didn't realise a codex session completed. I guess 5.6-sol medium really wanted to be proactive in the fix and posted this without asking me 🤣 |
|
Thanks for the focused fix. The premise is confirmed on current
The multi-hop regression test is appropriate for the resolver contract, and the targeted production hunk remains unchanged on current main ( Automated hermes-sweeper review. |
Am I to understand correctly that there are no requested changes? If so, can this get reviewed for merge? |
|
Fixed via #69312 (merged), which salvaged #64530 as the base fix for this bug — the compression-tip resolver plus honest durable-ack semantics. Your root-cause diagnosis in #65779 was the best analysis in the cluster and is credited in the merged PR. The CAS route-advance approach from #64530 was preferred over switch_session() reuse (avoids end/reopen side effects), but your tip-liveness check informed the final shape. Thanks! |
Summary
Closes #65779.
Root cause
Async completion events remain pinned to the session that dispatched them. If context compression rotates that parent before the worker finishes, the #55578 dead-session guard drops the event without consulting the compression lineage. Adapter-level acceptance then marks the durable row delivered, so restart recovery cannot replay it.
Compression is not an explicit conversation boundary:
get_compression_tip()already provides the lineage-safe continuation used by session resume/topic healing. This patch follows only that chain and only when the tip is live.Security boundary
The patch does not revive sessions ended by
/new, reset, orphan reap, or any non-compression reason. If the compression tip is absent or ended, delivery still fails closed.Verification
scripts/run_tests.sh tests/gateway/test_async_delegation_session_binding.py tests/gateway/test_completion_delivery.py -q— 22 passedscripts/run_tests.sh tests/gateway/test_session_race_guard.py tests/gateway/test_telegram_topic_mode.py -q— 64 passedpython -m py_compile gateway/run.py tests/gateway/test_async_delegation_session_binding.pygit diff --check