perf: tune Java LSP tool selection guidance#1020
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tunes the Java LSP Copilot tools’ behavior and guidance to reduce wasted model turns and improve routing based on telemetry (primarily by improving findSymbol miss handling, distinguishing indexing vs true empty results, and tightening “don’t guess paths” guidance).
Changes:
- Added a server-side one-time normalized retry for
lsp_java_findSymbol(and telemetry fieldretried) to reduce repeated tool chaining on misses. - Split “indexing in progress” from “no match / empty provider” for both
findSymbolandgetFileStructure, and improvedfileNotFoundresponses with actionable hints. - Updated tool guidance in
package.jsonand synced skill/instrument docs to discourage repeated calls and path guessing.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/copilot/tools/javaContextTools.ts | Adds normalized retry, indexing-vs-empty distinction, improved payloads, and extra result fields/telemetry. |
| resources/skills/java-lsp-tools/SKILL.md | Updates guidance and fallback behavior for Java LSP tools. |
| resources/instruments/javaLspContext.instructions.md | Updates Java-file instructions for tool loading and fallback behavior. |
| package.json | Tightens modelDescription for tool picker routing; adds UI metadata (userDescription, tags). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
chagong
previously approved these changes
May 29, 2026
chagong
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tune the Java LSP language model tools (
lsp_java_findSymbol,lsp_java_getFileStructure) based on 0.27.4 telemetry. Reduces wasted model turns from empty results and guessed paths, and clarifies tool routing.Motivation (from 0.27.4 telemetry)
findSymbolempty rate ~23%, dominated byworkspaceSymbolNoMatch(1,424 calls / 415 users).getFileStructureerror rate ~7.5%, dominated byfileNotFound(207 calls / 70 users) — mostly the model guessing paths.readFile → findSymbol → findSymbol(~18%) andtool_search → findSymbol → findSymbol(~9%). The model retriesfindSymbolitself instead of moving togetFileStructure/ a precisereadFile.Changes
src/copilot/tools/javaContextTools.tsfindSymbol: on a first miss, retry once with a normalized identifier (strip package qualifiercom.foo.Bar→Bar, genericsList<String>→List, and method parensfoo()→foo). Moves the retry loop out of the model. Adds aretriedtelemetry field.languageServerApiManager.isFullyReady():findSymbolreportsindexingInProgressvsworkspaceSymbolNoMatch;getFileStructurereportsindexingInProgressvsdocumentSymbolProviderEmpty. The indexing case tells the model to retry shortly / fall back to grep.fileNotFoundnow returns an actionable hint ("calllsp_java_findSymbolto get the exact path; do not guess") instead of a dead end.package.json— rewrote and tightened both tools'modelDescription:findSymbol: prefer over grep/file/semantic search; do not repeat on relevant results; tool retries internally, so on empty do not re-search (retry once only if it reports indexing, otherwise use generic search).getFileStructure: for known files only, do not guess paths, usefindSymbolfor workspace search, do not re-call the same file.userDescriptionandtags(UI / tool-picker only; not part of model context).resources/skills/java-lsp-tools/SKILL.mdandresources/instruments/javaLspContext.instructions.md— synced fallback guidance:findSymbolalready retries internally, don't re-issue the same search; retry once only if indexing, otherwise fall back to grep; onfileNotFound, usefindSymbolfirst.Validation
tsc -p . --noEmitpasses; tslint passes;package.jsonis valid JSON.Follow-up
indexingInProgresssplit andretriedhit rate (Q3), and whetherfindSymbol → findSymbolchaining drops (Q9d).