Claus Ibsen created CAMEL-25868:
-----------------------------------

             Summary: camel-jbang - AI tools: clearer answers for cut doc 
pages, old errors, consumed files and wrong status header names
                 Key: CAMEL-25868
                 URL: https://issues.apache.org/jira/browse/CAMEL-25868
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Five tool answers of the camel-jbang AI tools (the camel-jbang-mcp server and 
camel ask) misled a coding agent in a night of runs against a local model. Each 
one is small.

*1. A repeated camel_catalog_doc call says the page was "answered in full"*
>From the third identical call, {{RepeatedToolCalls}} answers with a note: "... 
>was already called with these same arguments 2 times in this session and 
>answered in full". A long page is cut at 16000 characters (for example 
>{{docPage=functions}} of the Simple language). The agent then believed the cut 
>page was the whole page, and did not ask for the section it needed.
Fix: the note no longer says "in full", and for camel_catalog_doc it says that 
a cut answer named the sections it left out, and that {{docPage=<section 
title>}} returns one of them.

*2. camel_get_errors returns errors from an earlier version of the routes*
The failed exchanges are kept until the integration restarts. After a change 
and a reload, the agent read the old errors as errors of its new routes, and 
changed routes that already worked.
Fix: errors that failed before the newest "Routes reloaded summary" in the log 
are marked {{"beforeLastReload": true}}, with a note. A margin of one second 
keeps a new route that fails at once unmarked.

*3. The reload outcome of a write shows only the first five log lines*
After a write, the tool answer includes what the routes logged after the 
reload, at most five lines. Errors after those lines were not shown (in the 
runs: three wireTap errors after five log lines).
Fix: the first three ERROR lines after the first five are kept, and a last line 
says how many lines were left out ("... 3 more lines: camel_get_log shows 
them").

*4. camel_get_files reports a data folder as empty when a file consumer read 
its files*
A file consumer moves each file it reads into {{.camel}} (unless noop=true). 
The listing skips hidden folders, so it answered "The directory has no files", 
and the agent did not see where the files went.
Fix: the .camel folders are counted ({{consumedFiles}}), and the message says 
so: "The directory has no files, but customers/.camel holds 2 files that a file 
consumer moved there after reading (noop=true leaves the files where they are)".

*5. A wrong HTTP status header name is not reported in a REST DSL route*
The model wrote {{setHeader}} with {{name: CamelHttpStatusCode}} (and once 
{{name: Exchange.HTTP_STATUS}}). The header check uses the header metadata of 
the components in the file, and the routes of a REST DSL use direct, which has 
none, so it checked nothing.
Fix: names such as CamelHttpStatusCode are reported in any route, with the 
right name (CamelHttpResponseCode, Exchange.HTTP_RESPONSE_CODE). A name written 
as {{Exchange.<constant>}} is fine, because Camel looks up the constant when it 
creates the route. When Exchange has no such constant, Camel fails the route 
("Constant field with name: HTTP_STATUS not found on Exchange.class"), so the 
check reports it before the route runs, with the right name or the closest 
constant. This covers the names of setHeader, setProperty, setVariable and the 
remove EIPs, which all look up the constant.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to