zjncs opened a new pull request, #7265:
URL: https://github.com/apache/rocketmq-dashboard/pull/7265
## Problem
The Studio API key is only the HTTP gateway's credential — CLI engines
(`claude-code`, `qoder`) authenticate through the subprocess environment, which
is exactly why `LlmConfigService.validate()` exempts them from the key
requirement (`:199-201`, `keyRequired = !"ollama".equals(provider) &&
ENGINE_HTTP.equalsIgnoreCase(engine)`). A CLI-engine config with a blank key
therefore **saves** and **tests** clean ("CLI is available").
But `fromGeneralSettings` (`:264`) computes the `enabled` flag engine-blind
via `requiresApiKey(provider)` (`:330-331`) — with a stray `!!` double negation
— so the same config comes back `enabled=false`, `isReady()` fails, and **every
chat message is refused** with `llm.config.incomplete`
(`AiRunService.java:183-186`). The operator gets contradictory signals: save
OK, test OK, chat hard-refused. `LlmConfigVO.isReady()`'s own comment
(`:65-67`) states CLI engines authenticate through the subprocess environment.
## Fix
Share one `requiresApiKey(provider, engine)` predicate between `validate()`
and `fromGeneralSettings()` (and remove the `!!`), so the exemption is defined
once and applied consistently.
## Verification
- New
`LlmConfigServiceTest.getConfigShouldTreatSavedCliEngineAsReadyWithoutApiKey`
(openai + claude-code + blank key → `isReady()` true) — RED first
(`enabled=false`). The existing http-engine-without-key cases still pass,
proving the exemption stays engine-scoped.
- GREEN: `mvn -Dtest='LlmConfigServiceTest,LlmConfigVOTest'
-Dspring.profiles.active=dev test` → 33/33; sanity `AiRunServiceTest` → 33/33.
Java verification: `mvn -Dtest='<classes>' -Dspring.profiles.active=dev test`
from `server/` with JDK 21 (the dev profile provides H2; a plain run needs
MySQL, pre-existing).
## Risk
None identified — an HTTP-engine config without a key stays not-ready,
exactly as before.
--
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]