Open kgilpin opened 2 weeks ago
Title: Automatically Correct Mis-Emitted XML Tags in Claude's Change Output
Problem:
Claude frequently produces errors in the XML output of code changes, specifically by mis-emitting the closing tag </modified>
as </original>
. This causes the parser to fail when encountering the change, as the expected XML structure is violated. These errors particularly occur in change sections that use <original>
and <modified>
tags to denote changes in code files. The issue needs automatic correction when detected.
Analysis:
The root cause of this problem is likely a bug in the process that transforms and writes the change information into XML format, which mistakenly uses </original>
instead of </modified>
to close a modified
section. XML parsers rely heavily on correctly paired tags to understand and navigate documents, and such mispairings lead to parsing errors. Automated recognition and correction of this issue would involve verifying the paired nature of these tags when a change section is built or outputted and automatically substituting </original>
with </modified>
where necessary. This can be accomplished by post-processing the XML output to identify and correct incorrectly paired tags.
Proposed Changes:
Change in Output Generation Logic:
Post-Processing Functionality:
</original>
tag follows a <modified>
opening tag.</original>
tags with </modified>
to correct the structure.Integration and Testing:
</original>
tag is wrongly placed. These tests should validate that the error is detected and corrected appropriately.By addressing the tag mismatch issue through both preventive measures in output generation and corrective measures in post-processing, the fault in the output XML can be systematically resolved.
https://github.com/getappmap/navie-benchmark/actions/runs/11614957222/job/32344372220
This is a surprisingly common error, in which the closing
</modified>
tag is mis-emitted as an</original>
tag.We should fix these up automatically when this condition is detected.