Repository navigation
Editing large files and too many oxlint diagnostic warnings causing massive payloads and killing Chrome #14543
Description
Description
Running opencode web. Session started running pretty slow, then the browser crashed – and continues to do so each time I open that session.
Turns out there's a 780MB JSON response being returned from the server. I think from /messages. It starts with:
[
{
"info": {
"role": "user",
"time": {
"created": 1771644649319
},
"summary": {
"diffs": [
{
"file": "...",
"before": "...",
"after": "...",Inspecting the payload shows whole files in the edit tool portions (which are large, I'm working with JS bundles, multiple files, some around 4MB), and thousands of oxc warnings (all severity 2). They're on the tool call .state.metadata.diagnostics path in the payload. I haven't explicitly enabled oxc (that I know of), but I guess it's on by default for JS files.
Aside from the large files being embedded, I suspect the problem is also here:
opencode/packages/opencode/src/tool/edit.ts
Lines 136 to 142 in dbf2c45
| const errors = issues.filter((item) => item.severity === 1) | |
| if (errors.length > 0) { | |
| const limited = errors.slice(0, MAX_DIAGNOSTICS_PER_FILE) | |
| const suffix = | |
| errors.length > MAX_DIAGNOSTICS_PER_FILE ? `\n... and ${errors.length - MAX_DIAGNOSTICS_PER_FILE} more` : "" | |
| output += `\n\nLSP errors detected in this file, please fix:\n<diagnostics file="${filePath}">\n${limited.map(LSP.Diagnostic.pretty).join("\n")}${suffix}\n</diagnostics>` | |
| } |
This is limiting errors, but not warnings. The first file I checked has ~1600 warnings (severity: 2). Perhaps a separate warning limit could be used here (doesn't need to be as strict as errors, but still, don't need ~1600).
EDIT: actually just noticed it's not even limiting the number that's saved in the tool call – this is just for the warning message on too many errors. So yeah, every single issue is serialized here.
I also question whether each entire file before/after should be in the payload? The page only shows diffs, so I don't think the entire file is necessary to be returned from the server. (whether it should be saved to the session, I can't really comment on – again, feels a bit like overkill for 4MB files, if the diff itself would suffice, and perhaps a checksum if you need an identifier for the content at the time)
Plugins
No response
OpenCode version
Running bun dev on latest dev branch
Steps to reproduce
Have a session that edits a number of large JS files with thousands of oxc issues.
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Activity
[-]Editing large files and too many oxlint diagnostic warnings causing massive payloads[/-][+]Editing large files and too many oxlint diagnostic warnings causing massive payloads and killing Chrome[/+]mhart commentedon Feb 22, 2026
Hmmm, restricting the diagnostics to just one entry per file (in messages-v2.ts -> stream) only brings the /messages response down to 437MB, so I guess it's only a portion.
Session lives for a while (maybe 30 secs) and then Chrome errors again.
Still trying to find what's making it so large
mhart commentedon Feb 22, 2026
Ok, did some analysis of the remaining JSON response (after bringing the diagnostics down to one entry per file, so the 437MB response)
Just looking at string values in the JSON, seems to be mostly the before/after of the diffs (188MB each):
mhart commentedon Feb 22, 2026
Ah, I guess truncation doesn't work on
filediff.beforeorfilediff.after.So yeah, a few dozen edit tool calls on 4MB files is gonna make this blow out pretty quickly:
opencode/packages/opencode/src/tool/edit.ts
Lines 113 to 114 in 13616e3
mhart commentedon Feb 22, 2026
After truncating before/after to 50kb (again in messages-v2.ts -> stream) and limiting diagnostics, the response comes down to 50MB, and Chrome no longer crashes.
No idea if I'm gonna have some other problem here. Not sure if the full file contents are needed (can't see why they would be though).
Would be good in general to try to limit the amount of data being saved to sessions and especially over the wire, I imagine it'd speed things up all over the place 🙏
fix: resolve 4 bugs — payload bloat, MCP subagents, tool names, token…
github-actions commentedon Apr 23, 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.