REQ-LOOP-007: Engine-authored transcript shaping keeps the system prompt bit-stable

← Requirements

What it requires

  1. Given two consecutive turns, When prompts are assembled, Then the serialized system message is byte-identical and the engine reminder appears as the last user message.
  2. Given pending validation feedback or an anti-spiral warning, When the next prompt is built, Then the line appears once and the field is cleared.
  3. Given an entropic.complete tool result and an empty trailing assistant message plus explicit_completion_summary metadata, When results are processed, Then the summary is folded into the assistant message and no raw JSON user message is pushed; and each stated precondition failure refuses the fold.
tier
NOT_RUN

Where it lives

  • src/core7

See it on the map

How it is met

implemented byresults (100 tests)capture_validation_feedbackdefang_meta_action_envelopefold_complete_into_assistantfold_delegation_summaryinject_engine_state_reminderprepare_promptsprocess_tool_results100 absent100 tests, a summary by result: every test is in the tests table below

Show on the map

Implemented by

Tests (100)

Reached through calls

100 tests: 100 absent

testresultlinked byimplementers exercisedcalls away
defang_meta_action_envelope: reshapes meta {action} results so absentinferred1 of 7: defang_meta_action_envelope1
fold_complete_into_assistant: happy path folds summary absentinferred1 of 7: fold_complete_into_assistant1
fold_complete_into_assistant: long summary preserves UTF-8 absentinferred1 of 7: fold_complete_into_assistant1
fold_complete_into_assistant: refuses for non-complete tools absentinferred1 of 7: fold_complete_into_assistant1
fold_complete_into_assistant: refuses on empty message history absentinferred1 of 7: fold_complete_into_assistant1
fold_complete_into_assistant: refuses when assistant has prose absentinferred1 of 7: fold_complete_into_assistant1
fold_complete_into_assistant: refuses when last msg isn't assistant absentinferred1 of 7: fold_complete_into_assistant1
fold_complete_into_assistant: refuses when metadata summary missing absentinferred1 of 7: fold_complete_into_assistant1
Basic response contains no special tokensabsentinferred5 of 75
Batch generation worksabsentinferred5 of 75
Budget-exhausted forced complete sets terminal_reason metadataabsentinferred5 of 75
Circuit breaker limits tool calls per turnabsentinferred5 of 75
Compaction fires when context exceeds thresholdabsentinferred5 of 75
Compaction triggers at thresholdabsentinferred5 of 75
Context accumulates across turnsabsentinferred5 of 75
Context anchors persist across runsabsentinferred5 of 75
Delegation directive triggers child loopabsentinferred5 of 75
Delegation wiring fires on_delegation_start callbackabsentinferred5 of 75
Dynamic identity creation and generation through engine loopabsentinferred5 of 75
Empty response handled gracefullyabsentinferred5 of 75
Engine state transitions include PLANNING and EXECUTINGabsentinferred5 of 75
Finish reason length continues loopabsentinferred5 of 75
Generate is called exactly once per iterationabsentinferred5 of 75
Hooks fire in correct order during a generation cycleabsentinferred5 of 75
Interrupt stops loopabsentinferred5 of 75
MCP authorization denial propagates through engineabsentinferred5 of 75
Max iterations stops loopabsentinferred5 of 75
Metrics accurate after runabsentinferred5 of 75
Multi-turn engine calls retain contextabsentinferred5 of 75
Root conversation created at run() init when storage wired (gh#48)absentinferred5 of 75
Route callback is invoked for tier selectionabsentinferred5 of 75
Routing fires on_tier_selected callbackabsentinferred5 of 75
Single iteration completesabsentinferred5 of 75
Single-turn engine loop produces coherent responseabsentinferred5 of 75
State transitions IDLE->PLANNING->EXECUTING->COMPLETEabsentinferred5 of 75
Streaming generation worksabsentinferred5 of 75
Streaming interrupt propagates to backend cancel chain absentinferred5 of 75
Tier routing fires callbackabsentinferred5 of 75
Tool call cycle: generate, parse, execute, generateabsentinferred5 of 75
Tool call cycle: generate, parse, execute, regenerateabsentinferred5 of 75
True end-to-end: real prompts, real engine, real modelabsentinferred5 of 75
a context-overflow refusal fails the turn instead of retrying itabsentinferred5 of 75
auto_chain child sets COMPLETE at depth > 0absentinferred5 of 75
auto_chain does not fire without configabsentinferred5 of 75
auto_chain root fires tier change at depth 0absentinferred5 of 75
budget_exhausted child is relayed partial to lead (E2)absentinferred5 of 75
delegation guards reject depth/cycle/repeat/pipeline-depthabsentinferred5 of 75
delegation snapshot + per-tier metrics accumulationabsentinferred5 of 75
gh#105: constitutional validator's toolless render must NOT clobber absentinferred5 of 75
gh#111: a delegation whose child produces raw UTF-8 content does not absentinferred5 of 75
gh#111: a tool call whose arg carries raw UTF-8 is preserved, not absentinferred5 of 75
gh#111: raw UTF-8 in backend-cleaned content is sanitized before it absentinferred5 of 75
gh#119: delegation auto-complete folds child summary into lead's absentinferred5 of 75
gh#121: zero-tool-call correction names tier's actual toolsabsentinferred5 of 75
gh#123 part 1: zero-tool-call counter resets after genuine tool call progressabsentinferred5 of 75
gh#123 part 2: zero-tool-call ceiling is per-tier configurableabsentinferred5 of 75
gh#123 part 3: prose-only nudge turn does NOT set failure_reason in metadataabsentinferred5 of 75
gh#123 part 4: ChildContextInfo.max_consecutive_empty_turns_override wired through engineabsentinferred5 of 75
gh#158: two concurrent runs accumulate metrics safelyabsentinferred5 of 75
gh#160: an isolated delegation never writes the project, and absentinferred5 of 75
gh#162: a delegate seeded with context answers from the named absentinferred5 of 75
gh#162: resume by target picks that tier's latest delegationabsentinferred5 of 75
gh#169: a capped loop carries its last real content, annotatedabsentinferred5 of 75
gh#169: a capped loop that produced nothing stays distinguishableabsentinferred5 of 75
gh#169: the parent relay receives the capped child's real workabsentinferred5 of 75
gh#181: a hard cut with nothing substantive stays distinguishableabsentinferred5 of 75
gh#181: a thinking-budget hard cut carries the run's real contentabsentinferred5 of 75
gh#181: the parent relay receives the hard-cut child's real workabsentinferred5 of 75
gh#183: a fresh top-level run still clears a stale interruptabsentinferred5 of 75
gh#183: a tier's identity overrides reach a top-level runabsentinferred5 of 75
gh#209/#212: a turn that ends in ERROR records why, for the callerabsentinferred5 of 75
gh#77: entropic.complete is terminal when emitted with sibling pipelineabsentinferred5 of 75
gh#80: a tool call resets the budget windowabsentinferred5 of 75
gh#80: budget off (default) does not gate a tool-call-free spiralabsentinferred5 of 75
gh#80: tokens budget nudges then hard-cuts a tool-call-free spiralabsentinferred5 of 75
gh#81: interrupt during tool processing halts before pending dispatchabsentinferred5 of 75
gh#81: run_loop(inherit_interrupt=false) clears a stale interruptabsentinferred5 of 75
gh#81: run_loop(inherit_interrupt=true) preserves a pre-set interruptabsentinferred5 of 75
gh#84 combined: should_stop halts the loop when the duplicate absentinferred5 of 75
gh#84: a successful tool call DOES reset the budgetabsentinferred5 of 75
gh#84: rejected-duplicate tool calls do NOT reset the budgetabsentinferred5 of 75
gh#88 combined: process_tool_results defangs a meta {action} absentinferred5 of 75
gh#88: a gemma multi-turn session never accumulates a parrotable absentinferred5 of 75
hook dispatch: info / PRE_GENERATE cancel / POST_GENERATE rewrite / ON_ERRORabsentinferred5 of 75
last_loop_metrics populated after runabsentinferred5 of 75
max_iterations override caps loop before global limitabsentinferred5 of 75
misc accessors: pause / context_usage / idle / project_dirabsentinferred5 of 75
queue capacity / cap mutation / clear / observer / state slotabsentinferred5 of 75
resume_delegation failure paths surface typed errorsabsentinferred5 of 75
set_storage wiring covers init_session_conversation pathsabsentinferred5 of 75
should_auto_chain false when no locked tierabsentinferred5 of 75
v2.14.6: a lead that answers in prose is nudged, and its forced absentinferred5 of 75
v2.14.6: after a nudge, a tier that owes a tool call is forced to make oneabsentinferred5 of 75
v2.14.6: an empty turn is retried, never accepted as completeabsentinferred5 of 75
v2.14.6: the model's own tool call stays in the history it is shownabsentinferred5 of 75
v2.14.6: with thinking on, each loop turn ends in a real tool callabsentinferred5 of 75
validation_provider variants are all non-fatalabsentinferred5 of 75
zero-tool-call with explicit_completion halts within retry capabsentinferred5 of 75
gh#182: a model-supplied max_turns bounds the delegated childabsentinferred5 of 76
v2.14.6: after a prose answer is nudged, the forced retry may only absentinferred5 of 76