p2.6: partition dcache by caller class; pin restricted workspace

Digest, chunk-embed, and question-embed keys include fleet|restricted so
a fleet caller cannot observe a restricted cache hit. Digest.Run takes
the class from permit_restricted.

A permit_restricted caller whose keys.toml workspace is not
guardian-star is refused at Search (no Honcho request) and flagged at
serve start and keys reload.

docs: P3 restricted callers search like the fleet; cache/logs isolate.
This commit is contained in:
2026-09-23 11:51:39 -07:00
parent 7be4ed1d43
commit 3687636ed7
12 changed files with 202 additions and 67 deletions
+2 -2
View File
@@ -247,12 +247,12 @@ func (e *Engine) noteFallback(reason string) {
// Run digests cleaned markdown. On any Dixie failure it returns fallback=""
// and the caller should substitute clean text; Fallback is set to the reason.
func (e *Engine) Run(ctx context.Context, cleaned, question, finalURL string) Result {
func (e *Engine) Run(ctx context.Context, cleaned, question, finalURL, callerClass string) Result {
start := time.Now()
r := Result{Model: e.model(), ChunksUsed: 1, ChunksTotal: 1}
sum := sha256.Sum256([]byte(cleaned))
contentHash := hex.EncodeToString(sum[:])
dkey := dcache.DigestKey(contentHash, question, e.model(), dcache.PromptVersion)
dkey := dcache.DigestKey(contentHash, question, e.model(), dcache.PromptVersion, callerClass)
if e != nil && e.Cache != nil {
if h, ok := e.Cache.GetDigest(dkey); ok {
r.Text = h.Text