[ 
https://issues.apache.org/jira/browse/CAMEL-27146?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-27146.
---------------------------------
    Resolution: Fixed

Fixed by https://github.com/apache/camel/pull/30318 (merged as 2a17afc161e5).

_Claude Code on behalf of davsclaus_

> camel-jbang - the AI write check for a returned resource: text reads only the 
> script, not the other keys of the language
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27146
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27146
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jbang
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> The write tools of the camel-jbang-mcp server (camel_write_file and 
> camel_edit_file) refuse a route where a script language, such as groovy, 
> returns a text that starts with resource: (CAMEL-24882). The message says 
> that the script returns the text, not the file. It says to add 
> resolveResource: true and to return the name without a scheme (CAMEL-25982).
> The check reads every line under the language key, not only the script. So a 
> resource: value under another key looks like a script that returns it. For 
> example, a model writes the wrong key resource:
> {code:yaml}
> - setBody:
>     expression:
>       groovy:
>         resource: "resource:file:shipment-mapping.groovy"
> {code}
> The refusal has two messages:
> * The first is right: "the groovy text goes in expression:, write groovy: 
> {expression: "resource:file:shipment-mapping.groovy"}".
> * The second is wrong: "the script returns the text 
> 'resource:file:shipment-mapping.groovy', not the file ... Add 
> resolveResource: true under groovy: and return the name without a scheme". 
> There is no script here.
> The model follows the second message. It writes expression: 
> "shipment-mapping.groovy" with resolveResource: true. Groovy then runs the 
> file name as code, and the route fails with MissingPropertyException (No such 
> property: shipment).
> In the local-model benchmark (r30 to r35, Nov 8-18 2026), 31 of the 34 
> refusals with this message were for a wrong key under groovy (resource 28 
> times, resourceUri 3 times). Only 3 were for a script that returns the text. 
> In the last night (r35), the model wrote the file name as the script in 3 of 
> 7 runs of that step, and the step failed on the errors.
> The flow form that the first message gives, groovy: {expression: 
> "resource:file:shipment-mapping.groovy"}, would get the same wrong message: 
> the check reads the whole flow mapping as the script.
> Fix: the check reads only the script. That is the value of the language key, 
> or the value of its expression: key (also a block scalar, or an entry of a 
> flow mapping). Other keys are for the schema check.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to