davsclaus opened a new pull request, #26750: URL: https://github.com/apache/camel/pull/26750
Fixes https://issues.apache.org/jira/browse/CAMEL-24909 (part of CAMEL-24886) `camel_write_file` takes the complete content of a file, so adding one step to a route means re-emitting every line of it. In the camel-jbang-mcp stepwise benchmark that is where the local model breaks: the connect/http-client example ships ```yaml expression: "$[?(@.sku == '${header.sku}')]" ``` in one route, and the step asks for a split in **another** route of the same file. In 9 of 9 attempts the model wrote that line back with a doubled closing quote, 30 refused writes in three runs, and it read the validator's message correctly each time ("I'm still writing it with two double quotes at the end") before emitting the same bytes again. Where it writes the same expression fresh instead of copying it, in connect/stock-api, it gets it right. So the missing piece is a targeted edit, which every coding agent has: ``` camel_edit_file(directory, file, find, replace) -> {"status":"edited","editedAtLine":66,"replacedLines":2,"lines":69,"reload":{...}} {"status":"not-found","message":"... read it with camel_get_files and copy the lines exactly ..."} {"status":"ambiguous","occurrences":2,"message":"... include the lines around it ..."} {"status":"invalid","errors":[...],"message":"The file was not changed ..."} ``` The find text must occur exactly once, the result goes through the same validation and the same reload reporting as a write (CAMEL-24859), and nothing is written when it does not validate. In the shared authoring set, so the MCP server, the camel-jbang views and the agent REPL all get it; core, since this is the tool a local model needs most. Tests: `AuthoringToolsEditTest` (the edit leaves the rest of the file untouched, not found, ambiguous, invalid result, missing file). 245 ai tests, 410 MCP tests and 1383 views tests pass. The full prefix budget goes from 9300 to 9450 with the reason in the test; the core set stays at ~4.6k against its 5k budget. Documented in the MCP tool table and the upgrade guide. Verified live through the MCP server on the very file that broke the model: the edit lands, and the jsonpath line is untouched. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj -- 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]
