Repository navigation
fix(ai): report a failed LLM runtime load on the page - #6827
Merged
Merged
Conversation
Report a failed LLM runtime load on the AI page instead of a toast only. useLlmRuntime handed the failure to onError and left config null, so the page kept none of it: the composer's not-ready banner, its provider status and its send guard all key off llmConfig, which meant a runtime that could not be read looked exactly like one that was never configured - a disabled send button with no explanation and no retry. The hook now exposes the failure and the page renders it above the composer with the retry, the treatment its timeline load failure already gets (and the settings tab since apache#6550, the home page in apache#6082).
|
This pull request has been automatically closed because there has been no activity for 7 days. If you would like to continue working on this, please reopen the PR with updated changes. |
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.
Which Issue(s) This PR Fixes
Brief Description
A failed LLM runtime load on
/aiwas a toast and nothing else:useLlmRuntimereported it throughonError(web/src/pages/ai/hooks/useLlmRuntime.ts:123-127) and leftconfignull, while every explanation the composer has — the not-ready banner (Composer.tsx:314), the provider status and its tag (:417,:427) — is behindllmConfig. Sending needsllmReady(Composer.tsx:254), so after the toast faded the page showed a dead send button with no reason and no retry.The hook now keeps the failure (
error: string | null, cleared by a successful load or when the runtime is disabled) and the page renders it above the composer as an error alert carrying the server's message plus a Retry that reloads the runtime — the treatment this page already gives its timeline load failure (index.tsx:189-205), the settings tab since #6550 (AiAssistantTab.tsx:171-172) and the home page in #6082.User-visible behaviour: an operator whose runtime could not be read is told so on the page and can retry, instead of being left with a disabled composer that cannot be told apart from an unconfigured provider.
How Did You Test This Change?
AiPage.test.tsxgains a case per failure shape (anErrorand a{}rejection, the pair the failed-timeline-load case already uses): the page must render the alert, keep the composer disabled, and clear the alert after Retry re-requests the runtime (getLlmConfigtwice,getLlmModelsonce).useLlmRuntime.test.tspins the hook state itself:errorcarries the failure message, the toast callback still fires, and a successfulreload()clears both the error andllmReady: false.The new tests fail without the fix:
That run is the branch with the two product files reverted (
git stash pushofuseLlmRuntime.tsandindex.tsx) and the new cases kept: nothing announces the failure, so the page's only alert is missing and the hook exposes no state for it.Other consumers
index.tsx:83) is kept: it announces the failure when it happens, the new banner is what stays on the page. Both carry the page's existingai.runtimeLoadFailedstring, so the two cannot disagree.AiAssistantTab.tsx:171-172, fix(settings): report a failed AI configuration load instead of an empty form #6550) and the home page (fix(home): report a failed assistant config load instead of a dead input #6082) are the other two surfaces of this failure and are already handled there; they use thellm.loadFailedwording instead. Those files are outside this change, and unifying the two strings is a translation-table change, not this fix.useLlmRuntime's other state and behaviour are unchanged: the monotonic request id still drops a superseded response (including a failed one, which is whyerroris only set for the current request), andreload()is still the sameload.web/src/i18n/.Checklist
feat:/fix:/refactor:/chore:/docs:/perf:)...Testweb/src/i18n/mvn testruns the ArchUnit checks)docs// in-app help)