REQ-HOOK-002: Engine fires hooks at every lifecycle boundary, including a vetoable completion

← Requirements

What it requires

  1. Given a PRE_GENERATE hook returning non-zero, Then the iteration is cancelled; given a POST_GENERATE hook returning modified JSON, Then the generated content is rewritten; given ON_ERROR, Then it fires on entry to ERROR.
  2. Given an ON_COMPLETE hook returning non-zero, When entropic.complete is processed, Then the completion is rejected, the prior state is restored, validator_phase is "revising", and the hook's feedback appears as a [CITATION VALIDATION] user message.
  3. Given an ON_DELEGATE hook returning non-zero, Then the delegation is cancelled and the loop returns to EXECUTING.
  4. Given raw UTF-8 in hook or child output, Then it is sanitized before reaching a JSON dump sink.
tier
NOT_RUN

Where it lives

  • src/core26

See it on the map

How it is met

implemented byresults (206 tests)attachbuild_tool_evidencebuild_tool_manifestbuild_tool_results_jsoncheck_compactiondetachdir_completedispatch_post_generateexecute_iterationfire_complete_hookfire_context_assemble_hookfire_delegate_complete_hookfire_delegate_pre_hookfire_hook_infofire_loop_end_hookfire_loop_iteration_hookfire_loop_start_hookfire_post_compact_hooksfire_post_generate_hookfire_pre_compact_hookfire_pre_hookhandle_hookhook_callbackloopset_hooksset_state206 absent206 tests, a summary by result: every test is in the tests table below

Show on the map

Implemented by

Tests (206)

Reached through calls

206 tests: 206 absent

