Skip to content

Preserve native DeepSeek snapshots when admission is rejected - #54

Draft
beastllama wants to merge 1 commit into
bertholomus:deepseek-v41-zig-tp2from
beastllama:fix/dsv41-cache-reservation
Draft

beastllama wants to merge 1 commit into
bertholomus:deepseek-v41-zig-tp2from
beastllama:fix/dsv41-cache-reservation

Conversation

@beastllama

Copy link
Copy Markdown

Root cause: prompt-cache lookup evicts snapshots to reserve future saves before the backend accepts placement, even for native DeepSeek-V4.1 whose drops reach followers immediately. Evidence: the CPU regression on e100ee8 consumes a ContextFull refusal without another prefill, leaves the request queued beside the existing stream, and nevertheless evicts one reusable snapshot.

This change lets native DSV41 defer reservation to the existing budget-enforcing keepBorn path. Rules.reserve_before_pass defaults to true; native DSV41 alone opts out through Loaded.snaps. Families whose peers receive drops with the next request retain their existing reservation behavior. No cache budget, admission capacity, arithmetic or wire protocol changes.

The deterministic LaneHost regression checks that refused placement preserves both warm snapshots. Its success control checks that admitted work still evicts exactly one snapshot, saves its mark, and stays at the same 128-byte fixture budget.

Validation with the repository-pinned Zig 0.17.0, CPU only:

  • Before the change: rejected-admission regression fails (expected 0, found 1 evictions).
  • After the change: admission-filtered engine API tests pass, 13/13.
  • Existing deferred-drop peer budget test passes, 9/9 including imported test roots.
  • Engine API no-emit typecheck, changed native files' syntax checks, zig fmt --check, and git diff --check pass.
  • Lean checker: 1872 inherited findings before and after; no added findings.

Reproduction commands from the repository root (zig must be 0.17.0):

zig test -lc -O ReleaseSafe --dep lanes -Mroot=zig/src/core/engine_api.zig -Mlanes=zig/src/core/lanes/lanes.zig --test-filter admission
zig test -lc -O ReleaseSafe --dep lanes -Mroot=zig/src/core/engine_api.zig -Mlanes=zig/src/core/lanes/lanes.zig --test-filter 'a pass makes room for every state'
zig test -fno-emit-bin -lc -O ReleaseSafe --dep lanes -Mroot=zig/src/core/engine_api.zig -Mlanes=zig/src/core/lanes/lanes.zig
zig build native -Doptimize=safe -j2

Local limitations: the broader engine API suite reached 42/179 before an integer-overflow panic in the existing prompt_imprint_fault_test allocation-failure test; that same panic was independently reproduced on an unmodified e100ee8 archive. The native build runner failed before source compilation with checking cache failed: manifest_stat Unexpected under the available WSL environment, including with isolated Linux source/cache directories. A complete native build and full host suite are therefore not claimed passed. GPU/model qualification was not run for this public-branch port; no serving process was changed and no performance gain is claimed by these CPU fixtures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant