You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Render process freezes/crashes when opening session with large diffs #33195
Note: This bug is specific to the desktop/GUI version (Electron), not the terminal TUI version. The TUI does not have this issue.
Description
When opening a session that contains a very large file diff (e.g., a 20KB+ patch with garbled encoding), the render process becomes unresponsive and may crash entirely. The root cause is the execEditLength function in the diff algorithm (diffLines → structuredPatch → createTwoFilesPatch), which has O(n²) complexity and hangs on large patches.
This occurred 3 times on opencode v1.16.2 (Electron 41.2.1, Chrome 146) on Windows:
Temporary freeze (4s) — renderer unresponsive then recovered
Long freeze (35s) — 14 unresponsive samples collected, eventually recovered
Crash (no recovery) — Electron crash reporter triggered, minidump generated (33MB)
Full stack trace from all 3 occurrences:
at execEditLength (main-EPcHbCKO.js:42291)
at diffWithOptionsObj → diffLines → structuredPatch
at createTwoFilesPatch → parseDiffFromFile
at fileDiffFromContent → fileDiffFromPatch → resolveFileDiff
changed the title [-]Render process freezes/crashes when opening session with large diffs (execEditLength O(n²) on huge patches)[/-][+]Render process freezes/crashes when opening session with large diffs[/+]on Jun 21, 2026
Good point — I think the confusion is that this bug is specific to the desktop/GUI version (Electron), not the terminal TUI version. We tested the TUI and confirmed it doesn't freeze, so your understanding is correct for that target.
The issue is in the desktop app's TimelineDiffView (packages/app/src/pages/session/timeline/message-timeline.tsx), which directly calls the O(n²) diff algorithm without any size guard — whereas the TUI apparently handles this differently. We tested with ~10k-line diffs on the latest desktop version and the renderer freezes (we have crash dumps with the stack in execEditLength → diffLines from a 33MB minidump to back this up).
PR #33198 adds a 500-line cap with "Render Anyway" fallback, which matches the existing pattern in SessionReview. Longer term, the lazy/cancellable architecture you suggested would be the right direction.
Also, sorry — I should have made this clearer from the start: this bug is specific to the desktop/GUI (Electron) version. The TUI version does not have this unbounded diff issue. I've updated the issue description to reflect that.
Additional data point from OpenCode Desktop on Windows, without sharing session identifiers.
Environment:
OpenCode 1.17.9
Windows
Desktop/Electron build
Observed behavior:
App startup was normal and sidecar reached server ready
The UI then became unresponsive while opening/restoring a session
window.log reported renderer unresponsive
The renderer stack matches this issue exactly:
at execEditLength
at LineDiff.diffWithOptionsObj
at diffLines
at structuredPatch
at createTwoFilesPatch
at parseDiffFromFile
at fileDiffFromContent
at fileDiffFromPatch
at resolveFileDiff
What seems useful here is the trigger context:
This session was heavily focused on yudao-ui/yudao-ui-admin-vue3/src/views/system/dept/DeptImportForm.vue
The server log shows repeated read / git diff / edit / re-read activity around that single file
After restart, the app immediately resumed inspecting the same file, including checks around a specific line, BOM, and raw bytes
That makes it look less like a generic startup hang and more like one pathological file diff or patch payload causing the renderer-side diff computation to lock up
What was ruled out from the logs:
not updater-related
not sidecar startup failure
not a network wait
main process was healthy; the stall point was the renderer diff path
So this looks consistent with the existing large/pathological diff issue, but one more concrete repro clue is:
a session containing a problematic diff associated with DeptImportForm.vue
possibly involving unusual line content, encoding, BOM, or patch text shape rather than only raw file size
I can provide the debug zip privately if maintainers want another sample set.
Activity
[-]Render process freezes/crashes when opening session with large diffs (execEditLength O(n²) on huge patches)[/-][+]Render process freezes/crashes when opening session with large diffs[/+]Necmttn commentedon Jun 21, 2026
The session viewer should probably never run an unbounded diff algorithm on open.
I would split this into two layers:
For the specific regression, useful tests would cover:
The important behavior is row-level degradation. One bad tool result or diff should not make the whole session unrecoverable.
Generated with ax.
mouse114514 commentedon Jun 21, 2026
Good point — I think the confusion is that this bug is specific to the desktop/GUI version (Electron), not the terminal TUI version. We tested the TUI and confirmed it doesn't freeze, so your understanding is correct for that target.
The issue is in the desktop app's
TimelineDiffView(packages/app/src/pages/session/timeline/message-timeline.tsx), which directly calls the O(n²) diff algorithm without any size guard — whereas the TUI apparently handles this differently. We tested with ~10k-line diffs on the latest desktop version and the renderer freezes (we have crash dumps with the stack inexecEditLength→diffLinesfrom a 33MB minidump to back this up).PR #33198 adds a 500-line cap with "Render Anyway" fallback, which matches the existing pattern in
SessionReview. Longer term, the lazy/cancellable architecture you suggested would be the right direction.mouse114514 commentedon Jun 21, 2026
Also, sorry — I should have made this clearer from the start: this bug is specific to the desktop/GUI (Electron) version. The TUI version does not have this unbounded diff issue. I've updated the issue description to reflect that.
gggbond9527 commentedon Jun 22, 2026
Additional data point from OpenCode Desktop on Windows, without sharing session identifiers.
Environment:
Observed behavior:
server readywindow.logreportedrenderer unresponsiveWhat seems useful here is the trigger context:
yudao-ui/yudao-ui-admin-vue3/src/views/system/dept/DeptImportForm.vueWhat was ruled out from the logs:
So this looks consistent with the existing large/pathological diff issue, but one more concrete repro clue is:
DeptImportForm.vueI can provide the debug zip privately if maintainers want another sample set.
github-actions commentedon Aug 22, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.