Skip to content

Bug: React "Maximum update depth exceeded" crash when rendering multiple edit_file results #1956

@xjr100419

Description

@xjr100419

Screen flicker, garbled output, leftover artifacts, cursor jumping?
Use the Display / rendering issue template instead — it asks for the
terminal-specific info we need to diagnose those.

What happened
A clear and concise description.

Expected
What you expected to happen.

Reproduction
Steps or minimal code that reproduces it.

Environment

  • Reasonix version (reasonix --version):
  • Node version (node --version):
  • OS (Windows 11 / macOS 14 / Ubuntu 24.04 / …):
  • Shell (bash, zsh, fish, PowerShell 7, PowerShell 5.1, cmd, …):
  • Terminal app (Windows Terminal, iTerm2, Alacritty, kitty, WezTerm, VSCode integrated, Cursor integrated, Hyper, …):
  • DeepSeek model (e.g. deepseek-v4-flash, deepseek-v4-pro):

Logs / transcript
If using the CLI, attach the relevant chunk of --transcript, or run
reasonix doctor and paste the output.

Describe the bug

When Reasonix agent performs multiple edit_file / multi_edit calls and returns several SEARCH/REPLACE blocks in a single turn, the terminal UI crashes with:

Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

Full stack trace:

at getRootForUpdatedFiber (chunk-3OXD5CBM.js:13936:128)
at enqueueConcurrentHookUpdate (chunk-3OXD5CBM.js:13920:16)
at dispatchSetStateInternal (chunk-3OXD5CBM.js:15371:20)
at dispatchSetState (chunk-3OXD5CBM.js:15342:9)
at f (chunk-3OXD5CBM.js:30198:39)
at Timeout.b (chunk-3OXD5CBM.js:30113:32)
at listOnTimeout (node:internal/timers:588:17)
at process.processTimers (node:internal/timers:523:7)

To Reproduce

  1. Run npx reasonix code (v0.52.0)
    1. Ask the agent to fix a bug that requires multiple edit_file / multi_edit calls
    1. The agent returns 3+ SEARCH/REPLACE edit blocks in a single response
    1. The terminal UI crashes with the above error

Expected behavior

The edit blocks should render normally without React state update loops.

Environment

  • OS: Windows 11
    • Node.js: v22.20.0
      • Reasonix: 0.52.0
        • Terminal: Windows Terminal

Additional context

The crash occurs in React Ink's reconciler (getRootForUpdatedFiberdispatchSetState). Rapid state updates from rendering tool results (edit diffs) trigger React's nested update guard (50-deep limit). This is likely in the component that renders tool call results in the terminal UI.

The error has been observed specifically when the agent returns many SEARCH/REPLACE edit blocks for the same file or across multiple files in one turn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions