Skip to content

Unbounded LSP output may use entire token quota #5259

Closed

Description

@dan-kirberger

Description

You'll see bash.ts has some mechanisms for limiting its output, we may want the same in write.ts, namely, where it processes the response of the language server call here

I was pointed in this direction here: #2464 (comment)

In my particular case, it may ask the language server to fully inspect a repo, and trigger tons of errors due to the language server not knowing about a particular plugin or config ("Lombok" in my case, for java). Ultimately best solved by configuring the LSP appropriately on my end, but I don't think we ever want this code adding an unbounded amount of data to the context, right?

Would a pattern similar to bash.ts make sense?

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Dec 8, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. dan-kirberger commented on Dec 8, 2025

    @dan-kirberger
    Author

    Some of the suggested dupes are valid, for a general pattern to follow for tools. This issue could conceivably stick around if a focused solution is desired around LSP output maybe?

  3. rekram1-node commented on Dec 8, 2025

    @rekram1-node
    Contributor

    Yes we should do that

  4. rekram1-node commented on Dec 8, 2025

    @rekram1-node
    Contributor

    I was thinking we cap the # of diagnostics to show

    Are your diagnostics huge? Or would that work

  5. self-assigned this
    on Dec 8, 2025
  6. dan-kirberger commented on Dec 8, 2025

    @dan-kirberger
    Author

    I'll have to tinker to get it to show up again, i think what i saw was hundreds of individual files were flagged with various compiler issues because the java LSP didnt understand some annotations. I'm not 100% sure how how that was represented in the data model in write.ts. I'll tinker later with a local debug build perhaps.

  7. rekram1-node commented on Dec 8, 2025

    @rekram1-node
    Contributor

    Sounds good, I think normally each diagnostic isn't insanely big and we can just grab the top 20 or so (or just the highest severity ones). And that should do it.

    Happy to do that for you we talked about it internally once but forgot about it

  8. remorses commented on Dec 13, 2025

    @remorses
    Contributor

    Opened a PR to fix this issue: #5480

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 working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions