Frun1na opened a new issue, #4632:
URL: https://github.com/apache/rocketmq-dashboard/issues/4632

   ### Bug Description
   
   `useLlmRuntime.load` (web/src/pages/ai/hooks/useLlmRuntime.ts) has no 
staleness guard. When `enabled` flips to `false` while a load is in flight — 
e.g. mock mode is toggled, or an admin logs out into a reader account — the 
hook clears the state synchronously, but the already-in-flight 
`getLlmConfig`/`getLlmModels` responses still resolve afterwards and write 
`config`, `modelOptions` and `selectedModel` back. `llmReady` then comes back 
`true`, so the AI page offers sending on a runtime the hook's own contract says 
should show "no configuration visible". Overlapping `reload()` calls can 
likewise finish out of order and leave stale data.
   
   ### Steps to Reproduce
   
   1. Open the AI page with `enabled = true` so a runtime load starts (the 
`/llm/config` + `/llm/models` requests are in flight).
   2. Before those requests resolve, flip the runtime to disabled (mock mode, 
or downgrade the account).
   3. When the in-flight requests resolve, 
`config`/`modelOptions`/`selectedModel` are repopulated and `llmReady` becomes 
`true` although `enabled` is `false`.
   
   ### Expected Behavior
   
   A response from a superseded load never lands; the disabled runtime stays 
cleared and `llmReady` stays `false`.
   
   ### Environment
   
   - `rocketmq-studio` branch web UI
   - Reproduced with a unit test (`useLlmRuntime.test.ts`) in PR #4631
   
   Proposed fix: #4631
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to