A reused answer never carries another caller's values
With restore: true and the answer cache on, alice's "write to alice@example.com" and bob's "write to bob@example.com" redact to the same request, and bob was given the answer kept for alice, her address put back in it. A request with restore values is now never looked up in the cache nor kept in it. The similar-question cache compared the last message's text and blanked its parts: two pictures asked about in the same words were one question. A last message with any part that is not text is now reused only when the request is the same. Found in review; both tests fail without the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
03d3bcfd2d
commit
7a04248148
6 files changed
+87
-4
No files matched your search
@@ -313,6 +313,12 @@ func reusable(req *parsedRequest, anyAnswer bool) bool {
|
||||
if req.knowledge || req.Header.Get(knowledgeHeader) != "" {
|
||||
return false
|
||||
}
|
||||
// An answer with the caller's own values put back in it (restore: true)
|
||||
// is theirs alone: another caller's request, redacted, reads the same,
|
||||
// and would be given the first caller's address.
|
||||
if len(req.guardIn.Restore) > 0 {
|
||||
return false
|
||||
}
|
||||
if v := strings.ToLower(strings.TrimSpace(req.Header.Get(cacheHeader))); v == "no" || v == "off" || v == "bypass" {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user