fix: decouple no-config startup and fail fast on AI launch readiness - #1696
Draft
wenyt (wenytang-ms) wants to merge 2 commits into
Draft
wenyt (wenytang-ms) wants to merge 2 commits into
wenyt (wenytang-ms) wants to merge 2 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
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
Follow-up to #1690: keep optional No-Config Debug preparation off the core Run/Debug activation path, and make AI launch readiness fail fast instead of waiting up to 60 seconds.
Core Java configuration/adapter providers and commands are registered first. No-Config terminal preparation remains an owned, eager background task. The AI launch entry is registered immediately when the Java extension and Language Model API are available; its existing
when: javaLSReadyvisibility condition is unchanged.AI readiness contract
The launch tool observes the Java extension's
api.serverReady()in the background and checks a synchronous snapshot of both Java readiness and No-Config terminal preparation on invocation. An active extension orserverMode: Standardalone is not treated as proof that JDT LS is ready.JAVA_NOT_READYNO_CONFIG_NOT_READYJAVA_INIT_FAILEDNO_CONFIG_INIT_FAILEDNO_CONFIG_DISABLEDNO_CONFIG_DISPOSED/CANCELLEDThese responses are returned without a readiness wait, launch-input access, launch-time Java probing, launch telemetry, builds, terminal changes, or stopping an existing session. There is no per-invocation readiness timer or launch queue. Becoming ready does not replay a refused invocation: the caller must make a new request.
AI guidance and the tool description explicitly distinguish startup prerequisites from project-code errors. Agents should report the prerequisite or continue independent work, not poll the launch tool, diagnose output from an older terminal, or bypass readiness with a terminal launch. Existing-session AI tools remain independently registered.
Lifecycle and compatibility
waitUntilReady()with a synchronous No-Config state snapshot while retaining the shared terminal-initialization result and immediate disposal ownership.serverReady()stays pending, and ignore late completion after disposal.getJavaExtensionAPI()helper's async-Promise-executor bug so activation rejection propagates. Caller cancellation only stops that caller's wait, and cancellation listeners are released.JAVA_HOME->VSCODE_JAVA_EXEC->PATH), Java-discovery fallback, and existing script-permission fallback.Activation completing still does not guarantee that No-Config terminal preparation is complete. Early terminals may need to be recreated; they are not automatically repaired or closed.
Startup stale-file reconciliation, the file-based endpoint protocol, and an AI
launch.jsonfallback remain outside this PR. This does not claim to fix the previously discussed startup cleanup race.Validation
npm ci; no dependency versions or lockfile changes.npm run compileand targeted TSLint on all changed TypeScript files.serverReady(), and endpoint-directory creation pending. Core providers/commands and all 10 AI tools register and activation completes. Direct calls returnJAVA_NOT_READY,JAVA_INIT_FAILED,NO_CONFIG_NOT_READY, orCANCELLEDwithin the probe deadline without reading inputs. After prerequisites complete, a fresh invocation enters the existing launch flow; earlier refusals are not replayed.The tests/probe stub Java-extension behavior and AI-tool registration. The probe cancels before a real launch; no real JVM attach or NixOS end-to-end coverage is claimed.
Related to #1689.