From 58f02a2080a7935627d9373a9dffddcb00feb8ba Mon Sep 17 00:00:00 2001 From: Jiayuan Zhang Date: Sun, 15 Feb 2026 23:13:05 +0800 Subject: [PATCH] fix(compaction): match artifact refs from both soft trim and truncation markers The extractArtifactRef regex only matched "Full result saved to" (from pre-emptive truncation) but not "Full result available at" (from soft trim). This caused hard clear to lose artifact references when preceded by soft trim in the same pruning pass. Co-Authored-By: Claude Opus 4.6 --- packages/core/src/agent/context-window/tool-result-pruning.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/agent/context-window/tool-result-pruning.ts b/packages/core/src/agent/context-window/tool-result-pruning.ts index f957f2d6..be1cdaa6 100644 --- a/packages/core/src/agent/context-window/tool-result-pruning.ts +++ b/packages/core/src/agent/context-window/tool-result-pruning.ts @@ -283,7 +283,7 @@ function takeTail(text: string, maxChars: number): string { * Returns the artifact relative path, or null if not found. */ function extractArtifactRef(text: string): string | null { - const match = text.match(/Full result saved to (artifacts\/[^\s.]+\.txt)/); + const match = text.match(/Full result (?:saved to|available at) (artifacts\/[^\s.]+\.txt)/); return match?.[1] ?? null; }