chore(telemetry): fix agent loops, name mangling, dev server leaks, CWD alignment, and add daily session auditor

This commit is contained in:
2026-06-08 16:09:58 -07:00
parent f670fee691
commit 492404cd14
6 changed files with 690 additions and 71 deletions

View File

@@ -557,7 +557,7 @@ export async function POST(request: Request) {
.replace(/<tool_calls>[\s\S]*?<\/tool_calls>/g, "")
.replace(/<think>[\s\S]*?<\/think>/g, "")
// Completely strip any legacy leaked "[tools executed this turn]" strings in case they exist in older messages
.replace(/\n\n\[tools executed this turn:[\s\S]*?\]/g, "")
.replace(/(?:\r?\n)*\[tools executed this turn:[\s\S]*?\]/g, "")
.trim();
}
@@ -1156,7 +1156,7 @@ export async function POST(request: Request) {
// Ensure we strip the `[tools executed this turn...]` block if the AI accidentally hallucinated it
assistantText = assistantText.replace(
/\n\n\[tools executed this turn:[\s\S]*?\]/g,
/(?:\r?\n)*\[tools executed this turn:[\s\S]*?\]/g,
"",
);
@@ -1173,7 +1173,10 @@ export async function POST(request: Request) {
toolCalls: assistantToolCalls.length ? assistantToolCalls : undefined,
textSegments: assistantTextSegments.length
? assistantTextSegments.map((seg) =>
seg.replace(/\n\n\[tools executed this turn:[\s\S]*?\]/g, ""),
seg.replace(
/(?:\r?\n)*\[tools executed this turn:[\s\S]*?\]/g,
"",
),
)
: undefined,
_rawToolResults: assistantToolCalls.length ? [] : undefined,