REQ-DELEG-002: Delegation lifecycle from preconditions to result fold-back

← Requirements

What it requires

  1. Given an unknown tier, When execute_delegation runs, Then the result is unsuccessful with an "Unknown tier" summary and no child loop runs.
  2. Given a start callback returning REJECT, When delegation is attempted, Then the child loop never runs.
  3. Given a child context built from a parent at depth D, Then the child is at D+1 with a fresh two-message history and completion instructions appended when explicit_completion is set.
  4. Given a tier that supplies a system prompt, When the child loop runs, Then ctx.locked_tier is the delegation target, not empty.
  5. Given a child that emitted an explicit completion summary, When the summary is extracted, Then it is preferred over the last assistant message; with neither, a placeholder is returned.
  6. Given a throwing consumer callback, When it is invoked, Then the exception is contained and treated as REJECT.
  7. Given a delegation carrying max_turns = 2 and an operator limit of 6, When the child loop runs, Then it stops at 2 iterations; given max_turns above the operator limit, Then the operator limit still governs; given max_turns omitted, Then the bound is unchanged.
tier
NOT_RUN

Where it lives

  • src/core29
  • src/facade1

See it on the map

How it is met

implemented byresults (131 tests)build_child_contextbuild_child_resultbuild_resumed_child_contextcheck_delegation_preconditionscomplete_storage_recordcreate_storage_recorddelegation_callbacks_snapshotdir_delegateensure_sandbox_managerentropic_set_delegation_callbacksexecute_delegationexecute_pending_delegationexecute_resume_delegationextract_summaryfetch_resume_payloadfire_delegate_pre_hookfire_delegation_completefire_delegation_startfire_start_cbinit_session_conversationinvoke_complete_cbpush_delegation_resultpush_resume_failureresolve_max_iterationsresolve_resume_delegationresolve_session_rootrun_childrun_pending_delegationset_delegation_callbacksset_delegation_callbacks131 absent131 tests, a summary by result: every test is in the tests table below

Show on the map

Implemented by

Tests (131)

Reached through calls

131 tests: 131 absent

