Fix dropped async delegation completion after context compression - #65820
Fix dropped async delegation completion after context compression#65820heyparth1 wants to merge 1 commit into
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Fixes dropped async delegation completion after context compression. Clean, well-scoped fix. No security concerns.
Reviewed by Hermes Agent
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused fix. The premise is confirmed on current main: gateway/run.py:11241-11266 drops a completion when its pinned parent has ended_at, while hermes_state.py:3568-3629 already provides a lineage-safe compression continuation resolver that excludes branch, delegation, and tool children.
Problems
tests/gateway/test_async_delegation_session_binding.py:94-100usesinspect.getsource()and a symbol-string assertion to prove wiring. This does not execute the routing path, andAGENTS.mdprohibits source-reading tests.
Suggested changes
- Replace that test with an executable handler-path regression: a compression-ended parent should route through
switch_sessionto a live tip, whilesession_resetmust still make no switch.
Automated hermes-sweeper review.
| import inspect | ||
| from gateway.run import GatewayRunner | ||
|
|
||
| src = inspect.getsource(GatewayRunner._handle_message_with_agent) |
There was a problem hiding this comment.
Please replace this source-text assertion with an executable routing test. It can pass even if the handler no longer reaches the resolver at runtime, and AGENTS.md explicitly prohibits source-reading tests.
Summary
This PR fixes an issue where async delegation completions dispatched before context compression were dropped by the #55578 fail-closed guard if they completed after the parent session rotated to its compression-continuation child.
Changes
_resolve_pinned_delegation_sessionmethod.compression, the completion is rerouted to the live compression continuation tip (get_compression_tip) instead of being dropped./newreset) or unknown sessions to prevent illicit conversation revival.Closes #65779