Skip to content

Read a unified diff and a JSON object as a turn. - #364

Merged
YauhenBichel merged 3 commits into
mainfrom
feat/read-a-diff-as-a-patch
Sep 27, 2026
Merged

YauhenBichel merged 3 commits into
mainfrom
feat/read-a-diff-as-a-patch

Conversation

@YauhenBichel

Copy link
Copy Markdown
Owner

Traced on qwen2.5-coder:7b after #363's measurement: asked to fix a one-line bug, it answered Action: patch with a fenced unified diff, correct and complete, and heard "patch needs Find: or Append:" ten times in a row. On another run it answered every turn as a JSON object with an action key, once with single-quoted values, and parsed to nothing ten times. Format compliance, not reasoning, which is what the literature review said breaks small models.

Parser

  • A hunk's removed lines are the Find and its added lines the Replace, context trimmed so the Find is the changed lines; the path comes from the +++ header when no Path is given; an addition-only hunk is an Append. Explicit fields are left alone.
  • A JSON object with a known action is a turn, read with json first and Python literal syntax second (single quotes). An Action line still wins, and braces in prose are never a turn.

Eighteen parser tests. Full suite: 1126 tests, green.

Measured, same arm as #363 (7B, tiers 5 and 7, five passes, decision model), before and after:

worked hit the step limit mean steps
before (decide-model-7b) 11/30 18 6.5
after (diff-json-7b) 15/30 15 5.6

REAL, +4 outside a floor of 1: said-toolow 1/5 → 4/5, fix-offbyone 0/5 → 1/5. The ledger flags that every pass scored exactly 3; with two cases mechanical at 5/5 and the gain spread over two others, that is arithmetic, not a stuck decision, but it is noted. said-offbyone and said-wrongtax are still 0/5; tracing those next.

Record: docs/experiments/diff-json-7b.json. The write-up goes into the investigation note once #363 lands, to avoid a conflict on the same section.

Traced on a 7B: asked to fix a one-line bug, it answered 'Action: patch'
with a fenced unified diff, correct and complete, and heard 'patch needs
Find: or Append:' ten times in a row. On another run it answered every
turn as a JSON object with an action key, once with single-quoted
values, and parsed to nothing ten times. Format compliance, not
reasoning, which is what the literature says breaks small models.

A hunk's removed lines are the Find and its added lines the Replace,
context trimmed, the path from the +++ header when none is given; an
addition-only hunk is an Append. A JSON object with a known action is a
turn, read with json first and Python literal syntax second. An Action
line still wins, and braces in prose are never a turn.
The next traced run sent the diff with no Action line at all: file
headers, a hunk, the fix. Ten times, ten 'Could not parse'. A hunk with
removed or added lines and a path is a patch to that file.
@YauhenBichel
YauhenBichel merged commit 448212e into main Sep 27, 2026
19 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for merging the feature to read a unified diff and a JSON object as a turn, @YauhenBichel!

game

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