fix(ui): drop dead toolHistoryRef leak (#465)#471
Merged
Conversation
…or session lifetime (#465) The /tool slash command was removed in #453 but its supporting plumbing was left behind: every tool result was still being pushed into a useRef array, with no consumer ever reading it. Long-running sessions accumulated full Read/Grep/Bash output indefinitely and ran out of heap. #465 reports a JS heap OOM after ~2.6 hours on v0.31.0; this leak matches the failure shape (mark-compacts ineffective, 4GB ceiling).
Closed
ChasLui
pushed a commit
to ChasLui/DeepSeek-Reasonix
that referenced
this pull request
May 23, 2026
…or session lifetime (esengine#465) (esengine#471) The /tool slash command was removed in esengine#453 but its supporting plumbing was left behind: every tool result was still being pushed into a useRef array, with no consumer ever reading it. Long-running sessions accumulated full Read/Grep/Bash output indefinitely and ran out of heap. esengine#465 reports a JS heap OOM after ~2.6 hours on v0.31.0; this leak matches the failure shape (mark-compacts ineffective, 4GB ceiling).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/toolslash command was removed in #453, but its supporting infrastructure stayed behind:toolHistoryRefinApp.tsx—useRef<Array<{toolName, text}>>([])pushed on every tool endhandleToolEventplumbing — pushedev.content(full tool result) on every dispatchformatToolListexporter in slash/helperstoolHistory: () => …callback wired through SlashContextNothing ever read it. Every Read / Grep / Bash output was retained for the full session lifetime in dead memory.
#465 reports
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memoryafter ~2.6h on v0.31.0 (heap topped 4GB). This leak matches that failure mode: a single large Bash output is enough to be measurable; in a multi-hour session with hundreds of tool calls the retention compounds.What changed
state.cards[].output(the source of truth that drives scrollback rendering) is untouched — UX unchangedTest plan
npx tsc --noEmit— cleannpx vitest run— 141 files, 2259 pass / 2 skipCloses #465