Expand description
Deterministic realization of a conditional step’s closed-vocabulary when guard — mirrors
dispatcher/claude-agent-sdk/src/conditional.ts field-for-field (see that module’s doc for the
full R1 repair-fold-into-loop / R2 guarded-skip design).
This module is deliberately not wired into this back-end’s actual static-file emission
(emit.rs): the Claude Code CLI target has no deterministic runtime, so its conditional/repair
behavior is entirely textual — the live CLI agent judges the guard emergently from the emitted
prompt text (see ir.rs‘s LlmCall::when doc comment), not from an evaluator like this one.
No existing profile calls into this module; it exists solely so the two back-ends’ understanding
of the SAME closed guard vocabulary can be held to a shared conformance fixture
(dispatcher/conformance-fixtures/conditional.json, asserted against here and against
conditional.ts) — a semantic drift between them fails whichever suite moved.
Structs§
- Guard
State - Step
Identity - The subset of a step’s identity this module needs: its name (an
on_failuretarget) and the artifact its output would land in (anon_failure-repair shape also requires it to be consumed).
Enums§
Constants§
- DEFAULT_
MAX_ REPAIR_ ATTEMPTS - Default bound on repair attempts. Not (yet) an IR field —
max_attemptsis not part of the schema either back-end reads — so this mirrors conditional.ts’s back-end-local runtime constant.
Functions§
- classify_
conditional_ step - The single entry point a staged executor would use to decide what a conditional step does next: fold into a bounded repair turn (R1), run (R2 guard true), or skip (R2 guard false / R1 target didn’t fail).
- evaluate_
guard - Evaluate a guard’s truth value directly (R2 — guarded-skip). Does not special-case the R1 repair
shape; callers that need to distinguish repair-fold from a plain
on_failureskip should useclassify_conditional_stepinstead. - repair_
fold_ target - Structural test for the R1 repair shape: an
on_failureguard whose target ispreceding_step, where that step’s sole produced artifact is also consumed by the conditional step. Returns the target’s identity when the shape matches, elseNone(falls back to R2 guarded-skip). - run_
repair_ loop - Drive a bounded repair loop: call
attempt_failedup tomax_attemptstimes (1-indexed), stopping at the first attempt that reports success. Mirrors conditional.ts’srunRepairLoop: returns(recovered, attempts)and never loops pastmax_attempts— exhaustion is reported back (recovered = false) for the caller to loud-fail, not swallowed here.