Skip to content

Treat edit_file filler args as absent for mode selection - #535

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-6900-edit_file-filler-arg-rejections-cause-identical-retry-loops
Aug 23, 2026
Merged

Treat edit_file filler args as absent for mode selection#535
TheGreatAxios merged 2 commits into
mainfrom
cl-6900-edit_file-filler-arg-rejections-cause-identical-retry-loops

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Problem

Models pad the unused edit_file mode's fields with fillers — start_line: 0, end_line: 0, old_string: "". parseEditFileMode treated any present line field as a line-range signal, rejected the call as "both edit modes", and models retried the identical call up to 8x. Production traces: 76% of gpt-5.6-terra edit_file calls rejected this way.

Fix

  • Line fields that are null, non-integer, or < 1 count as absent for mode selection (0 is never a valid 1-based line); old_string: "" likewise counts as absent.
  • Real mixed-mode calls (non-empty old_string AND line fields >= 1) are still rejected (preserves CL-4399), but the error now echoes the received values and names exactly which fields to drop so a retry can differ.
  • The missing-mode and empty-old_string errors also state what was received.
  • Tests cover filler-0 lines + old_string -> substring mode, empty old_string + valid range -> line-range mode, and the new error texts. Also fixed pre-existing lint errors in the touched files (type -> interface, non-null assertions) that CI would surface once their lint-cache entries invalidate.

Fixes CL-6900

Models pad the unused mode's fields with fillers (old_string: "",
start_line: 0), which made parseEditFileMode see both edit modes and
reject the call; models then retried the identical call up to 8x
(76% of gpt-5.6-terra edit_file calls in production traces).

Mode selection now ignores fillers: line fields that are null,
non-integer, or < 1 count as absent, and so does an empty old_string.
A real mixed-mode call is still rejected (CL-4399), but the error now
echoes the received values and names the fields to drop so a retry
can differ, and the missing-mode error states what was received.
@linear-code

linear-code Bot commented Aug 23, 2026

Copy link
Copy Markdown

CL-6900

@TheGreatAxios
TheGreatAxios merged commit 9f55a70 into main Aug 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant