{"record":{"id":"34720d487c43b72d","repo":"Hmbown/CodeWhale","slug":"codewhale-terminal-receipt-was-not-resolved","errorCode":null,"errorMessage":"Codewhale terminal receipt was not resolved","messagePattern":"Codewhale terminal receipt was not resolved","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"integrations/verifiers-codewhale/codewhale_harness/harness.py","lineNumber":240,"sourceCode":"\n        result = await runtime.run_program(argv, env)\n        if result.exit_code == 0:\n            receipt = _parse_stream_receipt(result.stdout)\n            terminal = receipt[\"terminal\"]\n            if terminal.get(\"provider\") != \"openai\":\n                raise RuntimeError(\"Codewhale terminal receipt did not use provider openai\")\n            if terminal.get(\"model\") != ctx.model:\n                raise RuntimeError(\"Codewhale terminal receipt model did not match rollout\")\n            if terminal.get(\"approval_posture\") != \"auto_tools\":\n                raise RuntimeError(\"Codewhale terminal receipt did not confirm auto tools\")\n            if terminal.get(\"sandbox_posture\") != sandbox:\n                raise RuntimeError(\"Codewhale terminal receipt sandbox did not match launch\")\n            if receipt[\"events\"].get(\"error\", 0) != 0:\n                raise RuntimeError(\"Codewhale successful run contained an error event\")\n            if terminal.get(\"status\") != \"completed\":\n                raise RuntimeError(\"Codewhale terminal receipt did not report completion\")\n            if terminal.get(\"termination_reason\") != \"resolved\":\n                raise RuntimeError(\"Codewhale terminal receipt was not resolved\")\n            trace.info[\"codewhale\"] = receipt\n        return result\n\n\ndef _has_version(output: str, version: str) -> bool:\n    return (\n        re.search(\n            rf\"(?<![0-9A-Za-z.+-]){re.escape(version)}(?![0-9A-Za-z.+-])\",\n            output,\n        )\n        is not None\n    )\n\n\ndef _bounded_terminal(meta: dict[str, Any]) -> dict[str, Any]:\n    terminal: dict[str, Any] = {}\n    for key in _TERMINAL_FIELDS:\n        if key not in meta or meta[key] is None:","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/integrations/verifiers-codewhale/codewhale_harness/harness.py#L222-L258","documentation":"termination_reason must be 'resolved', meaning the model actually finished the task. Combined with the status='completed' check it separates clean completion from budget-limited stops: runs that hit the --max-turns ceiling typically end 'completed' but not 'resolved'.","triggerScenarios":"max_turns set too low so the run ends at the cap; the model abandoning or looping until budget exhaustion; facades hard-coding another reason or omitting the field.","commonSituations":"Long-horizon tasks exceeding an inherited turn budget; eval configs copied from short-task benchmarks; facade placeholders like 'done' or 'stop'.","solutions":["Raise or remove max_turns so the model can reach a resolved state","Adjust task prompts so the model concludes instead of iterating","Have facades emit termination_reason='resolved' only when work truly finished"],"exampleFix":"# before\nconfig = CodewhaleHarnessConfig(version='0.9.1', max_turns=5)\n# after\nconfig = CodewhaleHarnessConfig(version='0.9.1', max_turns=None)","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = await harness.launch(ctx, trace, runtime, endpoint, secret, mcp_urls)\nexcept RuntimeError as e:\n    if 'was not resolved' in str(e) and config.max_turns:\n        config = config.model_copy(update={'max_turns': None})  # fall back to unlimited and rerun\n        result = await harness.launch(ctx, trace, runtime, endpoint, secret, mcp_urls)\n    else:\n        raise","preventionTips":["Size max_turns to the task horizon; prefer None when measuring raw capability","Prompt models to conclude explicitly","Track termination_reason distribution to spot budget clipping early"],"tags":["receipt","integration","termination","harness"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}