tju-yxq opened a new issue, #2538: URL: https://github.com/apache/rocketmq-dashboard/issues/2538
## Problem The AI endpoints currently accept user-controlled messages, command context, tool input, model selectors, and conversation identifiers without a shared size budget. These values are later serialized into provider requests or passed to a CLI process. The OpenAI-compatible client already caps non-streaming response bodies and streaming error bodies at 5 MiB, but a successful SSE response uses an unbounded `InputStream`. A provider can therefore keep sending data beyond the configured response budget, including a single line without an SSE delimiter. This makes the successful streaming path inconsistent with the other provider and CLI response paths, and allows request or response payloads to consume substantially more memory than the operation needs. ## Expected behavior - Reject oversized chat, command, context, tool, model, selector, and identifier fields before invoking a provider or registered tool. - Measure text limits in UTF-8 bytes, matching the encoding used for HTTP bodies and CLI arguments. - Apply the existing provider response-body budget to the total successful SSE stream as well as non-streaming and error responses. - Return stable 400/502 error codes so callers can distinguish oversized requests from oversized provider responses. - Keep existing payloads within the limits unchanged. ## Verification scope Tests should cover multibyte request boundaries, rejection before gateway/tool/CLI execution, configured-model validation, and an oversized successful SSE response. The full backend suite should remain green. -- 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]
