davsclaus opened a new pull request, #29391: URL: https://github.com/apache/camel/pull/29391
## Description [CAMEL-26721](https://issues.apache.org/jira/browse/CAMEL-26721): the "describe the chaos you want" input of S2-5 in the stage 2 order decided on [CAMEL-26607](https://issues.apache.org/jira/browse/CAMEL-26607?focusedCommentId=18140177&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-18140177). **Stacked on #29390** (CAMEL-26720, the check this PR uses), which is stacked on #29389, #29388, #29387 and #29386. Retarget this PR to `main` once those have merged.  ### The input - On the chaos screen, `d` ("describe with AI") opens an input for the chaos the user wants, such as "the order route should fail 5% of the time, or when the country is spain". The key is only there when the AI panel is. - Enter sends the request to the AI panel at once, because the user typed it and confirmed it (`MonitorContext.AskAi.askNow`, `AiPanel.askNow`). When the panel is busy, the question waits in its input. - The question (`ChaosAiPrompt.ofRequest`) has: - the request; - the routes, and the sends of each route; - the rules the integration has now; - the rule syntax in short, with `in=`, `when=`, "or is two rules", and "without `rate=` a rule fails every message it matches"; - the steps: check the rules, show each in plain words with what it hits, then add them. - The input sends nothing to the integration itself. ### The AI panel gets chaos tools A live try showed that the AI panel had no chaos tools. That was a deliberate choice on CAMEL-26608. Claus decided to add three, to the chaos tool group of the panel, while chaos is on: - `tui_chaos_check`: read-only. - `tui_chaos_add`: asks the user first. - `tui_chaos_change`: asks the user first. It keeps the id of the rule and gives it the next version, so the report keeps the old one. How they work: - They run the shared `chaos_check`, `chaos_add` and `chaos_change`, the same path as `camel ask` and the MCP server. - The confirm (`ToolConfirms.chaos`, shared with `camel ask`) now names the integration. When several rules come separated by `;`, it says "add 2 chaos rules to chaosdemo" and shows one rule per line. A `;` inside quotes does not separate rules. - Like the semantic tools, they are left out of the full tool set unless their group is loaded. So the prompt of an integration without chaos does not grow, and `AiPanelPromptBudgetTest` passes. - While the confirm is open, keys sent over MCP are refused. Only the user answers it. ### Live try The chaos demo ran with the jars of this stack, against a local model (qwen3.6:35b-mlx on Ollama). The request was "the order route should fail 5% of the time, or when the country is spain". | | Before the panel tools | After | |---|---|---| | Time | 76 s | 13 s | | Tool calls | 18 (looking around the TUI) | 1 (`tui_chaos_check`) | | Tokens | 214k | 14k | | Rules | right, but only in the answer | `route=orders error rate=0.05` and `route=orders error when="${header.country} == 'ES'"`, checked, then the add confirm | In one run the model also put `rate=0.05` on the Spain rule. The plain words in its answer showed it, and the line about rates in the prompt came from that run. ### Also in this PR - The help page of the chaos screen, the Chaos section of the TUI manual, and a screenshot are updated. - The `SourceSizeTest` limit of `CamelMonitor.java` goes from 2624 to 2632 lines. ## Tests - camel-jbang-plugin-tui: all 2343 tests pass. - `ChaosAiPromptTest` covers the question, the `d` key, and no `d` without the AI panel. - `AiPanelToolGroupsTest` covers the chaos group tools, on and off. - `McpFacadeConfirmTest` covers that add and change ask first, a rejected add sends nothing, and the check does not ask. - `AiPanelPromptBudgetTest` passes. - camel-jbang-core: `ToolConfirmsTest` (with several rules), `ToolRegistryTest` and `AskToolsTest` pass. _Claude Code on behalf of Claus Ibsen_ 🤖 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]
