tailot's picture
Upload folder using huggingface_hub
48f2b75 verified
Raw History Blame
1.72 kB
"""One registry of every reason code this bundle can answer with.
A verdict is only useful when its reason can be looked up. Every REFUSED and
every UNKNOWN result names one of these codes: the pattern cases anchor their
negative rows on them, the card lists all of them, and the self_lint gate
checks that the registry and the card agree so the two can never drift apart.
"""
from __future__ import annotations
from typing import Tuple
from lingologos_python import rules
# Refusals the session raises itself, before or around the six-node run.
PATH_POLICY = "PATH_POLICY"
PATCH_NOT_APPLIED = "PATCH_NOT_APPLIED"
NODE_TIMEOUT = "NODE_TIMEOUT"
LINKED_PATH_IN_WORKSPACE = "LINKED_PATH_IN_WORKSPACE"
SESSION_REASONS: Tuple[str, ...] = (
PATH_POLICY,
PATCH_NOT_APPLIED,
NODE_TIMEOUT,
LINKED_PATH_IN_WORKSPACE,
)
# Verdicts the codex kernel brings back when the gates fail or decline to answer.
GATE_REJECTED = "GATE_REJECTED"
GATE_ABSTAIN = "GATE_ABSTAIN"
KERNEL_REASONS: Tuple[str, ...] = (GATE_REJECTED, GATE_ABSTAIN)
# The refusal the catalog layer adds above the rules: a scan found the card fits
# more than one target and the caller named none.
AMBIGUOUS_TARGET = "AMBIGUOUS_TARGET"
PATTERN_REASONS: Tuple[str, ...] = (AMBIGUOUS_TARGET,)
# Preflight and shape refusals of the pattern rules, collected from the rules
# module so the registry cannot fall behind the rules that raise them.
RULE_REASONS: Tuple[str, ...] = tuple(
value
for name, value in vars(rules).items()
if name.isupper() and isinstance(value, str) and value == name
)
REASON_CODES = (
frozenset(SESSION_REASONS)
| frozenset(KERNEL_REASONS)
| frozenset(PATTERN_REASONS)
| frozenset(RULE_REASONS)
)