mirror of https://github.com/openclaw/openclaw.git
fix: address Codex review — shallow-copy meta before namespacing, keep hardcoded fallback after pattern strip
This commit is contained in:
parent
b113519c6f
commit
66b35e00b6
|
|
@ -186,7 +186,9 @@ function namespaceMessageMeta(
|
|||
if (!result?.messageMeta || Object.keys(result.messageMeta).length === 0) {
|
||||
return;
|
||||
}
|
||||
result.messageMeta = { [pluginId]: result.messageMeta };
|
||||
// Shallow-copy the original meta before wrapping so we never mutate the
|
||||
// plugin's returned object (which may be a reused module-level constant).
|
||||
result.messageMeta = { [pluginId]: { ...result.messageMeta } };
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -36,7 +36,10 @@ function stripDisplayPatterns(text: string, message: unknown): string {
|
|||
// skip invalid regex
|
||||
}
|
||||
}
|
||||
return result.trimStart();
|
||||
// Still run hardcoded fallback after pattern-driven strip: if the
|
||||
// plugin-provided regex was malformed or missed a variant format,
|
||||
// the safety net catches it.
|
||||
return stripRelevantMemoriesTags(result.trimStart());
|
||||
}
|
||||
|
||||
// Hardcoded fallback: strip <relevant-memories> tags even when messageMeta
|
||||
|
|
|
|||
Loading…
Reference in New Issue