Frun1na opened a new issue, #6794: URL: https://github.com/apache/rocketmq-dashboard/issues/6794
### Before Creating the Bug Report - [x] I have searched the [open issues](https://github.com/apache/rocketmq-dashboard/issues) of this repository and believe that this is not a duplicate. - [x] This is a defect in RocketMQ Studio, not a usage question and not a defect in another Apache RocketMQ repository. - [x] I can reproduce this on the current `rocketmq-studio` branch, or I have stated the exact version I am running below. ### Studio Version ``` branch: rocketmq-studio git commit id: a92c2314 deployed as: reproduced by unit tests against that commit ``` ### Runtime Environment ``` OS: Ubuntu on WSL2 (test host) MySQL: not applicable — the defect is a validation gap: the value is stored in the settings JSON and then copied into VARCHAR(128) columns, where the row is rejected browser: not applicable — reproduced with stubbed repositories and the DDL ``` ### Connected RocketMQ Cluster ``` not applicable — no cluster is contacted; the AI conversation record is a local table ``` ### Describe the Bug `rmq_ai_conversation.model` and `rmq_ai_run.model` are `VARCHAR(128)` (`server/src/main/resources/db/schema.sql:459`, `:479`) and store the configured LLM model verbatim — `AiConversationService.create` does `conversation.setModel(config.getModel().trim())` (`AiConversationService.java:175`) and `AiRunService` snapshots the resolved id into the run row (`AiRunService.java:182`, `:473`). The two endpoints that accept that id never bound it: - `GeneralSettingsUpdateDTO.model` carries only `@NotBlank` (`GeneralSettingsUpdateDTO.java:55`). - `LlmConfigService.validate` checks the API base, `maxTokens` and the temperature, but not the model (`LlmConfigService.java:181-213`); `POST /api/llm/config` is not bean-validated at all (`LlmController.java:40-41`). So a model id of 129 characters or more saves with `200` and then makes the conversation's first request fail inside the insert: MySQL rejects the row ("Data too long for column 'model'"), the `DataIntegrityViolationException` has no handler and falls through to the generic one (`GlobalExceptionHandler.java:108-112`), and the API answers **500 Internal Server Error**. The AI settings page builds its model list from the configured gateway's `/models` response (`AiAssistantTab.tsx` `buildModelOptions(provider, remoteModels, ...)`), so a gateway that reports a long id offers it in the console; the REST contract accepts one directly. Note the per-run override is already bounded to the same 128 characters (`AiMessageDTO.java:45`), so the bound is this codebase's own rule for the field — only the *configured* value is unchecked. ### Steps to Reproduce 1. Store a model longer than the columns: `POST /api/llm/config` with `{"provider": "openai", "apiKey": "sk-...", "apiBase": "https://api.openai.com/v1", "model": "<129 characters>", "maxTokens": 4096, "temperature": 0.7, "enabled": true}` — answered `200` (the same value can be stored through `POST /api/settings/general/save`). 2. Create a conversation: `POST /api/ai/conversations` → `500 Internal Server Error`; no row is created, so every retry fails the same way. 3. Alternatively send the first message of an existing conversation whose stored model is empty: the run's insert fails the same way. ### What Did You Expect to See? The config endpoints reject an id the record columns cannot store with a `400` naming the field (at most 128 characters), and the conversation/run writes refuse an over-long *stored* value with a `400` instead of letting the database answer `500`. ### What Did You See Instead? The configuration is accepted, and the first message of the conversation answers `500 Internal Server Error` — the operator sees an internal error instead of "this model id does not fit the AI records". ### Additional Context A fix with regression tests follows in a pull request: the id is bounded where it is written (settings DTO and LLM config validation) and where it is copied into a record (conversation create and run admission). All four new tests fail without the change. ### Are You Willing to Submit a Pull Request? - [x] Yes, I am willing to submit a pull request. -- 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]
