Skip to main content

Module native_loop

Module native_loop 

Source
Expand description

The native coding loop: plan → edit → verify → repair, on CAR inference.

Shape mirrors car-bench’s InferenceAgentRunner (multi-turn tool-use conversation) wrapped in car-builder’s repair-loop philosophy: each iteration appends the previous iteration’s failing check output to a conversation that PERSISTS across repair rounds (F2, audit 2026-07-06 — see the note above run_native_loop), bounded each turn by [compact_history_to_window]. The loop only exits green when evaluate_contract — not the model — says so.

Structs§

LoopOutcome
How a loop run ended.
NativeLoopConfig
Tuning for the native loop.

Enums§

AssistantGenerateError
The typed failure of one ASSISTANT turn’s generation.
InferenceFailureKind
The model seam: one turn of generation. Implemented by InferenceEngine for production; test harnesses script it (the same injected-generation philosophy as car-builder).
LoopFailure
Why a loop run ended without green checks.
TurnGenerationError

Constants§

ASK_USER_TOOL
The name of the model-invokable mid-session question tool. Recognized by the loop (not the WorktreeExecutor) so the channel plumbing stays with the sink + cancel flag the loop already holds.
REPORT_NO_CHANGE_TOOL
The no-change nomination tool. See super::no_change for what the runtime does with a call, and why almost all of that is refusal.

Traits§

AskUser
The mid-session user-input seam: the loop hands a prompt to the host, which surfaces it (emit UserInputRequested), blocks for the user’s reply (while respecting cancellation and a bound), and returns the text — or an Err describing why no answer is coming (timeout, cancellation, no listener). An Err is fed back to the model as a tool error so it can proceed without the answer rather than the loop wedging.
AuthGate
Can the runtime reach a usable credential right now?
TurnGenerator

Functions§

model_tool_catalog
Every tool schema the native coder can advertise across its optional run modes. Individual runs still filter ask_user, report_no_change, and graph-memory recall according to the handlers and policy they carry.
run_native_loop
Drive the native loop to completion, cancellation, or exhaustion.