mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 00:58:28 +00:00
fix: hide synthetic untrusted metadata in chat history
This commit is contained in:
@@ -3,12 +3,14 @@ import path from "node:path";
|
||||
import readline from "node:readline";
|
||||
import type { NormalizedUsage, UsageLike } from "../agents/usage.js";
|
||||
import { normalizeUsage } from "../agents/usage.js";
|
||||
import { stripInboundMetadata } from "../auto-reply/reply/strip-inbound-meta.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import {
|
||||
resolveSessionFilePath,
|
||||
resolveSessionTranscriptsDirForAgent,
|
||||
} from "../config/sessions/paths.js";
|
||||
import type { SessionEntry } from "../config/sessions/types.js";
|
||||
import { stripEnvelope, stripMessageIdHints } from "../shared/chat-envelope.js";
|
||||
import { countToolResults, extractToolCallNames } from "../utils/transcript-tools.js";
|
||||
import { estimateUsageCost, resolveModelCostConfig } from "../utils/usage-format.js";
|
||||
import type {
|
||||
@@ -941,6 +943,13 @@ export async function loadSessionLogs(params: {
|
||||
if (!content) {
|
||||
continue;
|
||||
}
|
||||
content = stripInboundMetadata(content);
|
||||
if (role === "user") {
|
||||
content = stripMessageIdHints(stripEnvelope(content)).trim();
|
||||
}
|
||||
if (!content) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Truncate very long content
|
||||
const maxLen = 2000;
|
||||
|
||||
Reference in New Issue
Block a user