Skip to content

symfonic.agent.cutover.completeness

completeness

What a composition root must hand over before a bundle claims a segment.

Two rules, one shape, and the shape is why they live together: a bundle that carries part of a segment is worse than one that carries none. None is refused by the envelope and the turn stays on the legacy body, which is the designed outcome. Part is admitted on the strength of what travelled and then fails on what did not — the half-shape this whole programme keeps finding a layer lower down.

Extracted from bundle.py when the second rule arrived. One rule inline is a check; two inline are a policy that nobody can see is a policy.

refuse_partial_consolidation

refuse_partial_consolidation(writes: Any, lifecycle: Any, records_from: Any) -> bool

Return whether consolidation is folded; raise if it is folded by parts.

All three, because each absence fails differently and all three fail quietly: no lifecycle stages memories that are never retrievable, and no records_from runs a write stage on every turn that files nothing.

Source code in src/symfonic/agent/cutover/completeness.py
def refuse_partial_consolidation(
    writes: Any, lifecycle: Any, records_from: Any
) -> bool:
    """Return whether consolidation is folded; raise if it is folded by parts.

    All three, because each absence fails differently and all three fail
    quietly: no ``lifecycle`` stages memories that are never retrievable, and
    no ``records_from`` runs a write stage on every turn that files nothing.
    """
    pieces = (("writes", writes), ("lifecycle", lifecycle), ("records_from", records_from))
    present = [name for name, value in pieces if value is not None]
    if not present:
        return False
    missing = [name for name, value in pieces if value is None]
    if missing:
        raise ValueError(
            "fold_retrieval_bundle needs all three consolidation pieces or "
            f"none; missing {', '.join(missing)}. A bundle that stages without "
            "committing leaves a store that recalls nothing, and one with no "
            "producer runs a write stage that files nothing."
        )
    return True

refuse_partial_hydration

refuse_partial_hydration(retrieval: Any, conversation: Any, recent_turns: int) -> bool

Return whether hydration is folded; raise if it is folded by halves.

Source code in src/symfonic/agent/cutover/completeness.py
def refuse_partial_hydration(retrieval: Any, conversation: Any, recent_turns: int) -> bool:
    """Return whether hydration is folded; raise if it is folded by halves."""
    hydrating = retrieval is not None or conversation is not None
    if hydrating and (retrieval is None or conversation is None):
        raise ValueError(
            "fold_retrieval_bundle needs both memory segments or neither: a "
            "bundle serving recall without the conversation window widens the "
            "envelope for a prompt missing the block that goes first."
        )
    if hydrating and recent_turns <= 0:
        raise ValueError(
            "fold_retrieval_bundle(recent_turns=0) wires a conversation source "
            "the window will never call, so the bundle would claim to serve a "
            "segment that cannot run. Pass a positive count, or build a "
            "retrieval-only deployment explicitly -- which the envelope refuses "
            "for auto_hydrate, by design."
        )
    return hydrating