davsclaus opened a new pull request, #29452: URL: https://github.com/apache/camel/pull/29452
A local model sometimes sends the same refused file again and again, even when the refusal gives the exact lines to write. In r28 to r30 of the local-model benchmark (qwen3.6, 19 rounds), 13 of the 14 step runs with 4 or more such sends failed, and all 9 runs with 8 or more failed. Repairs per mistake (CAMEL-25532, CAMEL-26730) helped, but each time the loop moved to the next mistake. contracts-rest-code-first step 1 looped on a concatenation and an extra quote in r28, on the literal `\n` in r29, and on a jsonpath with `[]` in r30 (15 times in two runs). **What changes** - When the write tool refuses the same content of a file for the third time in a row, it makes the fixes that the refusals gave as exact text. There are two forms: `Write lines A-B as:` followed by the lines, and `write the line as <text>` (indentation kept, same key, same list item). It then repairs the shapes with one reading, validates the result, and writes the file only when no problem is left. - The answer lists what changed and tells the model to read the file before the next edit. - A problem without exact text has to be gone after the fixes. Otherwise nothing is written and the refusal is as before. - The first two identical refusals are unchanged, so the model always gets two chances to make its own fix. - Not for Citrus tests. The edit tool gets it too, because an edit is checked as the content it gives. - The jsonpath message for `[]` and the message for an unclosed double quote now end with the line to write, so the write tool can apply them. **Tests** - New `RefusalFixesTest` (the two forms, and when no fix is made) and `AuthoringToolsRefusalFixesTest` (the third write, the edit tool, the count restarting, a problem without text keeping the write refused). - Run locally: camel-yaml-dsl-validator 358 tests, and the camel-jbang-core `ai` package (993 tests, 0 failures, 1 skipped). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016Y4dDi5iQNgtHrDdz2NpwF -- 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]
