Skip to content

Red control for #2573: tests without the change (do not merge) - #2577

Draft
jonathan308 wants to merge 42 commits into
devfrom
red/zdr-prefix-cache-ram
Draft

jonathan308 wants to merge 42 commits into
devfrom
red/zdr-prefix-cache-ram

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

The tests of #2573 (at b073324) run against #2573's base (#2575, feat/zdr-cache-policy at 6009e53), without the change, so they should fail. The first run (55a464b) covered the tests as they were at 1435266; the head now carries the final set.

Test-only adapters (MemoryOnlyTierRedAdapter.swift, plus a memoryOnlyTier: fixture argument that is ignored) give the new test calls the base's behaviour:

  • a memory_only request's prefix is never kept, and no tier is attached or offered;
  • no server has a RAM-only release point, and a budget ignores the pool argument;
  • the prompt-token piece cache has no TTL;
  • nothing is counted.

Production code is unchanged.

Expected failures:

  • RAM-only checkpoint tier for memory_only requests. Every case that expects a stored or restored entry, a count, an eviction or a TTL expiry:
    • the second identical prefix restores from RAM; another scope misses while the own scope hits; no file is written;
    • close, pressure, load, sleep, shutdown and shortfall release; a release during a copy; close waiting for a restore;
    • LRU, budget, duplicates, sliding and fixed TTL, the headroom guard, the ledger charge, the full queue, wiring refused, abandon then retry, availability.
  • RAM-only tier releases: every case (the entry it releases is never stored; the local server has no monitor).
  • RAM-only prefix tier switches and budget: the mode, cap, attach-rule, submission-policy and per-chip budget cases.
  • memory_only requests reuse a prefix from RAM only: the second marked request reports 0 cached tokens (the base serves it cold).
  • Prompt token cache: the four TTL cases (no expiry, no setting, no LaunchAgent key).
flowchart LR
  A[Before: base without #2573] --> B[memory_only repeat: cold, 0 cached tokens; piece cache keeps pieces until displaced]
  C[After: these tests only] --> B
Loading

- Parse an optional cache_policy in the sealed _darkbloom_cache member. "default"
  or absent keeps today's behaviour; memory_only, and any other value, runs the
  request with its prefix cache off, so it never reads, writes, stages, donates
  or restores anything on the SSD tier. The policy needs no nonce or scope; a
  plaintext cache_policy on the frame can only narrow it.
- The SSD stores refuse every call made with a memory-only receipt, counted on
  the local /metrics beside requests by policy.
- Complete checkpoints store a keyed digest of their prefix instead of its
  token IDs, and an MTP assistant's token tensor as zeros; a restore rebuilds
  both from the request's prompt. The epoch binding is versioned, so either
  format's files are removed when the other opens the model directory.
- Cluster prefix records (versions 3 and 4) store history tokens as zeros.
- DARKBLOOM_SSD_KV_TTL_MODE=fixed stops a reuse from extending an entry's life.
- Advertise the cache_policy_v1 runtime capability.
Document the sealed cache_policy and its frame rule, cache_policy_v1, every
file a request can leave on disk, the token-free checkpoint and cluster
record formats, DARKBLOOM_SSD_KV_TTL_MODE and DARKBLOOM_LOCAL_CACHE_POLICY,
with a changelog fragment.
Behaviour is unchanged; formats, wire keys, metric names and the
capability string are untouched.

- SSDHybridCheckpointEnvelope: decodeManifest and the DEBUG
  inspectStoredManifestForTesting parse chunk 0 through one
  StoredManifest instead of two copies of the same member lookups. The
  PackedTokens comment says why it copies MLXLMCommon's internal encoder.
- SSDHybridCheckpointStore: takeStaged and takeNativeStaged share the
  memory-only refusal in takeStage. The write path releases a refused
  and a withheld preparation in one branch.
- SSDPrefixCache: the three fixed-TTL refresh sites wrap the original
  refresh code in one `if config.ttlMode.refreshesOnHit` each.
- RequestCachePolicy(decoding:forKey:) holds the absent/present rule the
  sealed member and the plaintext frame both read. The localServing
  comment sits on the function it describes.
- The local endpoint reads DARKBLOOM_LOCAL_CACHE_POLICY once and gives
  the same value to the scheduler engines and the Nemotron Super engine.
- MultiModelBatchSchedulerEngine: the cachePolicy comment now covers
  local requests and the prompt-token piece cache.
- Tests: the checkpoint fixture donates a given source, replacing two
  copied continuations; an inline donation replaces a copied attention
  helper; the handler test no longer expects an exact process-wide count
  of default requests, which other suites also add to; the pair rank's
  fixed-TTL test advances the tier's clock instead of sleeping.
- Docs: restamp the five changed pages that kept an older date.
…x cache off

The image and video route of the Super owner did not pass a request's cache
policy to the bridge, so a memory_only media request on an owner with a
checkpoint bank could restore from and publish to it. The policy now
reaches submitTokenized on that route, as on the text route.

Tests: a marked text and a marked image request on a bank owner make no
lookup, restore nothing and publish nothing; the unmarked requests around
them miss, then hit.
Name the provider's usage-history.json and the desktop app's settled usage
archive beside the cache files one request can leave on disk.
…2573)

