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.

@bertholomus

Copy link
Copy Markdown
Owner

Sorry for the slow reply, and thank you for your patience.

Thank you @beastllama for a precise root cause and an honest limitations list. In one line: prompt-cache lookup reserved room for future saves by evicting snapshots even when the backend then refused the placement, so a refused request still cost a reusable warm snapshot on native DeepSeek-V4.1; this PR defers that reservation to the existing keepBorn budget path for native DSV41 only, leaving every other family's behavior unchanged.

The failing-then-passing regression on the exact scenario, the success control proving admitted work still evicts exactly one snapshot at the same budget, and the pre-existing test panic reproduced on the unmodified base are all the right evidence. We are reviewing it, including a full native build on our side since your WSL environment could not run one, and will follow up in this thread.

@bertholomus

Copy link
Copy Markdown
Owner

CI never started on this head: the runs we approved on GitHub stayed queued with no jobs, and GitHub refuses to cancel or re-run them. We are closing and reopening this PR once to start fresh runs. Nothing about the PR changes. Sorry for the noise.

@bertholomus bertholomus reopened this Nov 15, 2026
@bertholomus

bertholomus commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Thank you again @beastllama. GitHub's CI never started on this head, so we ran the same checks ourselves on 79c5aa6: zig build test 1766/1776 passed with 10 skipped (the base: 1762/1772, the same 10 skips), test-kernel-contract 18/18, test-cuda-host passes, and zig fmt --check flags no new files. When you mark it ready for review, we go on from there.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants