investigate(cache): compression-rotation cache-scope gap -- needs maintainer design decision - #10
Closed
JoaoMarcos44 wants to merge 1 commit into
Conversation
…arch#79017) Not a fix -- a demonstration for maintainer review. See NousResearch#79017 for the design discussion on why this needs a logical cache-scope concept distinct from the physical session_id, not a one-line patch.
This was referenced Aug 5, 2026
JoaoMarcos44
marked this pull request as ready for review
August 5, 2026 01:57
Owner
Author
|
Superseded by NousResearch#79036 -- recreated standalone/self-contained so it doesn't drag in NousResearch#78959's unmerged diff. Closing. |
JoaoMarcos44
deleted the
investigate/79017-compression-rotation-cache-scope
branch
August 5, 2026 02:24
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Not a fix -- a reproduction for NousResearch/hermes-agent#79017, opened for maintainer input on whether/how to pursue it. Stacked on NousResearch/hermes-agent#78959 (the scope only makes sense once that lands).
_cache_scope_from_session_id()(NousResearch#78959, closing NousResearch#78941) scopesprompt_cache_keyby the physicalsession_id. Correct for isolating unrelated sessions and for cron re-fires of the same job. But context-compression rotation mints a new physicalsession_idmid-conversation to segment the transcript, so the same logical conversation goes cache-cold at every rotation boundary.What this PR adds
One
xfail(strict=True)test (tests/agent/transports/test_codex_cache_scope_compression_rotation_gap.py) that fails loudly if the behavior is ever silently "fixed" without anyone noticing, and documents the gap in runnable form instead of prose alone.Why no fix is proposed here
A real fix needs a new concept -- a logical cache-scope (conversation identity) distinct from both the physical session id and provider sticky-routing keys:
/new, branch, compression rotation/new, branch, independent subagent -- not rotationsession_id, xAIx-grok-conv-id)Threading that scope through the compression/rotation/branch code paths (and NOT reusing
gateway_session_keyor a generic conversation-root walk, both of which outlive/newor cross branch boundaries incorrectly) is a design task, not a diff this PR wants to force through unreviewed.Ask
Maintainer call on:
%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#8b0000', 'mainBkg': '#0a0204', 'primaryTextColor': '#ffccd5', 'primaryBorderColor': '#ff0038', 'lineColor': '#ff0038'}}}%% graph TD A[Conversation Turn 1<br/>session-root] -->|Compression Threshold Hit| B[Rotation Event] B --> C[Conversation Turn 2<br/>session-rotated] A -->|scope = session-root| D[Cache Bucket: pck_root_hash] C -->|scope = session-rotated| E[Cache Bucket: pck_rotated_hash] D -. Same Logical Conversation .-> E D -->|Rotation Boundary| F[Cold Cache: Warm Prefix Lost] E --> F style F fill:#8b0000,stroke:#ff0038,color:#ffccd5 style D fill:#3a0000,stroke:#ff0038,color:#ffccd5 style E fill:#3a0000,stroke:#ff0038,color:#ffccd5Test plan
pytest tests/agent/transports/test_codex_cache_scope_compression_rotation_gap.py -v-> 1 xfailed (expected; strict, will error if it starts passing without a matching design)Discussion for NousResearch#79017 (design decision, not code fix).