Pull requests / #2098

#2098 disk park: the profile tag carries the engine version, and the blob carries the tag

open · @leocoic · 0 comentarios · En GitHub

Server & APIModels & quants

Descripción

## Title
disk park: the profile tag carries the engine version, and the blob carries the tag

## Summary
The parked tier had no idea which engine wrote it. `DiskParkProfile::tag()` hashed model / kv format / context / rope only, so 62 GB of pages stored by 0.1.41 are read back verbatim by 0.1.43 — after any version that changes numerics, that is recurrent state computed by the previous routing. The blob layer was worse: `checkpoints.bin` carries no tag at all and is one file shared by every tag directory.

Both layers now carry the version. This branch also lands the disk park tier itself (a disk tier under the parked-conversation cache) and the fixes found while building it.

## What changed
- `disk_park_digest.hpp/.cpp/_test.cpp` — `describe()` now includes `STRATA_VERSION` (and `STRATA_DISK_PARK_KEY` for a manual key); the field table goes `v1` → `v2`, so a version bump opens a new `tag-XXXXXXXX/` directory instead of reusing the old one.
- `disk_park_blob.hpp/.cpp/_test.cpp` — magic `SKB1` → `SKB2`. The profile tag is written into the file header at `@8` (those 4 bytes were reserved padding, so the 16-byte header and 32-byte entry header keep their exact layout — no record moves) and into every entry header at `@+4` (which used to hold a `version` field nothing read back). On a tag mismatch the layer is neither read nor appended to, the old file is moved with a single rename to `checkpoints.bin.tag-XXXXXXXX.stale` (bytes untouched, not deleted) and a fresh file for the current tag is opened; `STRATA_BLOB_STALE=off` disables it instead. The scan skips entries whose tag does not match, which is safe because each entry carries its own length.
- `p13_blob_compact.hpp` + `tools/park-gc.cpp` — `p13_session_dirs` used to sweep `root/tag-*/*/`, mixing live keys from every tag into one blob. `park-gc` now reads the tag from the blob header (`--tag` overrides) and compacts only that tag's session dirs.
- `generate.cpp` — both the snapshot layer and the blob layer get `disk_park.profile().tag()`.
- `conversation_cache.hpp` + serve — an evicted entry is handed to the caller instead of dropped; a failed checkpoint restore no longer exits the engine; after non-finite logits a request does not read K/V back from the disk tier.
- `tools/p13-park-sweep.sh` — the default park root comes from `$HOME` instead of one machine's home path; systemd units should set `Environment=STRATA_PARK_STREAM=…` explicitly.

Version-gate commit alone: 9 files, +175 / −32. Whole branch: 11 commits, 35 files.

## Extra Notes
Tested on the 3090 with `strata 0.1.43`: snapshot dir renamed `tag-A812110E` → `tag-AA00AEC7` — the tag algorithm changed, the numerics did not, so 68 GB was not re-stored. After restart the first requests show `hit_rate 0.90–0.92` with `prompt_read` of only 686–1326. The old `checkpoints.bin` was archived rather than relabelled (its records were written by 0.1.41 before 13:27 and by 0.1.43 after, so relabelling it would be a lie); the new file has header `SKB2` with tag `AA00AEC7`.

Tests: blob 68 (new version-gate section) / digest 28 / spool 64 / logs 98 / session 136 / bridge 54 / image 19 = **467 checks, 0 failures**.

For anyone with existing caches: the new engine will not read an old `tag-XXXXXXXX/` directory. If the numerics did not change across the upgrade, rename the directory to the new tag (no re-store). If they did, let it cold start — that is exactly what this gate is for. `checkpoints.bin` in the old `SKB1` format is unreadable by design: archive it or delete it.

En el sitio

Enlaces a install, modelos, releases.