Repository navigation
Description
Priority: P1 | Area: runtime | Labels: fix, P1, area:runtime | Milestone: v0.1.0 | RFC: OQ-none | Follow-up of: #3159 (PR #3160)
Context
PR #3160 (squash ce182ec1) reclaimed Kitty graphics capacity on re-transmit and closed #3159.
An independent re-review of that PR's final head (66ddaa48, posted on the PR as
Independent review (guard-dispatched reviewer) at head 66ddaa48) returned VERDICT: CHANGES-REQUESTED
because one eviction path was left unprotected, and the PR was merged before the verdict landed.
This issue carries the residuals so they land as a fix-forward PR off origin/main.
R1 (blocking) — store reclamation evicts alt-stash-referenced main-screen images
reclaim_for_runtime_store (crates/bitty-rich/src/kitty_place.rs, candidate scan around
:2388-2404) does not consult the alternate-screen stash. While the alternate screen is active the
main-plane placements live in KittyAltStash, invisible to KittyImageLayer, so their images look
unreferenced and are the first eviction candidates at global saturation. The same defect class as
CodeRabbit thread 4575144092 (which the round fixed for remove_by_wire_image /
prune_superseded_wire_images only, via protected_images + stashed_kitty_image_ids,
crates/bitty-runtime/src/runtime/kitty_images.rs:1926-1947).
Reproduced at head 66ddaa48 on a scratch copy:
main plane: place i=5 -> images=1
?1049h (stash the main placement) -> placement_count=1
63 alt transmits -> images=64, no reclamation -> after ?1049l: last_frame_images=1 (ok)
79 alt transmits -> images=64, reclamation -> after ?1049l: last_frame_images=0 (image gone)
Fix: thread stashed_kitty_image_ids(origin) into reclaim_for_runtime_store and skip protected
ids in the eviction candidate scan, plus a regression test that fails on the pre-fix code.
R2 (test gap) — empty-origin a=q admission is unverified
Reverting only the kitty_probe_admittable predicate (crates/bitty-runtime/src/runtime/kitty_images.rs:2716,
origin_count < KITTY_PER_ORIGIN_MAX_IMAGES) to the round-1 form (origin_count > 0 && ...) still
passes the whole test binary, so CodeRabbit thread 4575144100's case has no discriminating test.
Add one: a session with no images of its own must get OK for a probe the store can accommodate
by reclaiming another origin's unreferenced image.
R3 (nit) — remove_by_wire_image drops sibling placements
remove_by_wire_image deletes every image/placement of (origin, i) on the plane, so an i= with
several p= placements loses its siblings when one is re-transmitted. Pre-existing since round 1;
harmless for clients with unique i=. Decide and document (or narrow the delete to (origin, i, p)).
R4 (nit) — wrong byte budget in a doc comment
crates/bitty-rich/src/kitty_place.rs:2349 says KITTY_PLACE_MAX_BYTES is "320 MiB"; it is 256 MiB
(crates/bitty-rich/src/image.rs:58).
R5 (nit) — a stored-but-unplaced main-plane image is not stash-protected
A main-plane image that is stored but never placed is absent from stashed_kitty_image_ids, so a
same-id alt retransmit drops it and a later main-plane a=p for that id misses. Same visibility
problem as R1, narrower blast radius; fix together with R1 if the candidate set allows it.
Acceptance
- R1 fixed with a regression test that fails on
ce182ec1and passes on the fix. - R2 test added and shown to fail when the predicate is reverted.
- R4 corrected; R3/R5 either fixed or explicitly recorded as accepted limitations in the PR body.
- Focused gates:
cargo fmt --check,cargo clippy -p bitty-rich -p bitty-runtime --all-targets --offline -- -D warnings,cargo test -p bitty-runtime --test kitty_images_present --offline,cargo +1.85 check -p bitty-rich -p bitty-runtime --tests --offline.
Activity