oscerd opened a new pull request, #26081: URL: https://github.com/apache/camel/pull/26081
## Issue [CAMEL-24613](https://issues.apache.org/jira/browse/CAMEL-24613) ## Problem With `allowMixed(false)` and `allowedLanguages={ENGLISH}`, plain English is falsely rejected as "Mixed language content is not allowed." The `ENGLISH` and `LATIN_SCRIPT` enum patterns overlap (ASCII letters match both), so plain English is detected as **both** `ENGLISH` and `LATIN_SCRIPT`; the mixed-content check then treats `LATIN_SCRIPT` as a foreign language (`!allowed && != ENGLISH`) and fails. ## Fix Treat `LATIN_SCRIPT` as acceptable when `ENGLISH` is allowed (English is Latin script), so overlapping detection no longer triggers a false mixed-content rejection. ## Scope note This issue originally also bundled adding a guardrail-interface check to `AgentConfiguration.parseGuardrailClasses`. That was **withdrawn**: the method is an intentionally lenient class loader (its Javadoc documents loading arbitrary class names, and six existing tests exercise it with non-guardrail classes such as `java.lang.String`), and langchain4j validates guardrail types downstream. Adding the check would break that documented contract. ## Testing - New `allowMixedFalseWithEnglishAllowsPlainEnglish` asserts plain English passes with `allowMixed(false)` and `ENGLISH` allowed; verified it fails against the unpatched code. All existing `LanguageGuardrailTest` cases still pass. - `mvn -Psourcecheck validate` green. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
