Apply CP HiCache page-floor policy before backup and insert

Backed CP HiCache tail splits were floored during match, but write preparation and radix insertion could still observe the raw sub-page prefix. That could skip one token during pre-forward reservation or call CpHiCacheNodeMetadata.split() with a non-page boundary. The shared helper now floors backed partial-tail prefixes before probe, match, and insert.

Constraint: CP HiCache uses page-granular physical ownership while radix keys may keep valid-tail lengths.

Rejected: Let probe and insert keep token-precise tail prefixes | it reintroduces half-page ownership through a different entry point.

Confidence: high

Scope-risk: moderate

Directive: Any CP radix path that can split or reserve against backed HiCache metadata must use the same page-floor policy.

Tested: Remote red tests first for probe and insert failures in g0034 container.

Tested: Remote py_compile for hiradix_cache.py and test_cp_hicache_metadata.py.

Tested: Remote targeted C7 tests: 4 passed, 3 warnings.

Tested: Remote pytest test_cp_hicache_metadata.py test_cp_hicache_load_back_owner_lanes.py: 94 passed, 5 warnings.

Not-tested: Live ETE traffic with concurrent divergent tail prompts.

Co-authored-by: OmX <omx@oh-my-codex.dev>
This commit is contained in:
laoyao0822
2026-05-29 07:10:53 +08:00
co-authored by OmX
parent 8001c4ae8e
commit 2b1524bd8c
3 changed files with 134 additions and 1 deletions
@@ -660,6 +660,11 @@ Implemented C7 split policy:
- If the floored boundary is zero, the match returns the parent/root node and
sacrifices the sub-page prefix. This avoids half-page owner accounting and
keeps host/device/draft metadata page-granular.
- The same floor policy is applied before forward-time write reservation and
final radix insertion. `_probe_existing_radix_prefix_len_no_split()` floors
backed partial-tail hits so backup reservation starts at the same page boundary
as `match_prefix()`, and `insert()` floors backed partial-tail splits before
calling `CpHiCacheNodeMetadata.split()`.
### C8. Owner-lane capacity must be padded-page based end to end