Skip to content

fix(ui): drop dead toolHistoryRef leak (#465)#471

Merged
esengine merged 1 commit into
mainfrom
fix/465-tool-history-leak
May 8, 2026
Merged

fix(ui): drop dead toolHistoryRef leak (#465)#471
esengine merged 1 commit into
mainfrom
fix/465-tool-history-leak

Conversation

@esengine

@esengine esengine commented May 8, 2026

Copy link
Copy Markdown
Owner

Summary

/tool slash command was removed in #453, but its supporting infrastructure stayed behind:

  • toolHistoryRef in App.tsxuseRef<Array<{toolName, text}>>([]) pushed on every tool end
  • handleToolEvent plumbing — pushed ev.content (full tool result) on every dispatch
  • formatToolList exporter in slash/helpers
  • toolHistory: () => … callback wired through SlashContext

Nothing 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 memory after ~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

  • 48 lines deleted across 4 files
  • state.cards[].output (the source of truth that drives scrollback rendering) is untouched — UX unchanged
  • Loop / transcript / context-manager unchanged

Test plan

  • npx tsc --noEmit — clean
  • npx vitest run — 141 files, 2259 pass / 2 skip
  • Long-session smoke (>1h) to confirm heap stays flat — needs follow-up RSS instrumentation

Closes #465

…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).
@esengine esengine mentioned this pull request May 8, 2026
@esengine esengine merged commit 4029b7d into main May 8, 2026
3 checks passed
@esengine esengine deleted the fix/465-tool-history-leak branch May 8, 2026 23:59
@esengine esengine mentioned this pull request May 9, 2026
4 tasks
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

运行报错

1 participant