testresultlinked byimplementers exercisedcalls away
gh#160: an isolated delegation never writes the project, and absentinferred27 of 301
v2.14.6: a lead that answers in prose is nudged, and its forced absentinferred27 of 301
delegation snapshot + per-tier metrics accumulationabsentinferred26 of 301
Exception shields treat throwing callbacks as REJECTabsentinferred11 of 301
complete_cb REJECT writes patch to pending/<id>.patchabsentinferred11 of 301
complete_cb receives patch and files_touchedabsentinferred11 of 301
execute_resume_delegation precondition rejectionsabsentinferred11 of 301
start_cb ACCEPT lets delegation proceedabsentinferred11 of 301
start_cb REJECT aborts delegation before child loop runsabsentinferred11 of 301
start_cb receives correct request fieldsabsentinferred11 of 301
Storage interface lifecycle integrationabsentinferred10 of 301
a delegated child is locked to its target tier — the key the absentinferred10 of 301
child context has correct depthabsentinferred10 of 301
child context has fresh messagesabsentinferred10 of 301
completion instructions injected for explicit_completionabsentinferred10 of 301
coverage_gap absent → result fields stay defaultabsentinferred10 of 301
coverage_gap signal propagates from child metadata to absentinferred10 of 301
delegation result captures turn countabsentinferred10 of 301
execute_delegation returns error for unknown tierabsentinferred10 of 301
execute_resume_delegation handles seed history variantsabsentinferred10 of 301
extract_summary falls back to last assistant messageabsentinferred10 of 301
extract_summary prefers explicit completion summaryabsentinferred10 of 301
extract_summary returns placeholder when no responseabsentinferred10 of 301
gh#158: a delegated child's read satisfies its parent's write — absentinferred10 of 301
gh#160: a nested delegation restores its parent's sandboxabsentinferred10 of 301
gh#160: sibling delegations get distinct sandbox idsabsentinferred10 of 301
gh#162: no context means a byte-identical opening messageabsentinferred10 of 301
gh#162: seeded context reaches the child's opening messageabsentinferred10 of 301
gh#48: a manager-driven delegation persists a row the FK accepts absentinferred10 of 301
log_child_result emits warn branch for terminal_reasonabsentinferred10 of 301
null complete_cb writes patch to pending/<id>.patchabsentinferred10 of 301
todo list saved and restored across delegationabsentinferred10 of 301
pipeline start_cb REJECT skips all stagesabsentinferred9 of 301
pipeline start_cb fires once with is_pipeline=1absentinferred9 of 301
entropic_set_delegation_callbacks rejects NULL handleabsentinferred2 of 30: entropic_set_delegation_callbacks, set_delegation_callbacks1
entropic_set_delegation_callbacks succeeds on created handleabsentinferred2 of 30: entropic_set_delegation_callbacks, set_delegation_callbacks1
entropic_set_delegation_callbacks on configured handleabsentinferred1 of 30: entropic_set_delegation_callbacks1
Basic response contains no special tokensabsentinferred27 of 302
Batch generation worksabsentinferred27 of 302
Circuit breaker limits tool calls per turnabsentinferred27 of 302
Compaction fires when context exceeds thresholdabsentinferred27 of 302
Compaction triggers at thresholdabsentinferred27 of 302
Context accumulates across turnsabsentinferred27 of 302
Context anchors persist across runsabsentinferred27 of 302
Delegation directive triggers child loopabsentinferred27 of 302
Delegation wiring fires on_delegation_start callbackabsentinferred27 of 302
Dynamic identity creation and generation through engine loopabsentinferred27 of 302
Empty response handled gracefullyabsentinferred27 of 302
Engine state transitions include PLANNING and EXECUTINGabsentinferred27 of 302
Finish reason length continues loopabsentinferred27 of 302
Generate is called exactly once per iterationabsentinferred27 of 302
Hooks fire in correct order during a generation cycleabsentinferred27 of 302
Interrupt stops loopabsentinferred27 of 302
MCP authorization denial propagates through engineabsentinferred27 of 302
Max iterations stops loopabsentinferred27 of 302
Metrics accurate after runabsentinferred27 of 302
Multi-turn engine calls retain contextabsentinferred27 of 302
Root conversation created at run() init when storage wired (gh#48)absentinferred27 of 302
Route callback is invoked for tier selectionabsentinferred27 of 302
Routing fires on_tier_selected callbackabsentinferred27 of 302
Single iteration completesabsentinferred27 of 302
Single-turn engine loop produces coherent responseabsentinferred27 of 302
State transitions IDLE->PLANNING->EXECUTING->COMPLETEabsentinferred27 of 302
Streaming generation worksabsentinferred27 of 302
Streaming interrupt propagates to backend cancel chain absentinferred27 of 302
Tier routing fires callbackabsentinferred27 of 302
Tool call cycle: generate, parse, execute, generateabsentinferred27 of 302
Tool call cycle: generate, parse, execute, regenerateabsentinferred27 of 302
True end-to-end: real prompts, real engine, real modelabsentinferred27 of 302
a context-overflow refusal fails the turn instead of retrying itabsentinferred27 of 302
gh#105: constitutional validator's toolless render must NOT clobber absentinferred27 of 302
gh#111: a tool call whose arg carries raw UTF-8 is preserved, not absentinferred27 of 302
gh#111: raw UTF-8 in backend-cleaned content is sanitized before it absentinferred27 of 302
gh#121: zero-tool-call correction names tier's actual toolsabsentinferred27 of 302
gh#123 part 1: zero-tool-call counter resets after genuine tool call progressabsentinferred27 of 302
gh#158: two concurrent runs accumulate metrics safelyabsentinferred27 of 302
gh#162: a delegate seeded with context answers from the named absentinferred27 of 302
gh#183: a fresh top-level run still clears a stale interruptabsentinferred27 of 302
gh#183: a tier's identity overrides reach a top-level runabsentinferred27 of 302
gh#209/#212: a turn that ends in ERROR records why, for the callerabsentinferred27 of 302
gh#80: a tool call resets the budget windowabsentinferred27 of 302
gh#80: budget off (default) does not gate a tool-call-free spiralabsentinferred27 of 302
gh#80: tokens budget nudges then hard-cuts a tool-call-free spiralabsentinferred27 of 302
gh#84: a successful tool call DOES reset the budgetabsentinferred27 of 302
gh#84: rejected-duplicate tool calls do NOT reset the budgetabsentinferred27 of 302
gh#88: a gemma multi-turn session never accumulates a parrotable absentinferred27 of 302
hook dispatch: info / PRE_GENERATE cancel / POST_GENERATE rewrite / ON_ERRORabsentinferred27 of 302
last_loop_metrics populated after runabsentinferred27 of 302
misc accessors: pause / context_usage / idle / project_dirabsentinferred27 of 302
queue capacity / cap mutation / clear / observer / state slotabsentinferred27 of 302
set_storage wiring covers init_session_conversation pathsabsentinferred27 of 302
should_auto_chain false when no locked tierabsentinferred27 of 302
v2.14.6: after a nudge, a tier that owes a tool call is forced to make oneabsentinferred27 of 302
v2.14.6: an empty turn is retried, never accepted as completeabsentinferred27 of 302
v2.14.6: the model's own tool call stays in the history it is shownabsentinferred27 of 302
v2.14.6: with thinking on, each loop turn ends in a real tool callabsentinferred27 of 302
validation_provider variants are all non-fatalabsentinferred27 of 302
zero-tool-call with explicit_completion halts within retry capabsentinferred27 of 302
Pipeline mid-stream failure paths break the loopabsentinferred8 of 302
gh#125: execute_pipeline populates stage_log with per-stage resultsabsentinferred8 of 302
pipeline executes stages sequentiallyabsentinferred8 of 302
pipeline forwards prior stage output as contextabsentinferred8 of 302
gh#160: delegation isolation is opt-in and rooted at the absentinferred2 of 30: ensure_sandbox_manager, resolve_session_root2
v2.14.6: after a prose answer is nudged, the forced retry may only absentinferred27 of 303
Budget-exhausted forced complete sets terminal_reason metadataabsentinferred26 of 303
auto_chain child sets COMPLETE at depth > 0absentinferred26 of 303
auto_chain does not fire without configabsentinferred26 of 303
auto_chain root fires tier change at depth 0absentinferred26 of 303
budget_exhausted child is relayed partial to lead (E2)absentinferred26 of 303
delegation guards reject depth/cycle/repeat/pipeline-depthabsentinferred26 of 303
gh#111: a delegation whose child produces raw UTF-8 content does not absentinferred26 of 303
gh#119: delegation auto-complete folds child summary into lead's absentinferred26 of 303
gh#123 part 2: zero-tool-call ceiling is per-tier configurableabsentinferred26 of 303
gh#123 part 3: prose-only nudge turn does NOT set failure_reason in metadataabsentinferred26 of 303
gh#123 part 4: ChildContextInfo.max_consecutive_empty_turns_override wired through engineabsentinferred26 of 303
gh#162: resume by target picks that tier's latest delegationabsentinferred26 of 303
gh#169: a capped loop carries its last real content, annotatedabsentinferred26 of 303
gh#169: a capped loop that produced nothing stays distinguishableabsentinferred26 of 303
gh#169: the parent relay receives the capped child's real workabsentinferred26 of 303
gh#181: a hard cut with nothing substantive stays distinguishableabsentinferred26 of 303
gh#181: a thinking-budget hard cut carries the run's real contentabsentinferred26 of 303
gh#181: the parent relay receives the hard-cut child's real workabsentinferred26 of 303
gh#77: entropic.complete is terminal when emitted with sibling pipelineabsentinferred26 of 303
gh#81: interrupt during tool processing halts before pending dispatchabsentinferred26 of 303
gh#81: run_loop(inherit_interrupt=false) clears a stale interruptabsentinferred26 of 303
gh#81: run_loop(inherit_interrupt=true) preserves a pre-set interruptabsentinferred26 of 303
gh#84 combined: should_stop halts the loop when the duplicate absentinferred26 of 303
gh#88 combined: process_tool_results defangs a meta {action} absentinferred26 of 303
max_iterations override caps loop before global limitabsentinferred26 of 303
resume_delegation failure paths surface typed errorsabsentinferred26 of 303
gh#182: a model-supplied max_turns bounds the delegated childabsentinferred26 of 304