The tests of #2573 on its base (#2575), with test-only adapters that give the base's behaviour: a memory_only request's prefix is never kept, the prompt-token piece cache has no TTL, and nothing is counted. Production code is unchanged.
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Nov 24, 2026 7:33pm UTC
darkbloom-status Ready Ready Preview Nov 24, 2026 7:33pm UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 24, 2026 7:33pm UTC

Request Review

A version-4 record keeps one history for all its frontiers. Its restore
sized the token buffer to the record's deepest prompt and filled it from
the request's prompt, so a shorter prompt that covers a kept frontier
failed and the record was deleted. The restore now fills only the
frontier's tokens, the part the view uses.
…eep clear of seeded IDs

A pair member registers and attests cache_policy_v1 beside its hardware
capabilities, since its ranks run a memory_only request with the prefix
cache off and the coordinator needs every member to report it.

Memory-only receipts move to bit 62 with the seeded engine-ID tag clear,
so no engine ID falls in the range. The rank no longer lists TTL_MODE as a
numeric pass-through; the mode reaches it from this Mac's setting. The
handler test checks request counts as lower bounds, since other suites
send requests alongside it.
List the daemon state, provider log, unified log, pair telemetry and
worker log beside the usage records; say that a memory_only request makes
no SSD call and when the receipt range applies; name builds before this
change instead of a release number; and say when the other format's files
of a model that is not loaded go.
…ed control)

The tests of #2573 at b073324 on its base, with test-only adapters that give the base's behaviour: a memory_only request's prefix is never kept, the prompt-token piece cache has no TTL, nothing is counted, and no release point or attach rule exists. Production code is unchanged.
@jonathan308 jonathan308 added the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 23, 2026
@github-actions github-actions Bot removed the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 23, 2026
@jonathan308 jonathan308 added the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 23, 2026
@github-actions github-actions Bot removed the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 23, 2026
Expired records were deleted only inside the next write or at load, so an
idle pair kept them on disk past the TTL. A running rank now sweeps its
own expired records, and the other plans' it kept at load, every
expirySweepSeconds (60), as the single-Mac tier's whole-root maintenance.
Past its TTL a record is also never restored or kept recent. Comments name
the shared history header version 4.
Every 60 s, on a single Mac and on a pair's Macs, the provider deletes the
expired .dbpx records of plan folders no running rank holds, so a pair that
is not loaded keeps none (ClusterPrefixRecordExpiry). Comments say that a
pair member reports cache_policy_v1 beside its hardware capabilities.
jonathan308 and others added 23 commits November 23, 2026 11:54
…plan lease

Reserve the record name before queueing an atomic rewrite. A busy reader
keeps its record and the dropped capture is counted. Close stops new
passes and holds the lease until work already admitted finishes.

Read the applied rank TTL from an owner-only duration stamp. Walk the
opened cache volume by descriptor and skip plans without an exclusive
lease. Share the writer's canonical plan, rank and record names. Document
when reuse expires and the separate conditions for file cleanup.
Switch-off and unpair share the checked plan lease and open-directory
walk. Staging and the empty root are reclaimed only after a complete
inspection and an exclusive root lease. Count both held and unknown
outcomes for retry. Keep held plans charged against the combined budget,
but discard confirmed absent paths; detach local eviction victims while
checking their pins. Log admission drops after releasing the mutex.
…errupted retirement

Record the selected path, volume UUID and observed root inode before a
member reclaims anything. Keep the intent unresolved if the selection or
mount changes. A legacy marker without identity cannot remove files.

Move a verified idle plan to an inode-qualified retirement name before
unlinking its lease. After an interrupted empty-directory removal a later
pass can finish that operation without treating an ordinary missing lock
as evidence of an idle plan.
…t returned root

Keep the marker single-linked across publication. On return of a pinned
volume, persist its observed root inode before considering file removal;
never hand an unbound retry to the remover. Compare root names without
filesystem-dependent path normalization. Show unfinished member cleanup
as unfinished when the leader reports unpair progress.
…te leaves

- A plan whose in-use file is missing (an earlier build's interrupted
  removal, or a crash between creating a plan and its lock) gets a new
  lock file, but only while the caller holds the cache root exclusively.
  Every rank holds the root shared from before it creates a plan, so no rank
  can be between those steps. The periodic pass, unpair and switch-off all
  repair it this way and otherwise skip or retry as before.
- A new unpair replaces a reclaim marker it cannot use (an earlier format,
  malformed, extra links or unsafe metadata) with its own intent, in one
  rename. It never acts on the old marker. A second same-inode
  .cluster-*.tmp link left by an earlier build's interrupted publication is
  removed first. Retries keep refusing an unusable marker.
