{"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/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/integrations/verifiers-codewhale/codewhale_harness/harness.py#L222-L258","documentation":"The harness requires the terminal receipt's termination_reason to be exactly 'resolved'. This RuntimeError fires when status was 'completed' but termination_reason was something else (e.g. 'max_turns', 'interrupted', 'user_exit'). The harness throws it because only 'resolved' proves the task actually finished, not merely that the process stopped cleanly.","triggerScenarios":"launch() got a zero exit code, a valid terminal receipt with status 'completed', but meta['termination_reason'] != 'resolved' — typically a run stopped by the --max-turns ceiling or an early agent self-exit.","commonSituations":"max_turns configured too low for the task; agent giving up / ending the conversation early; newer binary versions that changed termination_reason strings; ambiguous tasks that the model stops without resolving.","solutions":["Log or dump receipt['terminal']['termination_reason'] to see why the run ended","Increase max_turns in CodewhaleHarnessConfig so the agent has room to resolve the task","Check the task prompt for clarity issues causing the agent to stop early","Verify the binary version matches the pinned 0.9.1 receipt vocabulary","If termination_reason is legitimately 'max_turns', treat the rollout as failed rather than bypassing the check"],"exampleFix":"# before\nCodewhaleHarnessConfig(model=\"...\", max_turns=3)\n# after\nCodewhaleHarnessConfig(model=\"...\", max_turns=100)","handlingStrategy":"validation","validationCode":"def validate_resolution(terminal: dict) -> None:\n    reason = terminal.get(\"termination_reason\")\n    assert reason == \"resolved\", f\"run ended with termination_reason={reason!r}\"","typeGuard":"def is_resolved(terminal: dict) -> bool:\n    return terminal.get(\"termination_reason\") == \"resolved\"","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):\n        reason = (trace.info.get(\"codewhale\") or {}).get(\"terminal\", {}).get(\"termination_reason\")\n        logger.warning(\"unresolved rollout (reason=%s)\", reason)\n    raise","preventionTips":["Size max_turns to the hardest task in the suite, not the average","Make task prompts explicit about expected end state so the agent resolves rather than exits","Diff termination_reason vocabulary against the pinned binary version","Treat 'max_turns' terminations as a signal to raise the ceiling or simplify the task"],"tags":["runtime","verification","agent"],"backgroundTag":"invalid-state-transition","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"}