davsclaus opened a new pull request, #27317: URL: https://github.com/apache/camel/pull/27317
[CAMEL-25296](https://issues.apache.org/jira/browse/CAMEL-25296) `camel_get_log` (camel-jbang-core `LogFileReader`, used by camel-jbang-mcp and the AI tools of the camel-jbang views) returned each error with a `detail` block of up to 20 lines. For the error handler's "Failed delivery" record that block is the message history and the Java stack trace. Its first line already has what is needed: the route and node, the source location, and the exception with its message. `camel_get_errors` has the stack traces anyway. In the local-model benchmark, the circuit-breaker example's log is mostly such records. A tool result capped at 6,000 characters showed about three of them, so the model polled the log again and again, and in one run filled a 64k context. ### What changes Without `details`, which is the default: - **The stack-trace block is left out.** Only stack traces and message history are dropped; other multi-line text, such as a pretty-printed body, stays a `detail` block. - **The record keeps its first line and level**, so an error is still an ERROR with its exception. - **New fields on records that lost their trace:** - `detailLines`: how many lines were left out - `cause`: the exception, when the first line doesn't name it (the last `Caused by`) - `at`: the first frame of the user's own code, a bean, a processor or a script. It walks from the root cause up, because a `Caused by` section can end in `... N more` and miss that frame. JDK module and class-loader prefixes are stripped. - **A one-line `note`** in the result points to `details=true` and `camel_get_errors`, only when something was left out. Unchanged: - `filter` still searches the whole record, trace included. - `details: true` returns everything as before, and internal callers such as `ReloadOutcome` keep the full records. - The tool description is shorter than before, so the full tool set's prompt stays within `AiPanelPromptBudgetTest`'s budget. ### Tests - `LogFileReaderTest`, 8 new tests: - the real error handler record from the benchmark - a twice-wrapped NPE: `at` is the bean's line - a root cause cut short by `... N more`: `at` comes from the section above - a Groovy script frame - a pretty-printed body keeps its detail - the filter on a left-out trace - `details=true` unchanged - no internal fields leak - Module suites: camel-jbang-core 1451, camel-jbang-mcp 426, camel-jbang-plugin-tui 1715, all pass. - Live through the MCP server against a route whose supplier fails every second: 9 ERROR records took 3,569 characters instead of 24,002. Side finding, not changed here: the repeated-record folding of CAMEL-24911 never applies to error handler records, because their first line carries the unique MessageId. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m -- 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]
