ADFA-5403 | Fix LlmInferenceService resolution for Voice-to-Code - #93
ADFA-5403 | Fix LlmInferenceService resolution for Voice-to-Code#93jatezzz wants to merge 5 commits into
Conversation
…(ADFA-5403) context.services is a per-plugin registry that never holds it, so Voice-to-Code always inserted the raw transcript. Resolve per use, bound generation with a timeout, strip markdown fences, and target the open file's language, not Kotlin.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
hal-eisen-adfa
left a comment
There was a problem hiding this comment.
Automated review (Claude Code), high and medium findings only. Low-severity notes (duplicate fence stripper, LinkageError on SharedServices, no unit tests) are left out.
F09 (Medium) — line 52, outside the diff, so no inline comment is possible.
private var llmService: LlmInferenceService? = null is a plain non-volatile var, but this PR turns it into a lazily-populated cache. activate() writes it on the main thread; handleTranscript reads it from scope.launch on Dispatchers.IO. There is no happens-before edge, so the IO thread can keep seeing null and re-resolve on every transcript. recordingState in this same class is already @Volatile.
Resolve the LLM service through getPluginService as well, and drop the cached reference when AI Core unloads. Tune the generation request (system prompt, temperature, maxTokens) instead of scraping fences off the reply, size the timeout to that token budget, and await the future cancellably so plugin teardown unwinds it. Rewrite the fence stripper to handle a lead-in line, an unclosed fence and a one-line fenced reply. Guard logging against an uninitialized context during teardown.
|
@hal-eisen-adfa F09: fixed. |
hal-eisen-adfa
left a comment
There was a problem hiding this comment.
Second automated review pass (Claude Code, xhigh). All thirteen findings from the first pass are addressed in code and the plugin builds clean; thanks. Five new issues below, four of them in the code this round introduced.
F16 (the Speech-to-Text max_ide_version 26.30 vs ai-core min_ide_version 26.35 gap) is dropped — we do not enforce those ranges.
Restore IDLE state and the raw-transcript fallback when AI Core cancels the shared future, release listener/scope/service in deactivate(), and stop the fence stripper from inserting prose (F17) or eating real code (F18, F20).
Description
Updated
SpeechToTextPluginto resolve theLlmInferenceServicefrom the correct global registry. Previously, the plugin failed to find the service in the local context, causing Voice-to-Code to insert raw transcribed text instead of generated code. The service is now resolved fromSharedServicesfirst, with the localcontext.servicesused as a fallback. Resolution is dynamically retried on every use to account for parallel loading delays when the AI Core activates.Details
resolveLlmService()to cache successful lookups and retry upon failure.GENERATION_TIMEOUT_SECONDS) to prevent UI freezes.stripCodeFences()to remove markdown from the generated output so the editor receives raw code.Logto the plugin'scontext.logger.Screen_Recording_20260903_155612_Code.on.the.Go.mp4
Ticket
ADFA-5403
Parent: ADFA-5402