fix(report): guard against empty tool call IDs in session analyzer
Skip indexing and lookup when tool call/result IDs are missing to prevent collisions on the empty-string key in toolCallIndex. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
586cb00174
commit
114ea36df9
1 changed files with 3 additions and 2 deletions
|
|
@ -569,7 +569,7 @@ export function analyzeSession(detail: SessionDetail): SessionReport {
|
|||
for (const tc of m.toolCalls) {
|
||||
const toolName = tc.name;
|
||||
toolCounts.set(toolName, (toolCounts.get(toolName) ?? 0) + 1);
|
||||
toolCallIndex.set(tc.id ?? '', [i, tc]);
|
||||
if (tc.id) toolCallIndex.set(tc.id, [i, tc]);
|
||||
const inp = tc.input ?? {};
|
||||
|
||||
// Bash commands
|
||||
|
|
@ -749,7 +749,8 @@ export function analyzeSession(detail: SessionDetail): SessionReport {
|
|||
|
||||
// --- Tool results ---
|
||||
for (const tr of m.toolResults) {
|
||||
const toolUseId = tr.toolUseId ?? '';
|
||||
const toolUseId = tr.toolUseId;
|
||||
if (!toolUseId) continue;
|
||||
const contentStr = typeof tr.content === 'string' ? tr.content : JSON.stringify(tr.content);
|
||||
|
||||
// Tool errors
|
||||
|
|
|
|||
Loading…
Reference in a new issue