Hmbown/CodeWhale · error · RuntimeError

Codewhale terminal receipt was not resolved

Error message

Codewhale terminal receipt was not resolved

What it means

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'.

Source

Thrown at integrations/verifiers-codewhale/codewhale_harness/harness.py:240

        result = await runtime.run_program(argv, env)
        if result.exit_code == 0:
            receipt = _parse_stream_receipt(result.stdout)
            terminal = receipt["terminal"]
            if terminal.get("provider") != "openai":
                raise RuntimeError("Codewhale terminal receipt did not use provider openai")
            if terminal.get("model") != ctx.model:
                raise RuntimeError("Codewhale terminal receipt model did not match rollout")
            if terminal.get("approval_posture") != "auto_tools":
                raise RuntimeError("Codewhale terminal receipt did not confirm auto tools")
            if terminal.get("sandbox_posture") != sandbox:
                raise RuntimeError("Codewhale terminal receipt sandbox did not match launch")
            if receipt["events"].get("error", 0) != 0:
                raise RuntimeError("Codewhale successful run contained an error event")
            if terminal.get("status") != "completed":
                raise RuntimeError("Codewhale terminal receipt did not report completion")
            if terminal.get("termination_reason") != "resolved":
                raise RuntimeError("Codewhale terminal receipt was not resolved")
            trace.info["codewhale"] = receipt
        return result


def _has_version(output: str, version: str) -> bool:
    return (
        re.search(
            rf"(?<![0-9A-Za-z.+-]){re.escape(version)}(?![0-9A-Za-z.+-])",
            output,
        )
        is not None
    )


def _bounded_terminal(meta: dict[str, Any]) -> dict[str, Any]:
    terminal: dict[str, Any] = {}
    for key in _TERMINAL_FIELDS:
        if key not in meta or meta[key] is None:

View on GitHub (pinned to 8880682c63)

Solutions

  1. Raise or remove max_turns so the model can reach a resolved state
  2. Adjust task prompts so the model concludes instead of iterating
  3. Have facades emit termination_reason='resolved' only when work truly finished

Example fix

# before
config = CodewhaleHarnessConfig(version='0.9.1', max_turns=5)
# after
config = CodewhaleHarnessConfig(version='0.9.1', max_turns=None)
Defensive patterns

Strategy: fallback

Try / catch

try:
    result = await harness.launch(ctx, trace, runtime, endpoint, secret, mcp_urls)
except RuntimeError as e:
    if 'was not resolved' in str(e) and config.max_turns:
        config = config.model_copy(update={'max_turns': None})  # fall back to unlimited and rerun
        result = await harness.launch(ctx, trace, runtime, endpoint, secret, mcp_urls)
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: Long-horizon tasks exceeding an inherited turn budget; eval configs copied from short-task benchmarks; facade placeholders like 'done' or 'stop'.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/34720d487c43b72d. Report an issue: GitHub.