Hmbown/CodeWhale · error · RuntimeContractError

receipt metric `skill_discovery.prompts_byte_identical` must

Error message

receipt metric `skill_discovery.prompts_byte_identical` must be true

What it means

validate_receipt requires receipt skill_discovery.prompts_byte_identical to be exactly boolean True (the check is `is not True`, so 1, "true", or a missing field all fail). The measure harness sets this flag only when skill-discovery passes on unchanged turns produce byte-identical prompt fragments. False therefore means nondeterministic skill discovery, not a budget problem; budgets are never checked for this flag.

Source

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

    for stage, _label in REPRESENTATIVE_STAGES:
        path = ("representative_context", "stages", stage, "identity_sha256")
        digest = required_value(document, path, kind)
        if not isinstance(digest, str) or re.fullmatch(r"[0-9a-f]{64}", digest) is None:
            raise RuntimeContractError(
                f"{kind} field `{'.'.join(path)}` must be a lowercase SHA-256 digest"
            )


def validate_receipt(receipt: dict[str, Any]) -> None:
    validate_document(receipt, RECEIPT_KIND, "receipt")
    skill_discovery = receipt.get("skill_discovery")
    identical = (
        skill_discovery.get("prompts_byte_identical")
        if isinstance(skill_discovery, dict)
        else None
    )
    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"
        )

View on GitHub (pinned to 8880682c63)

Solutions

  1. Run scripts/measure-runtime-contract.py directly - if the flag comes out false, fix the nondeterminism in the Rust skill-discovery path (stable ordering, no clock/env data) instead of editing the receipt
  2. If the receipt is a hand-authored test fixture, set the field to literal JSON true and re-check with --receipt
  3. Update to a checker/measure pair from the same commit (both live in scripts/ of this repo)
Defensive patterns

Strategy: type-guard

Type guard

def has_identical_skill_prompts(receipt: dict) -> bool:
    sd = receipt.get("skill_discovery")
    return isinstance(sd, dict) and sd.get("prompts_byte_identical") is True

Prevention

When it happens

Trigger: A freshly measured receipt where the harness observed differing bytes between two skill-discovery passes; a hand-written receipt that omits skill_discovery or sets the flag to a truthy non-boolean; a measure script older than the field itself.

Common situations: Refactoring the skill-discovery cache (ordering, hashmap iteration, timestamps, env leakage) so unchanged turns no longer render identical fragments; testing the checker with a minimal hand-made receipt; version skew between the checker and scripts/measure-runtime-contract.py.

Related errors


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