{"record":{"id":"28c31549d8335aff","repo":"Hmbown/CodeWhale","slug":"codewhale-terminal-receipt-did-not-report-completion","errorCode":null,"errorMessage":"Codewhale terminal receipt did not report completion","messagePattern":"Codewhale terminal receipt did not report completion","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"integrations/verifiers-codewhale/codewhale_harness/harness.py","lineNumber":238,"sourceCode":"            argv.extend([\"--append-system-prompt\", system])\n        argv.extend([\"--\", str(prompt or \"\")])\n\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] = {}","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/integrations/verifiers-codewhale/codewhale_harness/harness.py#L220-L256","documentation":"The harness runs Codewhale as a subprocess emitting stream-json and requires a terminal metadata receipt with status 'completed'. This RuntimeError means the binary exited 0 but its terminal receipt reported a different status (e.g. 'failed', 'aborted', 'incomplete'). The harness throws it so a run that didn't finish cleanly is never recorded as a passing rollout.","triggerScenarios":"launch() parsed a valid terminal receipt whose meta['status'] != 'completed' after a zero exit code — e.g. Codewhale hit an unrecoverable model/API failure it handles gracefully, max_turns was exhausted, or the agent ended its session without completing the task.","commonSituations":"Custom/preinstalled binary via binary_path emitting receipt fields the harness doesn't expect; endpoint returning errors the agent absorbs and stops early on; max_turns too low so the run ends before resolution; a version drift where the installed binary writes a new status vocabulary.","solutions":["Check trace.info['codewhale'] or rerun with the raw stdout logged to see the actual terminal status value","Inspect the model endpoint for failures during the rollout (timeouts, 4xx/5xx) that made Codewhale end with a non-completed status","Raise max_turns in CodewhaleHarnessConfig if runs are being cut off before completion","Pin the version/binary_path pair so the receipt vocabulary matches what the harness expects","Reproduce locally with the same argv (exec --auto --sandbox ... --output-format stream-json) to inspect the receipt"],"exampleFix":"# before\nconfig = CodewhaleHarnessConfig(model=..., max_turns=5)\n# after\nconfig = CodewhaleHarnessConfig(model=..., max_turns=50)","handlingStrategy":"validation","validationCode":"def validate_terminal(terminal: dict, model: str) -> None:\n    assert terminal.get(\"status\") == \"completed\", f\"status={terminal.get('status')!r}\"\n    assert terminal.get(\"termination_reason\") == \"resolved\"\n    assert terminal.get(\"model\") == model","typeGuard":"def is_completed(terminal: dict) -> bool:\n    return isinstance(terminal.get(\"status\"), str) and terminal[\"status\"] == \"completed\"","tryCatchPattern":"try:\n    result = await harness.launch(ctx, trace, runtime, endpoint, secret, mcp_urls)\nexcept RuntimeError as e:\n    if \"did not report completion\" in str(e):\n        logger.error(\"rollout incomplete: terminal=%s\", trace.info.get(\"codewhale\"))\n        mark_rollout_failed(trace)\n    raise","preventionTips":["Set a generous max_turns so runs are not cut off before completion","Monitor the model endpoint for errors during rollouts","Pin the exact Codewhale version the harness was validated against","Record trace.info['codewhale'] for every run to diagnose non-completed statuses"],"tags":["runtime","verification","agent"],"backgroundTag":"unexpected-response-shape","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}