{"record":{"id":"5aa7a16c4e2c9459","repo":"Hmbown/CodeWhale","slug":"receipt-metric-representative-context-prompts-byt","errorCode":null,"errorMessage":"receipt metric `representative_context.prompts_byte_identical` must be true","messagePattern":"receipt metric `representative_context\\.prompts_byte_identical` must be true","errorType":"exception","errorClass":"RuntimeContractError","httpStatus":null,"severity":"error","filePath":"scripts/check-runtime-contract-budget.py","lineNumber":273,"sourceCode":"    )\n    if identical is not True:\n        raise RuntimeContractError(\n            \"receipt metric `skill_discovery.prompts_byte_identical` must be true\"\n        )\n    representative = receipt.get(\"representative_context\")\n    fixture_id = (\n        representative.get(\"fixture_id\")\n        if isinstance(representative, dict)\n        else None\n    )\n    if fixture_id != REPRESENTATIVE_FIXTURE_ID:\n        raise RuntimeContractError(\n            \"receipt metric `representative_context.fixture_id` must be \"\n            f\"`{REPRESENTATIVE_FIXTURE_ID}`, got {fixture_id!r}\"\n        )\n    representative_identical = representative.get(\"prompts_byte_identical\")\n    if representative_identical is not True:\n        raise RuntimeContractError(\n            \"receipt metric `representative_context.prompts_byte_identical` must be true\"\n        )\n    validate_identity_structure(receipt, \"receipt\")\n\n\ndef validate_budget(budget: dict[str, Any]) -> None:\n    validate_document(budget, BUDGET_KIND, \"budget\")\n    representative = budget.get(\"representative_context\")\n    fixture_id = (\n        representative.get(\"fixture_id\")\n        if isinstance(representative, dict)\n        else None\n    )\n    if fixture_id != REPRESENTATIVE_FIXTURE_ID:\n        raise RuntimeContractError(\n            \"budget metric `representative_context.fixture_id` must be \"\n            f\"`{REPRESENTATIVE_FIXTURE_ID}`, got {fixture_id!r}\"\n        )","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/scripts/check-runtime-contract-budget.py#L255-L291","documentation":"validate_receipt additionally requires receipt representative_context.prompts_byte_identical to be exactly True (strict `is not True` check, so 1 and \"true\" fail). The representative-context harness renders the staged prompt twice and flags whether the bytes are identical; false means the staged prompt assembly itself is nondeterministic. Like error 204 this is receipt-only - validate_budget never checks it.","triggerScenarios":"A measurement where the base/project/instructions/skill/memory/goal/handoff stage rendering produced different bytes across passes; a hand-authored receipt missing representative_context.prompts_byte_identical; partial JSON where the field is null.","commonSituations":"Prompt-assembly refactors that introduce unstable ordering or locale/time-dependent text; hand-minimal receipts used to unit-test the checker; nondeterminism that only shows on a fresh target dir (no warm cache).","solutions":["Re-run scripts/measure-runtime-contract.py with a clean target dir to confirm the flag is reproducibly false, then fix the nondeterminism in prompt assembly","For hand-authored test receipts, set the field to literal JSON true","Keep checker and measure script from the same commit"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"def has_identical_representative_prompts(receipt: dict) -> bool:\n    rc = receipt.get(\"representative_context\")\n    return isinstance(rc, dict) and rc.get(\"prompts_byte_identical\") is True","tryCatchPattern":null,"preventionTips":["Keep prompt rendering free of clocks, locale, and unordered-map iteration","Re-measure after touching crates/tui/src/prompts/text.rs or any stage assembler","For fixture receipts, copy the boolean flags from a genuine receipt rather than typing truthy stand-ins like 1"],"tags":["python","determinism","receipt","system-prompt"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}