fix: bound web-probe and gh diagnostic output (#884)

Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
Lyon
2026-06-25 20:46:41 +08:00
committed by GitHub
parent cdb567aef8
commit 04f8ab2238
4 changed files with 154 additions and 18 deletions
@@ -1897,17 +1897,32 @@ function detectAdjacentCrossPageProjectionDiffs(samples) {
function detectTraceMessageDuplication(samples) {
const rows = [];
for (const sample of samples) {
const finalText = normalizedText((Array.isArray(sample?.messages) ? sample.messages : []).map((item) => item?.textPreview || item?.text || "").join("\n"));
if (finalText.length < 40) continue;
const traceRows = Array.isArray(sample?.traceRows) ? sample.traceRows : [];
for (const row of traceRows) {
const groups = new Map();
for (let fallbackIndex = 0; fallbackIndex < traceRows.length; fallbackIndex += 1) {
const row = traceRows[fallbackIndex];
const rowTextRaw = String(row?.textPreview || row?.text || "");
if (!/(?:助手消息|assistant\s+message|assistant)/iu.test(rowTextRaw)) continue;
const rowText = normalizedText(rowTextRaw);
if (rowText.length < 24) continue;
const overlap = longestSharedSubstringLength(finalText, rowText);
if (overlap < 40 && overlap < Math.min(rowText.length, finalText.length) * 0.55) continue;
rows.push({ ...ref(sample), traceId: row?.traceId ?? null, rowIndex: row?.index ?? null, rowTextPreview: limitText(rowTextRaw, 180) });
const traceId = row?.traceId === undefined || row?.traceId === null ? "" : String(row.traceId);
const key = traceId + "\u0000" + rowText;
const group = groups.get(key) ?? { traceId: traceId || null, rowText, rowTextRaw, rows: [] };
group.rows.push({ row, fallbackIndex });
groups.set(key, group);
}
for (const group of groups.values()) {
if (group.rows.length < 2) continue;
rows.push({
...ref(sample),
traceId: group.traceId,
visibleAssistantFinalRowCount: group.rows.length,
rowIndexes: group.rows.map((item) => item.row?.index ?? item.fallbackIndex).slice(0, 12),
rowTextHash: sha256(group.rowText),
rowTextPreview: limitText(group.rowTextRaw, 180),
finalResponseSummaryBlockCounted: false,
traceFrameSource: "traceRows-only"
});
}
}
return rows;