mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-02 03:35:09 +02:00
fix(sidebar-agent): evict tool-use registry entries on tool_result
toolUseRegistry was append-only. Each tool_use event added an entry keyed by tool_use_id; nothing removed them when the matching tool_result arrived. Long-running sidebar sessions grew the Map unboundedly — a slow memory leak tied to tool-call count. Delete the entry when we handle its tool_result. One-line fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -367,6 +367,7 @@ async function handleStreamEvent(event: any, tabId?: number, canaryCtx?: CanaryC
|
||||
// fires, onToolResultBlock handles kill + emit.
|
||||
toolResultScanCtx.scan(toolName, text).catch(() => {});
|
||||
}
|
||||
if (block.tool_use_id) toolUseRegistry.delete(block.tool_use_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user