mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 12:41:23 +00:00
Memory/QMD: warn when scope denies search
This commit is contained in:
committed by
Vignesh
parent
6aedc54bd7
commit
7f7d49aef0
@@ -242,6 +242,7 @@ export class QmdMemoryManager implements MemorySearchManager {
|
||||
opts?: { maxResults?: number; minScore?: number; sessionKey?: string },
|
||||
): Promise<MemorySearchResult[]> {
|
||||
if (!this.isScopeAllowed(opts?.sessionKey)) {
|
||||
this.logScopeDenied(opts?.sessionKey);
|
||||
return [];
|
||||
}
|
||||
const trimmed = query.trim();
|
||||
@@ -693,6 +694,15 @@ export class QmdMemoryManager implements MemorySearchManager {
|
||||
return fallback === "allow";
|
||||
}
|
||||
|
||||
private logScopeDenied(sessionKey?: string): void {
|
||||
const channel = this.deriveChannelFromKey(sessionKey) ?? "unknown";
|
||||
const chatType = this.deriveChatTypeFromKey(sessionKey) ?? "unknown";
|
||||
const key = sessionKey?.trim() || "<none>";
|
||||
log.warn(
|
||||
`qmd search denied by scope (channel=${channel}, chatType=${chatType}, session=${key})`,
|
||||
);
|
||||
}
|
||||
|
||||
private deriveChannelFromKey(key?: string) {
|
||||
if (!key) {
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user