testresultlinked byimplementers exercisedcalls away
gh#105: constitutional validator's toolless render must NOT clobber absentinferred23 of 261
Hooks fire in correct order during a generation cycleabsentinferred19 of 261
gh#111: a delegation whose child produces raw UTF-8 content does not absentinferred19 of 261
gh#169: the parent relay receives the capped child's real workabsentinferred19 of 261
gh#181: the parent relay receives the hard-cut child's real workabsentinferred19 of 261
hook dispatch: info / PRE_GENERATE cancel / POST_GENERATE rewrite / ON_ERRORabsentinferred19 of 261
Constitutional validator detects violations and revisesabsentinferred4 of 26: attach, detach, handle_hook, hook_callback1
Detach removes hookabsentinferred4 of 26: attach, detach, handle_hook, hook_callback1
Attach with null hook interface returns errorabsentinferred3 of 26: attach, handle_hook, hook_callback1
Compliant output returns unchangedabsentinferred3 of 26: attach, handle_hook, hook_callback1
Constitutional validation catches violationsabsentinferred3 of 26: attach, handle_hook, hook_callback1
Constitutional validation passes clean contentabsentinferred3 of 26: attach, handle_hook, hook_callback1
Critique failure in hook returns originalabsentinferred3 of 26: attach, handle_hook, hook_callback1
Critique generation failure returns originalabsentinferred3 of 26: attach, handle_hook, hook_callback1
Critique params include grammar_key and enable_thinkingabsentinferred3 of 26: attach, handle_hook, hook_callback1
Critique prompt prioritizes validation_rules over constitutionabsentinferred3 of 26: attach, handle_hook, hook_callback1
Critique start/end callbacks fire around the generate call absentinferred3 of 26: attach, handle_hook, hook_callback1
Critique-only mode (max_revisions: 0)absentinferred3 of 26: attach, handle_hook, hook_callback1
Disabled validator does not call inferenceabsentinferred3 of 26: attach, handle_hook, hook_callback1
Hook passes through when compliantabsentinferred3 of 26: attach, handle_hook, hook_callback1
Hook registered at correct priorityabsentinferred3 of 26: attach, handle_hook, hook_callback1
Hook transforms content when violations foundabsentinferred3 of 26: attach, handle_hook, hook_callback1
Identity opt-out skips validation in hookabsentinferred3 of 26: attach, handle_hook, hook_callback1
Last result is populated after validationabsentinferred3 of 26: attach, handle_hook, hook_callback1
Last result populated after hook validationabsentinferred3 of 26: attach, handle_hook, hook_callback1
Lead tier skipped by default skip_tiersabsentinferred3 of 26: attach, handle_hook, hook_callback1
Length safety valve marks verdict rejected_reverted_lengthabsentinferred3 of 26: attach, handle_hook, hook_callback1
Malformed critique JSON defaults to compliantabsentinferred3 of 26: attach, handle_hook, hook_callback1
Max revisions exhausted returns last outputabsentinferred3 of 26: attach, handle_hook, hook_callback1
Non-compliant output triggers revision via Path Aabsentinferred3 of 26: attach, handle_hook, hook_callback1
Non-lead tiers are validated with default skip_tiersabsentinferred3 of 26: attach, handle_hook, hook_callback1
Passed verdict set on clean critiqueabsentinferred3 of 26: attach, handle_hook, hook_callback1
Per-identity rules appended to critique promptabsentinferred3 of 26: attach, handle_hook, hook_callback1
Revised verdict set when revision applied cleanlyabsentinferred3 of 26: attach, handle_hook, hook_callback1
Revision safety valve rejects gutted outputabsentinferred3 of 26: attach, handle_hook, hook_callback1
Validation falls back to constitution when no tier_rulesabsentinferred3 of 26: attach, handle_hook, hook_callback1
Validation skips pure tool-call outputabsentinferred3 of 26: attach, handle_hook, hook_callback1
accept_last() finalizes paused attempt as consumer-overrideabsentinferred3 of 26: attach, handle_hook, hook_callback1
attempt_boundary_cb fires per revisionabsentinferred3 of 26: attach, handle_hook, hook_callback1
build_critique_prompt includes tool context when presentabsentinferred3 of 26: attach, handle_hook, hook_callback1
critique_tier config flows into params JSONabsentinferred3 of 26: attach, handle_hook, hook_callback1
handle_hook surfaces tool_evidence into critique prompt (#5)absentinferred3 of 26: attach, handle_hook, hook_callback1
handle_hook with empty tool_evidence falls back to manifest only absentinferred3 of 26: attach, handle_hook, hook_callback1
resume_retry() runs the revision loop and convergesabsentinferred3 of 26: attach, handle_hook, hook_callback1
set_auto_retry(false) pauses validation on rejectionabsentinferred3 of 26: attach, handle_hook, hook_callback1
dir_complete: hook rejection + coverage_gap metadataabsentinferred1 of 26: set_hooks1
gh#182: a model-supplied max_turns bounds the delegated childabsentinferred19 of 262
Basic response contains no special tokensabsentinferred18 of 262
Batch generation worksabsentinferred18 of 262
Budget-exhausted forced complete sets terminal_reason metadataabsentinferred18 of 262
Circuit breaker limits tool calls per turnabsentinferred18 of 262
Compaction fires when context exceeds thresholdabsentinferred18 of 262
Compaction triggers at thresholdabsentinferred18 of 262
Context accumulates across turnsabsentinferred18 of 262
Context anchors persist across runsabsentinferred18 of 262
Delegation directive triggers child loopabsentinferred18 of 262
Delegation wiring fires on_delegation_start callbackabsentinferred18 of 262
Dynamic identity creation and generation through engine loopabsentinferred18 of 262
Empty response handled gracefullyabsentinferred18 of 262
Engine state transitions include PLANNING and EXECUTINGabsentinferred18 of 262
Finish reason length continues loopabsentinferred18 of 262
Generate is called exactly once per iterationabsentinferred18 of 262
Interrupt stops loopabsentinferred18 of 262
MCP authorization denial propagates through engineabsentinferred18 of 262
Max iterations stops loopabsentinferred18 of 262
Metrics accurate after runabsentinferred18 of 262
Multi-turn engine calls retain contextabsentinferred18 of 262
Root conversation created at run() init when storage wired (gh#48)absentinferred18 of 262
Route callback is invoked for tier selectionabsentinferred18 of 262
Routing fires on_tier_selected callbackabsentinferred18 of 262
Single iteration completesabsentinferred18 of 262
Single-turn engine loop produces coherent responseabsentinferred18 of 262
State transitions IDLE->PLANNING->EXECUTING->COMPLETEabsentinferred18 of 262
Streaming generation worksabsentinferred18 of 262
Streaming interrupt propagates to backend cancel chain absentinferred18 of 262
Tier routing fires callbackabsentinferred18 of 262
Tool call cycle: generate, parse, execute, generateabsentinferred18 of 262
Tool call cycle: generate, parse, execute, regenerateabsentinferred18 of 262
True end-to-end: real prompts, real engine, real modelabsentinferred18 of 262
a context-overflow refusal fails the turn instead of retrying itabsentinferred18 of 262
auto_chain child sets COMPLETE at depth > 0absentinferred18 of 262
auto_chain does not fire without configabsentinferred18 of 262
auto_chain root fires tier change at depth 0absentinferred18 of 262
budget_exhausted child is relayed partial to lead (E2)absentinferred18 of 262
delegation guards reject depth/cycle/repeat/pipeline-depthabsentinferred18 of 262
delegation snapshot + per-tier metrics accumulationabsentinferred18 of 262
gh#111: a tool call whose arg carries raw UTF-8 is preserved, not absentinferred18 of 262
gh#111: raw UTF-8 in backend-cleaned content is sanitized before it absentinferred18 of 262
gh#119: delegation auto-complete folds child summary into lead's absentinferred18 of 262
gh#121: zero-tool-call correction names tier's actual toolsabsentinferred18 of 262
gh#123 part 1: zero-tool-call counter resets after genuine tool call progressabsentinferred18 of 262
gh#123 part 2: zero-tool-call ceiling is per-tier configurableabsentinferred18 of 262
gh#123 part 3: prose-only nudge turn does NOT set failure_reason in metadataabsentinferred18 of 262
gh#123 part 4: ChildContextInfo.max_consecutive_empty_turns_override wired through engineabsentinferred18 of 262
gh#158: two concurrent runs accumulate metrics safelyabsentinferred18 of 262
gh#160: an isolated delegation never writes the project, and absentinferred18 of 262
gh#162: a delegate seeded with context answers from the named absentinferred18 of 262
gh#162: resume by target picks that tier's latest delegationabsentinferred18 of 262
gh#169: a capped loop carries its last real content, annotatedabsentinferred18 of 262
gh#169: a capped loop that produced nothing stays distinguishableabsentinferred18 of 262
gh#181: a hard cut with nothing substantive stays distinguishableabsentinferred18 of 262
gh#181: a thinking-budget hard cut carries the run's real contentabsentinferred18 of 262
gh#183: a fresh top-level run still clears a stale interruptabsentinferred18 of 262
gh#183: a tier's identity overrides reach a top-level runabsentinferred18 of 262
gh#209/#212: a turn that ends in ERROR records why, for the callerabsentinferred18 of 262
gh#77: entropic.complete is terminal when emitted with sibling pipelineabsentinferred18 of 262
gh#80: a tool call resets the budget windowabsentinferred18 of 262
gh#80: budget off (default) does not gate a tool-call-free spiralabsentinferred18 of 262
gh#80: tokens budget nudges then hard-cuts a tool-call-free spiralabsentinferred18 of 262
gh#81: interrupt during tool processing halts before pending dispatchabsentinferred18 of 262
gh#81: run_loop(inherit_interrupt=false) clears a stale interruptabsentinferred18 of 262
gh#81: run_loop(inherit_interrupt=true) preserves a pre-set interruptabsentinferred18 of 262
gh#84 combined: should_stop halts the loop when the duplicate absentinferred18 of 262
gh#84: a successful tool call DOES reset the budgetabsentinferred18 of 262
gh#84: rejected-duplicate tool calls do NOT reset the budgetabsentinferred18 of 262
gh#88 combined: process_tool_results defangs a meta {action} absentinferred18 of 262
gh#88: a gemma multi-turn session never accumulates a parrotable absentinferred18 of 262
last_loop_metrics populated after runabsentinferred18 of 262
max_iterations override caps loop before global limitabsentinferred18 of 262
misc accessors: pause / context_usage / idle / project_dirabsentinferred18 of 262
queue capacity / cap mutation / clear / observer / state slotabsentinferred18 of 262
resume_delegation failure paths surface typed errorsabsentinferred18 of 262
set_storage wiring covers init_session_conversation pathsabsentinferred18 of 262
should_auto_chain false when no locked tierabsentinferred18 of 262
v2.14.6: a lead that answers in prose is nudged, and its forced absentinferred18 of 262
v2.14.6: after a nudge, a tier that owes a tool call is forced to make oneabsentinferred18 of 262
v2.14.6: an empty turn is retried, never accepted as completeabsentinferred18 of 262
v2.14.6: the model's own tool call stays in the history it is shownabsentinferred18 of 262
v2.14.6: with thinking on, each loop turn ends in a real tool callabsentinferred18 of 262
validation_provider variants are all non-fatalabsentinferred18 of 262
zero-tool-call with explicit_completion halts within retry capabsentinferred18 of 262
v2.14.6: after a prose answer is nudged, the forced retry may only absentinferred18 of 263
Configure with null JSON returns errorabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
Double-configure on one handle is refusedabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
Nemotron3-Nano-4B Q8 first inference does not crash (gh#66)absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
Three handles can coexistabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
Two GPU-resident handles can coexist (v2.2.8 target)absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
Two handles configure independentlyabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_configure called twice on the same handle returns ALREADY_CONFIGUREDabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_configure rejects NULL config_jsonabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_configure rejects NULL handleabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_configure_dir on /dev/null subpath returns an error, not an exceptionabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_configure_dir on a tmp dir runs the loader pathabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_configure_dir rejects NULL handleabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_configure_dir with empty string path returns an error code, not an exceptionabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_configure_from_file rejects NULL handleabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_configure_from_file rejects NULL pathabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_configure_from_file rejects missing fileabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_last_error reflects most-recent operation failureabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_last_error returns per-handle state (v2.2.6)absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_register_mcp_server on a configured handle absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_run_messages with console logging disabled still absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
entropic_seconds_since_last_activity returns 0 before any run absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#110: MTP engages through the real agent loop (entropic_run)absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#121 regression: configure populates engine's allowed_tools from identity frontmatterabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#144: concurrent bridge clients queue instead of racingabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#154 a tier grammar stem that cannot resolve YET still absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#154 a tier grammar stem that resolves still configuresabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#154 a tier with no grammar is unaffectedabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#154 entropic_metrics_json carries a generations arrayabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#156 a frontmatter-less app_context fails configure absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#156 a frontmatter-less constitution fails configure tooabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#156 a missing app_context path fails configureabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#156 a well-formed app_context file still configuresabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#156 app_context false still configuresabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#156 inline app_context content still configuresabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#158 entropic_interrupt_session targets exactly one runabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#163 entropic_configure carries app_context into ParsedConfigabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#163 entropic_configure_dir carries app_contextabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#163 entropic_configure_from_file carries app_contextabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#163 the object and false spellings survive configure_dir tooabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#164 entropic_release_model names an unknown tierabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#164 entropic_release_model refuses to unload mid-turnabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#165 entropic_session_context_set guards its preconditionsabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#165 entropic_session_context_set refuses the running sessionabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#165 entropic_session_context_set round-trips through the C ABIabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#175: a non-positive mcp.server_timeout_seconds is refused at configureabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#203: followup returns delegation_id and summary from real storageabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#204: an unservable http_port fails configure loudlyabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#95: identity grammar: field constrains that tier's outputabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
h1.run() after h2.configure() does not segfault (v2.2.6)absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks6
gh#158: interrupting one session leaves the other runningabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#158: metrics and context reads are safe during live runsabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#158: two concurrent sessions do not bleed into each otherabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#164: entropic_release_model frees VRAM through the C ABIabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#165 + gh#164: release the weights, keep the conversationabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#165: a dropped session restored from JSON keeps answeringabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#166: two workspaces on one handle do not read each other's absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#169: an iteration-capped delegate hands its parent the audit it absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#179: each workspace's sessions answer from its own app_context, absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#181: a delegate hard-cut by the thinking budget hands its absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#194: a plain generation publishes the prefill it performedabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#198: a deferred handle holds no GPU memory until it runsabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#204/gh#205: two HTTP clients, different session, workspace and absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#214: a prompt that does not fit fails the turn, typedabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#216: multi-byte text at the history cut does not poison later turnsabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#217: release is refused while another session is decodingabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#93: autoparser family parses a multi-parameter tool callabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#93: entropic_interrupt stops a long run early (cancel-bridge)absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#94: enable_thinking:false suppresses think blocks (facade)absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
gh#99: run_as emits each tier's grammar on a shared modelabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
outside-root optional: a real model's reads outside its root absentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
v2.14.1: a declared server serves each workspace from its own repositoryabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
v2.14.3: release frees the model over MCP and the conversation survivesabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
v2.14.4: a model's commit message with shell syntax is text, not a commandabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7
v2.14.5: a failed turn is an error carrying only its own textabsentinferred4 of 26: attach, handle_hook, hook_callback, set_hooks7