Skip to content

Editing large files and too many oxlint diagnostic warnings causing massive payloads and killing Chrome #14543

Closed

Description

@mhart

Description

Running opencode web. Session started running pretty slow, then the browser crashed – and continues to do so each time I open that session.

Image

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:

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

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    perfIndicates a performance issue or need for optimization
    on Feb 21, 2026
  2. changed the title [-]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[/+] on Feb 21, 2026
  3. mhart commented on Feb 22, 2026

    @mhart
    ContributorAuthor

    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

  4. mhart commented on Feb 22, 2026

    @mhart
    ContributorAuthor

    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):

    [].parts.[].state.metadata.filediff.after: 188255315 bytes
    [].parts.[].state.metadata.filediff.before: 188216477 bytes
    [].info.summary.diffs.[].after: 21883627 bytes
    [].info.summary.diffs.[].before: 21844702 bytes
    [].parts.[].state.output: 312517 bytes
    [].parts.[].state.metadata.diff: 70001 bytes
    [].parts.[].state.input.newString: 68021 bytes
    ...
    
  5. mhart commented on Feb 22, 2026

    @mhart
    ContributorAuthor

    Ah, I guess truncation doesn't work on filediff.before or filediff.after.

    So yeah, a few dozen edit tool calls on 4MB files is gonna make this blow out pretty quickly:

    before: contentOld,
    after: contentNew,

  6. mhart commented on Feb 22, 2026

    @mhart
    ContributorAuthor

    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 🙏

  7. github-actions commented on Apr 23, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)perfIndicates a performance issue or need for optimization

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions