feat: show transcript file size in session status

Add transcript size monitoring to /status and session_status tool.
Displays file size and message count (e.g. '📄 Transcript: 1.2 MB,
627 messages'). Shows ⚠️ warning when transcript exceeds 1 MB, which
helps catch sessions approaching the compaction death spiral described
in #13624.

- getTranscriptInfo() reads JSONL file stat + line count
- Wired into both /status command and session_status tool
- 8 new tests covering file reading, formatting, and edge cases
This commit is contained in:
Hubert
2026-02-16 21:27:14 +00:00
committed by Peter Steinberger
parent fc6d53c895
commit 15dd2cda20
4 changed files with 208 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ import type { OpenClawConfig } from "../../config/config.js";
import type { AnyAgentTool } from "./common.js";
import { normalizeGroupActivation } from "../../auto-reply/group-activation.js";
import { getFollowupQueueDepth, resolveQueueSettings } from "../../auto-reply/reply/queue.js";
import { buildStatusMessage } from "../../auto-reply/status.js";
import { buildStatusMessage, getTranscriptInfo } from "../../auto-reply/status.js";
import { loadConfig } from "../../config/config.js";
import {
loadSessionStore,
@@ -458,6 +458,13 @@ export function createSessionStatusTool(opts?: {
showDetails: queueOverrides,
},
includeTranscriptUsage: false,
transcriptInfo: getTranscriptInfo({
sessionId: resolved.entry?.sessionId,
sessionEntry: resolved.entry,
agentId,
sessionKey: resolved.key,
storePath,
}),
});
return {