{"record":{"id":"4a725c9dfc4930ce","repo":"Hmbown/CodeWhale","slug":"codewhale-terminal-receipt-sandbox-did-not-match-l","errorCode":null,"errorMessage":"Codewhale terminal receipt sandbox did not match launch","messagePattern":"Codewhale terminal receipt sandbox did not match launch","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"integrations/verifiers-codewhale/codewhale_harness/harness.py","lineNumber":234,"sourceCode":"            argv.extend([\"--max-turns\", str(self.config.max_turns)])\n        if self.config.disabled_tools:\n            argv.extend([\"--disallowed-tools\", \",\".join(self.config.disabled_tools)])\n        if system:\n            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    )","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/integrations/verifiers-codewhale/codewhale_harness/harness.py#L216-L252","documentation":"config.sandbox resolves 'auto' to 'workspace-write' on subprocess runtimes and 'external-sandbox' otherwise, passes the result as --sandbox, and requires the receipt to echo the identical sandbox_posture. A mismatch means the binary actually ran under a different sandbox than requested — a safety and attribution break, not a formatting issue.","triggerScenarios":"A binary escalating or downgrading the sandbox relative to its --sandbox argument; facades omitting sandbox_posture; runtime.type changing the 'auto' resolution so the echoed posture differs from the computed one.","commonSituations":"Container runtimes ignoring sandbox flags they do not implement; facades with placeholder postures; switching the harness between subprocess and sandboxed runtimes without pinning sandbox explicitly.","solutions":["Set sandbox explicitly (e.g. 'read-only') instead of 'auto' when receipt predictability matters","Make facades echo the --sandbox argument verbatim as sandbox_posture","Verify the pinned release honors --sandbox on the target runtime"],"exampleFix":"# before\nconfig = CodewhaleHarnessConfig(version='0.9.1', sandbox='auto')\n# after\nconfig = CodewhaleHarnessConfig(version='0.9.1', sandbox='workspace-write')","handlingStrategy":"try-catch","validationCode":"sandbox = 'workspace-write' if runtime.type == 'subprocess' else 'external-sandbox'\nconfig = CodewhaleHarnessConfig(version='0.9.1', sandbox=sandbox)  # pin explicitly instead of 'auto'","typeGuard":null,"tryCatchPattern":"try:\n    result = await harness.launch(ctx, trace, runtime, endpoint, secret, mcp_urls)\nexcept RuntimeError as e:\n    if 'sandbox did not match' in str(e):\n        compare_requested_vs_echoed_sandbox(config.sandbox, e)\n    raise","preventionTips":["Pin sandbox explicitly when receipts must be predictable","Verify facades echo --sandbox verbatim","Re-check posture expectations when switching runtime types"],"tags":["receipt","integration","sandbox","harness"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}