investigate(cache): compression-rotation cache-scope gap -- needs maintainer design decision - #79036
JoaoMarcos44 wants to merge 1 commit into
Conversation
…cope gap Not a fix -- a self-contained demonstration for NousResearch#79017, reviewable directly on main with zero dependency on NousResearch#78959's merge state.
|
Thanks for the thorough follow-through on the #78941 → #78959 → #79017 chain — the design write-up here (physical vs logical identity vs provider sticky-routing) is genuinely useful. Closing this one, though, for three reasons:
One substantive note carried over to #79017: Appreciate the care in making this reviewable standalone — the analysis lives on in #79017 even though the test artifact doesn't. |
Summary
Relates to #79017. Not a fix -- a standalone, self-contained reproduction for maintainer input on whether/how to pursue it. One file, no dependency on #78959's merge state (that PR introduces the actual scoping code this test is about; this file inlines a minimal reference copy purely so it's reviewable on
maintoday)._cache_scope_from_session_id()(proposed in #78959, closing #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/design/test_cache_scope_compression_rotation_gap.py) that documents the gap in runnable form and fails loudly if anyone tries to close it without a matching design.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/design/test_cache_scope_compression_rotation_gap.py -v-> 1 xfailed (expected; strict, will error if it starts passing without a matching design)mainas-isRelates to #79017 (design decision, not code fix).