Repository navigation
Prompt cache salts: cache_salt and serve --cache-salt-per-key keep kept prompt states apart - #3222
Merged
Merged
Conversation
ashhart
force-pushed
the
lead/cache-salt
branch
2 times, most recently
from
November 14, 2026 20:11
4cb5836 to
2a870a8
Compare
ashhart
force-pushed
the
lead/cache-salt
branch
from
November 18, 2026 01:26
2a870a8 to
aec913d
Compare
ashhart
force-pushed
the
lead/cache-salt
branch
2 times, most recently
from
November 19, 2026 01:44
1ce9ed7 to
3fa6e0b
Compare
1 task done
ashhart
force-pushed
the
lead/cache-salt
branch
3 times, most recently
from
November 21, 2026 18:48
9246689 to
3b2ace4
Compare
…nd with serve --cache-salt-per-key the API key it matched, is hashed with HMAC-SHA-256 under the server's tool-call id key and masks the first four words of the lane host's cache key. A kept state is then resumed only by a request with the same salt; with no salt the request is keyed exactly as before, and tokens never change. Salted states stay in RAM: the disk writer, reader and --learn already refuse high-bit words, so the disk format is unchanged. A salted request neither drafts from nor adds to Recall's record and neither reads nor writes --compact-memory notes; the server's own requests for a salted conversation (warm pass, compaction notes, Cortheon's planner and kept rounds) keep the salt, and a salted /v1/imprint ask looks up its own states. Engines whose cache is not the lane host's store refuse a salted request with 400 and refuse to start with --cache-salt-per-key. The request log redacts the salt, and /v1/models publishes capabilities.cache_salt. Fixes #3196
ashhart
force-pushed
the
lead/cache-salt
branch
from
November 21, 2026 22:36
3b2ace4 to
8d20639
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds prompt cache salts.
What changed
cache_salt, a non-empty string of at most 1024 bytes, on/v1/chat/completions,/v1/completions,/v1/responsesand/v1/messages.serve --cache-salt-per-keyalso salts every request by the API key it matched; a request's owncache_saltthen counts within that key.<redacted>)./v1/modelspublishescapabilities.cache_salt.Isolation rule
--learnalready refuse these words, so the disk format is unchanged and a salted request never reads a disk state.--compact-memorynotes./v1/imprintask reports and loads only its own salt's states.--cache-salt-per-key.Unsalted requests are unchanged: with no salt and the option off, the request reaching the engine is the same as before byte for byte: same cache key, same lane host bookkeeping, nothing new on disk. Salts never change tokens; they only key the cache, so a salted request may prefill more but never computes differently.
Tests: two salts never resume each other's states; the same salt resumes where an unsalted turn does, with equal tokens; salted repeats are noted under their own key; salted states stay off disk and a salted lookup reads none; Recall neither serves nor records a salted request; the routes keep salts and keys apart and refuse salts on engines that can't keep them; no client salt reproduces another key's salt; Messages and Responses pass the salt on and imprint asks use the salted key; salted compactions skip the note store, the request log redacts the salt, and Cortheon's planner request is salted. Each test fails with its fix reverted.
test-server-cpu,test-prompt-cache-host,test-lane-api-host,test-key-scopes-host,test-server-securityandtest-cuda-hostpass.Still owed: a served check on a lane-host model with
--prompt-cache-disk: unsalted turn 2'scached_tokensandtoken_sha256equal main's; the same salt resumes at the same place and another salt resumes nothing; the disk holds no salted states; two keys stay apart under--cache-salt-per-key.Fixes #3196