{
  "licence": "https://creativecommons.org/licenses/by/4.0/",
  "credit": "Saulius Beconis, sbeconis.com",
  "page": "https://sbeconis.com/lab/coding-agent/",
  "url": "https://sbeconis.com/lab/coding-agent/agent-2026-10-07.json",
  "note": "Measurements and text are CC BY 4.0. Source data and quoted excerpts keep their own licences: see \"attribution\".",
  "lab": "LAB/003",
  "title": "Controlled coding agent",
  "date": "2026-10-07",
  "method": {
    "tasks": "QuixBugs (Lin et al., 2017, MIT): 40 Python programs with one-line bugs and tests; sandbox verified: all 40 buggy versions fail, all 40 reference fixes pass",
    "sandbox": "fresh temp copy per task, reference solutions never copied; tests offline (unshare -rn), clean env, 60 s timeout",
    "conditions": "A one-shot (no tools); B read_file + write_file (target only); C as B plus read tests + run_tests",
    "budget": "8 model turns, 2048 tokens per turn, 300 s per task",
    "model": "Qwen3-8B Q4_K_M, Qwen3-14B Q4_K_M; llama.cpp b11461 (CUDA 13.4) llama-server, OpenAI-compatible tool calls, thinking off, greedy",
    "prompts": {
      "one_shot": "The following Python program has a bug. Fix it. Return the complete corrected file in a single ```python code block and nothing else.\n\nFile {target}:\n```python\n{source}\n```",
      "agent_system": "You are a careful software engineer fixing a bug in a small Python program. The buggy file is {target}. You may only modify that file. {tests_line}Use the tools to inspect the code, write the corrected file (write_file replaces the whole file), {verify_line}When you are done, reply with one short sentence describing the fix and do not call any tool.",
      "harness_refusal_D": "Not done: the tests {have not been run since your last change | still fail}. Continue until run_tests passes."
    },
    "grading": "after the agent stops, the harness runs the same tests on the target file"
  },
  "environment": {
    "gpu": "RTX 4070 12 GB",
    "llama.cpp": "b11461 (CUDA 13.4)"
  },
  "headline": {
    "value": "8 → 0",
    "label": "coding-agent results wrongly reported as fixed, once passing tests rather than the model decide when a task is done (40 tasks)"
  },
  "tables": {
    "summary": {
      "caption": "40 QuixBugs programs, one bug each. Qwen3-8B Q4_K_M on one RTX 4070. Budget per task: 8 turns, 300 s.",
      "columns": [
        {
          "key": "rate",
          "label": "Fixed",
          "suffix": "%"
        },
        {
          "key": "wrong_fix",
          "label": "Wrong fix",
          "decimals": 0
        },
        {
          "key": "no_change",
          "label": "No change",
          "decimals": 0
        },
        {
          "key": "syntax_error",
          "label": "Broken file",
          "decimals": 0
        },
        {
          "key": "budget_exhausted",
          "label": "Out of budget",
          "decimals": 0
        },
        {
          "key": "steps",
          "label": "Turns (mean)",
          "decimals": 1
        },
        {
          "key": "tokens",
          "label": "Tokens (mean)",
          "decimals": 0
        },
        {
          "key": "wall",
          "label": "Time (median, s)",
          "decimals": 1
        }
      ],
      "rows": [
        {
          "label": "A · one-shot, no tools",
          "cells": {
            "rate": 62.5,
            "wrong_fix": 14,
            "no_change": 1,
            "syntax_error": 0,
            "budget_exhausted": 0,
            "steps": 1,
            "tokens": 435,
            "wall": 2.1
          },
          "highlight": false
        },
        {
          "label": "B · agent, cannot run tests",
          "cells": {
            "rate": 60,
            "wrong_fix": 15,
            "no_change": 1,
            "syntax_error": 0,
            "budget_exhausted": 0,
            "steps": 2.98,
            "tokens": 2052,
            "wall": 4.2
          },
          "highlight": false
        },
        {
          "label": "C · agent with test feedback",
          "cells": {
            "rate": 67.5,
            "wrong_fix": 8,
            "no_change": 0,
            "syntax_error": 0,
            "budget_exhausted": 5,
            "steps": 5.45,
            "tokens": 5761,
            "wall": 6.4
          },
          "highlight": true
        },
        {
          "label": "D · C, and only passing tests end the task",
          "cells": {
            "rate": 70,
            "wrong_fix": 0,
            "no_change": 0,
            "syntax_error": 0,
            "budget_exhausted": 12,
            "steps": 5.97,
            "tokens": 6547,
            "wall": 7
          },
          "highlight": false
        }
      ],
      "note": "Outcome columns are task counts out of 40"
    },
    "guardrails": {
      "caption": "What the agents tried that the sandbox refused, across all runs. The limits are enforced in code, not asked for in the prompt.",
      "columns": [
        {
          "key": "tests",
          "label": "Test runs",
          "decimals": 0
        },
        {
          "key": "bw",
          "label": "Blocked writes",
          "decimals": 0
        },
        {
          "key": "te",
          "label": "Attempts to edit tests",
          "decimals": 0
        },
        {
          "key": "br",
          "label": "Blocked reads",
          "decimals": 0
        },
        {
          "key": "err",
          "label": "Tool errors",
          "decimals": 0
        }
      ],
      "rows": [
        {
          "label": "Qwen3-8B Q4_K_M, B · agent, cannot run tests",
          "cells": {
            "tests": 0,
            "bw": 0,
            "te": 0,
            "br": 0,
            "err": 0
          }
        },
        {
          "label": "Qwen3-8B Q4_K_M, C · agent with test feedback",
          "cells": {
            "tests": 73,
            "bw": 0,
            "te": 0,
            "br": 0,
            "err": 0
          }
        },
        {
          "label": "Qwen3-8B Q4_K_M, D · C, and only passing tests end the task",
          "cells": {
            "tests": 82,
            "bw": 0,
            "te": 0,
            "br": 0,
            "err": 0
          }
        },
        {
          "label": "Qwen3-14B Q4_K_M, B · agent, cannot run tests",
          "cells": {
            "tests": 0,
            "bw": 0,
            "te": 0,
            "br": 0,
            "err": 0
          }
        },
        {
          "label": "Qwen3-14B Q4_K_M, C · agent with test feedback",
          "cells": {
            "tests": 48,
            "bw": 0,
            "te": 0,
            "br": 0,
            "err": 0
          }
        },
        {
          "label": "Qwen3-14B Q4_K_M, D · C, and only passing tests end the task",
          "cells": {
            "tests": 66,
            "bw": 0,
            "te": 0,
            "br": 0,
            "err": 0
          }
        }
      ]
    },
    "models": {
      "caption": "The same three conditions with a larger model.",
      "columns": [
        {
          "key": "A",
          "label": "A · one-shot",
          "suffix": "%"
        },
        {
          "key": "B",
          "label": "B · no tests",
          "suffix": "%"
        },
        {
          "key": "C",
          "label": "C · with tests",
          "suffix": "%"
        },
        {
          "key": "D",
          "label": "D · verified",
          "suffix": "%"
        }
      ],
      "rows": [
        {
          "label": "Qwen3-8B Q4_K_M",
          "cells": {
            "A": 62.5,
            "B": 60,
            "C": 67.5,
            "D": 70
          }
        },
        {
          "label": "Qwen3-14B Q4_K_M",
          "cells": {
            "A": 75,
            "B": 52.5,
            "C": 67.5,
            "D": 82.5
          }
        }
      ]
    }
  },
  "charts": {
    "pass": {
      "title": "Programs fixed, out of 40",
      "meta": "Graded by the same tests, offline, after the agent stops",
      "max": 100,
      "suffix": "%",
      "groups": [
        {
          "label": "Qwen3-8B Q4_K_M",
          "bars": [
            {
              "label": "A · one-shot, no tools",
              "value": 62.5,
              "highlight": false
            },
            {
              "label": "B · agent, cannot run tests",
              "value": 60,
              "highlight": false
            },
            {
              "label": "C · agent with test feedback",
              "value": 67.5,
              "highlight": true
            },
            {
              "label": "D · C, and only passing tests end the task",
              "value": 70,
              "highlight": false
            }
          ]
        },
        {
          "label": "Qwen3-14B Q4_K_M",
          "bars": [
            {
              "label": "A · one-shot, no tools",
              "value": 75,
              "highlight": false
            },
            {
              "label": "B · agent, cannot run tests",
              "value": 52.5,
              "highlight": false
            },
            {
              "label": "C · agent with test feedback",
              "value": 67.5,
              "highlight": true
            },
            {
              "label": "D · C, and only passing tests end the task",
              "value": 82.5,
              "highlight": false
            }
          ]
        }
      ]
    }
  },
  "examples": {
    "replay": {
      "title": "Replay: bitcount (condition C, 6 turns, 67.5 s)",
      "verdict": "correct",
      "fields": [
        {
          "label": "Turn 1 · agent",
          "text": "read_file python_programs/bitcount.py",
          "mono": true
        },
        {
          "label": "Turn 2 · agent",
          "text": "write_file python_programs/bitcount.py (287 characters)",
          "mono": true
        },
        {
          "label": "Turn 3 · agent",
          "text": "run_tests",
          "mono": true
        },
        {
          "label": "sandbox · run_tests",
          "text": "FAILED.\nTIMEOUT after 60s",
          "mono": true
        },
        {
          "label": "Turn 4 · agent",
          "text": "write_file python_programs/bitcount.py (287 characters)",
          "mono": true
        },
        {
          "label": "Turn 5 · agent",
          "text": "run_tests",
          "mono": true
        },
        {
          "label": "sandbox · run_tests",
          "text": "PASSED: all tests pass.\n.........                                                                [100%]\n9 passed in 0.01s",
          "mono": true
        },
        {
          "label": "Turn 6 · agent (done)",
          "text": "The fix involved changing the line `n ^= n - 1` to `n &= n - 1` to ensure the function efficiently counts the number of 1-bits in the binary representation of `n`. This optimization avoids the timeout issue and ensures correct behavior."
        },
        {
          "label": "Final change",
          "text": "--- a/python_programs/bitcount.py\n+++ b/python_programs/bitcount.py\n@@ -1,16 +1,13 @@\n-\n def bitcount(n):\n     count = 0\n     while n:\n-        n ^= n - 1\n+        n &= n - 1\n         count += 1\n     return count\n-\n \n \"\"\"\n Bitcount\n bitcount\n-\n \n Input:\n     n: a nonnegative int\n@@ -23,4 +20,4 @@\n     7\n     >>> bitcount(128)\n     1\n-\"\"\"\n+\"\"\"",
          "mono": true
        }
      ],
      "source": "Chosen by a fixed rule: the first task alphabetically where the agent passed after a failing test run. QuixBugs, MIT licence. File contents and full test output are in the trace file."
    }
  },
  "attribution": "QuixBugs benchmark (Lin, Koppel, Chen and Solar-Lezama, 2017), MIT licence."
}
