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
Reviewed as part of the rotation-seam map on #80337: this is the boundary version of the fix — resolve_resume_session_id is the canonical resolver for resume semantics, and restoring agent + history + SessionState under the resolved storage id (rather than patching one lookup) closes the whole member. The heartbeat sibling of this class is the #80225/#80208 pair; the recovery member merged as #80487.
Summary:
Restoring a compressed ACP session resolves the storage id into SessionState.session_id while the in-memory map stays keyed by the caller's id, so the session listing emits the continuation id twice and the one lookup documented as in-memory-only misses the restored state.
Problems:
_restore (acp_adapter/session.py) keeps self._sessions[session_id] = state under the caller's id while SessionState is built with session_id=storage_session_id — the state's own id is not a key in the map.
SessionManager.list_sessions emits s.session_id and skips persisted rows only when their id is an in-memory map key (seen_ids = set(self._sessions.keys())); the compression continuation row carries source=agent.platform ("acp"), so for a restored session the continuation id is listed twice — once from the in-memory state, once from the list_sessions_rich(source="acp") merge.
_schedule_mcp_late_refresh (acp_adapter/server.py) reads self.session_manager._sessions.get(state.session_id) as an in-memory-only lookup; for a restored session that key is the continuation id, which is not in the map, so the pre-first-turn tool refresh no-ops.
Solution:
Register the resolved id as an alias in the map alongside the caller's id (self._sessions[storage_session_id] = state), and dedupe list_sessions on s.session_id; get_session(caller_id) keeps working and state.session_id-keyed lookups hit the same state.
Checked against 17e701c — the tip of fix/acp-compression-resume when this was written — and b3aa561, main at the same moment.
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/compressionContext compression and continuation sessionscomp/acpAgent Communication Protocol adapterP4Best-effort: we will get to it when we get to it (no commitment)sweeper:risk-session-stateSweeper risk: may lose/corrupt/mis-associate session or context statetype/bugSomething isn't working
4 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.
Summary
Test plan
scripts/run_tests.sh tests/acp/test_session.py tests/hermes_state/test_resolve_resume_session_id.py.venv/bin/ruff check acp_adapter/session.py tests/acp/test_session.pygit diff --checkThis prevents resumed ACP tasks from attempting to persist to a compression-ended parent session.