Hmbown/CodeWhale · error · RuntimeContractError

receipt metric `representative_context.prompts_byte_identica

Error message

receipt metric `representative_context.prompts_byte_identical` must be true

What it means

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.

Source

Thrown at scripts/check-runtime-contract-budget.py:273

    )
    if identical is not True:
        raise RuntimeContractError(
            "receipt metric `skill_discovery.prompts_byte_identical` must be true"
        )
    representative = receipt.get("representative_context")
    fixture_id = (
        representative.get("fixture_id")
        if isinstance(representative, dict)
        else None
    )
    if fixture_id != REPRESENTATIVE_FIXTURE_ID:
        raise RuntimeContractError(
            "receipt metric `representative_context.fixture_id` must be "
            f"`{REPRESENTATIVE_FIXTURE_ID}`, got {fixture_id!r}"
        )
    representative_identical = representative.get("prompts_byte_identical")
    if representative_identical is not True:
        raise RuntimeContractError(
            "receipt metric `representative_context.prompts_byte_identical` must be true"
        )
    validate_identity_structure(receipt, "receipt")


def validate_budget(budget: dict[str, Any]) -> None:
    validate_document(budget, BUDGET_KIND, "budget")
    representative = budget.get("representative_context")
    fixture_id = (
        representative.get("fixture_id")
        if isinstance(representative, dict)
        else None
    )
    if fixture_id != REPRESENTATIVE_FIXTURE_ID:
        raise RuntimeContractError(
            "budget metric `representative_context.fixture_id` must be "
            f"`{REPRESENTATIVE_FIXTURE_ID}`, got {fixture_id!r}"
        )

View on GitHub (pinned to 8880682c63)

Solutions

  1. 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
  2. For hand-authored test receipts, set the field to literal JSON true
  3. Keep checker and measure script from the same commit
Defensive patterns

Strategy: type-guard

Type guard

def has_identical_representative_prompts(receipt: dict) -> bool:
    rc = receipt.get("representative_context")
    return isinstance(rc, dict) and rc.get("prompts_byte_identical") is True

Prevention

When it happens

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

Common situations: 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).

Related errors


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