- An empty or malformed expiry-ttl stamp counts as missing, so the local
  TTL applies; it is never shorter than min(local, stamp). The stamp is
  synced before its rename.
- A failed unlink during eviction or removal keeps the name reserved and
  restores the entry, unoffered and due, so the next expiry pass retries it.
- Comments state that a TTL ends reuse and that removal is conditional.
Reword the fixed TTL mode, crash orphans and files of models no longer
loaded. Describe lock repair, stamp handling, marker replacement and
cleanup limits for pair caches.
…ch wipe that stopped

A wipe that is interrupted, or meets an entry it can't remove, leaves the invalidating epoch record, and unloaded whole-root maintenance refused to delete anything under it, so that model's files stayed past their TTL until the model loaded again. The record already condemns every block of the root, so TTL and budget removals now run under it too; the next initialization still repeats the wipe.
… sweep

- Attention-block stages count only blocks within their TTL (SSDBlockIndex.longestFreshRun), for the plan, its re-probe and the window sidecars, so an expired block isn't staged in the up to 60 s before a sweep removes it.
- A complete checkpoint's delta needs every parent link within its TTL, checked again before the write; under a fixed TTL a chain with less than half a TTL left gets a complete checkpoint instead.
- A re-donation of a checkpoint past its TTL writes it again instead of reporting it durable.
- A ready publication advertises only a chain within its TTL.
fix/zdr-ssd-residual at 3fa5bde: an epoch wipe that stopped early no
longer leaves a model's files without maintenance, and an entry past its
TTL is not reused, written over as durable or advertised.
Describe the fresh-entry checks for attention blocks and checkpoint chains,
the fixed-TTL complete-checkpoint rule and maintenance after an early-stopped
wipe, in reference and changelog terms: reuse ends at the TTL; removal follows.
The characterization test recorded that an expired attention block was still staged until the sweep removed it. The stage plan now counts only blocks within their TTL, so the test expects the cutoff in both orders, and that a refused stage leaves the files for the sweep.
List what can postpone or prevent removal on one Mac, and state that after
a switch to the fixed TTL an entry's age counts from its last recorded hit.
A throwing read inside the right side of && does not compile in #expect.
A re-donation checks its own checkpoint's TTL, not the whole chain. State
that a new unpair also replaces a marker it cannot read because of an I/O
error, so an earlier selection's pending cleanup can be dropped.
fix/zdr-ssd-residual at 8f2a14e: the existing characterization now
expects the stage cutoff before the expiry sweep.
The retirement-recovery case now holds the root as a starting rank does,
then checks that an abandoned plan without its lock file goes once the
root is idle.
trust_status gains an optional coordinator_features list. While the connected
coordinator's latest trust_status lists decode_rate_age_decay, the heartbeat
stops omitting an idle slot's observed_decode_tps after
DARKBLOOM_DECODE_RATE_IDLE_MAX_AGE_SECONDS: it sends the rate and its
observed_decode_tps_age_ms, and the coordinator decays a stale rate toward the
fleet median itself. This removes the alternation between no rate (idle) and
an old one (busy) for such a coordinator.

Absent, malformed or unknown entries, a later trust_status without the entry,
and a disconnect keep today's behaviour; the heartbeat is then unchanged byte
for byte. Older coordinators never send the field and are decoded as before.

Tests: CoordinatorDecodeRateDecayTests (shared wire cases in
Fixtures/Protocol/coordinator_features_wire.json, wire shape, advertisement
lifecycle, heartbeat bytes with and without the feature).
…intenance

Each build keeps its complete-checkpoint files in a directory bound to the
build, so after an update or a rollback the other build's files are never
read. State when maintenance removes them and when they remain, and that
memory_only requests are unaffected. Comment and documentation lines only.
Records of versions 1/2 are refused and removed when the plan that wrote
them loads. After an update the old build's pair records sit in another
plan directory and follow the usual TTL cleanup. Documentation only.
Conflict in docs/developer/serving-performance-qualification.md only: both sentences kept (the decode rate before a slot's first completed request, then the decode_rate_age_decay advertisement).
@jonathan308 jonathan308 reopened this Nov 24, 2026
@jonathan308
jonathan308 changed the base branch from feat/zdr-cache-policy to dev November 24, 2026 19:31
@jonathan308 jonathan308 added the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 24, 2026
@github-actions github-actions Bot removed the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Nov 24, 2026

This branch was successfully deployed

3 active deployments
Preview – eigen-homepages-darkbloom — 655e1722 Deployed Nov 24, 2026 by vercel[bot]
Preview – d-inference-landing — 655e1722 Deployed Nov 24, 2026 by vercel[bot]
Preview – darkbloom-status — 655e1722 Deployed Nov 24, 2026 by vercel[bot]
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