mirror of https://github.com/garrytan/gstack.git
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:
parent
905d5a2e29
commit
c98ef05c03
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue