Claus Ibsen created CAMEL-25899:
-----------------------------------
Summary: camel-jbang - AI tools: the reload output of a write
keeps the hint of a failure, and a write of a script the routes load waits for
the reload
Key: CAMEL-25899
URL: https://issues.apache.org/jira/browse/CAMEL-25899
Project: Camel
Issue Type: Improvement
Components: camel-jbang
Reporter: Claus Ibsen
Fix For: 4.24.0
Two gaps in what the write tools of the camel-jbang AI tools (the
camel-jbang-mcp server and camel ask) report after a dev-mode reload. Both were
seen in a night of benchmark runs against a local model.
*1. The hint of a failed exchange is cut off*
After a write, the answer includes what the routes logged after the reload,
each line cut at 400 characters. The line of a failed exchange starts with some
250 characters of error-handler text, and the hint Camel adds comes late in the
exception message:
{noformat}
Failed delivery for (MessageId: 7188B2FCF80AE47-000000000000001B on ExchangeId:
7188B2FCF80AE47-000000000000001B) at incoming-orders[log14]
enrich-and-dedupe.camel.yaml:42. Exhausted after delivery attempt: 1 caught:
org.apache.camel.language.bean.RuntimeBeanExpressionException: ... (the value
is the file as read (a GenericFile), not its data: unmarshal it first, ...)
{noformat}
The line is 831 characters, and the hint starts at about character 544, so the
agent never saw it in 119 writes. Only camel_get_log showed it.
Fix: a WARN or ERROR line is compacted. The message ids and attempt count of
the error handler go, and so do the exchange dumps, the packages of exception
classes, and long bean dumps. A WARN or ERROR line may then be 800 characters.
The line above becomes "ERROR Failed at incoming-orders[log14]
enrich-and-dedupe.camel.yaml:42: RuntimeBeanExpressionException: ... (the value
is the file as read ...)", with the whole hint.
*2. A write of a script the routes load is answered at once*
Writing a Groovy script that a route loads (setBody with groovy:
resource:file:mapping.groovy) answered in 3 ms: "An integration running the
file in dev mode reloads it now". Dev mode does reload the routes after the
change, but the agent read the log and the errors before the reload, saw none,
and said the step was done.
Fix: a write of a script or template the routes load (.groovy, .js, .py, .ftl,
.vm, .mustache, .jslt, .jsonata) waits for the reload, as a route write does.
It reports the outcome and what the routes logged after it: "The running
integration reloaded its routes, which load the file. After the reload it
logged: ERROR Failed at mapping[setBody4] mapping.camel.yaml:14:
NullPointerException: Cannot get property 'id' on null object".
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)