REQ-COMPACT-001: Threshold compaction preserving task-bearing messages, snapshot first

← Requirements

What it requires

  1. Given usage below threshold, When check_and_compact runs, Then the message list is unchanged; with force = true it compacts anyway.
  2. Given usage above threshold, When compaction runs, Then the system message and all user-sourced messages survive and a summary message is present.
  3. Given compaction disabled, When the threshold is crossed, Then a warning is logged and nothing is compacted.
  4. Given a registered per-identity compactor, a global compactor and the default, Then precedence is per-identity > global > default, a NULL compactor is rejected, and a failing custom compactor falls back to the default.
tier
NOT_RUN

Where it lives

  • src/core23
  • src/facade4

See it on the map

How it is met

implemented byresults (131 tests)assemble_compactedcheck_and_compactcheck_compactioncompactcompactcompact_messagescontext_usagecount_messagecount_messagescount_textderegister_compactorentropic_compactentropic_deregister_compactorentropic_get_default_compactorentropic_register_compactorfire_post_compact_hooksfire_pre_compact_hookformat_summaryhas_custom_compactorpartition_messagesregister_compactorrun_customrun_defaultsave_snapshotserialize_messages_jsonstructured_summaryusage_percent131 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
misc accessors: pause / context_usage / idle / project_dirabsentinferred9 of 271
Custom compactor is invoked instead of default when registeredabsentinferred5 of 271
CompactionManager saves snapshot via StorageInterfaceabsentinferred4 of 27: check_and_compact, count_message, count_messages, count_text1
Null StorageInterface is safeabsentinferred4 of 27: check_and_compact, count_message, count_messages, count_text1
TokenCounter usage_percentabsentinferred4 of 27: count_message, count_messages, count_text, usage_percent1
gh#158: token counting is safe from two concurrent runsabsentinferred4 of 27: count_message, count_messages, count_text, usage_percent1
TokenCounter count_messages sums correctlyabsentinferred3 of 27: count_message, count_messages, count_text1
TokenCounter cache returns same valueabsentinferred2 of 27: count_message, count_text1
TokenCounter clear_cache resetsabsentinferred2 of 27: count_message, count_text1
TokenCounter heuristic ~4 chars/tokenabsentinferred2 of 27: count_message, count_text1
entropic_deregister_compactor on NULL handle returns INVALID_HANDLEabsentinferred2 of 27: deregister_compactor, entropic_deregister_compactor1
entropic_deregister_compactor on a configured handle exercises check_compactorabsentinferred2 of 27: deregister_compactor, entropic_deregister_compactor1
entropic_register_compactor on NULL handle returns INVALID_HANDLEabsentinferred2 of 27: entropic_register_compactor, register_compactor1
entropic_register_compactor on a minimal-configured handle absentinferred2 of 27: entropic_register_compactor, register_compactor1
entropic_register_compactor with NULL fn returns INVALID_CONFIG on configured handleabsentinferred2 of 27: entropic_register_compactor, register_compactor1
entropic_register_compactor with a valid callback exercises check_compactorabsentinferred2 of 27: entropic_register_compactor, register_compactor1
entropic_compact on NULL handle returns INVALID_HANDLEabsentinferred1 of 27: entropic_compact1
entropic_compact on a configured handle with no active engine absentinferred1 of 27: entropic_compact1
entropic_compact on configured handle stubs INVALID_STATEabsentinferred1 of 27: entropic_compact1
entropic_compact on unconfigured handle returns INVALID_STATEabsentinferred1 of 27: entropic_compact1
entropic_compact rejects NULL handleabsentinferred1 of 27: entropic_compact1
entropic_deregister_compactor on configured handle is OK (idempotent, gh#76)absentinferred1 of 27: entropic_deregister_compactor1
entropic_deregister_compactor on unconfigured handle returns INVALID_STATEabsentinferred1 of 27: entropic_deregister_compactor1
entropic_deregister_compactor rejects NULL handleabsentinferred1 of 27: entropic_deregister_compactor1
entropic_get_default_compactor exercises check_compactor + nulls outsabsentinferred1 of 27: entropic_get_default_compactor1
entropic_get_default_compactor on NULL handle returns INVALID_HANDLEabsentinferred1 of 27: entropic_get_default_compactor1
entropic_get_default_compactor on configured handle returns OK + NULL fn (gh#76)absentinferred1 of 27: entropic_get_default_compactor1
entropic_get_default_compactor on unconfigured handle returns INVALID_STATEabsentinferred1 of 27: entropic_get_default_compactor1
entropic_get_default_compactor rejects NULL handleabsentinferred1 of 27: entropic_get_default_compactor1
entropic_register_compactor on unconfigured handle returns INVALID_STATEabsentinferred1 of 27: entropic_register_compactor1
entropic_register_compactor rejects NULL handleabsentinferred1 of 27: entropic_register_compactor1
entropic_register_compactor with NULL identity maps to global fallback (gh#76)absentinferred1 of 27: entropic_register_compactor1
entropic_register_compactor with valid fn succeeds on configured handleabsentinferred1 of 27: entropic_register_compactor1
entropic_context_usage on a configured engine returns valid pairabsentinferred4 of 27: context_usage, count_message, count_messages, count_text2
entropic_context_usage on configured handle returns OK or INVALID_STATEabsentinferred4 of 27: context_usage, count_message, count_messages, count_text2
entropic_context_usage on null handle returns INVALID_HANDLEabsentinferred4 of 27: context_usage, count_message, count_messages, count_text2
entropic_context_usage on unconfigured handle returns INVALID_HANDLEabsentinferred4 of 27: context_usage, count_message, count_messages, count_text2
entropic_context_usage rejects NULL handleabsentinferred4 of 27: context_usage, count_message, count_messages, count_text2
entropic_context_usage with null out params returns INVALID_ARGUMENTabsentinferred4 of 27: context_usage, count_message, count_messages, count_text2
gh#158: metrics and context reads are safe during live runsabsentinferred4 of 27: context_usage, count_message, count_messages, count_text2
Basic response contains no special tokensabsentinferred8 of 274
Batch generation worksabsentinferred8 of 274
Budget-exhausted forced complete sets terminal_reason metadataabsentinferred8 of 274
Circuit breaker limits tool calls per turnabsentinferred8 of 274
Compaction fires when context exceeds thresholdabsentinferred8 of 274
Compaction triggers at thresholdabsentinferred8 of 274
Context accumulates across turnsabsentinferred8 of 274
Context anchors persist across runsabsentinferred8 of 274
Delegation directive triggers child loopabsentinferred8 of 274
Delegation wiring fires on_delegation_start callbackabsentinferred8 of 274
Dynamic identity creation and generation through engine loopabsentinferred8 of 274
Empty response handled gracefullyabsentinferred8 of 274
Engine state transitions include PLANNING and EXECUTINGabsentinferred8 of 274
Finish reason length continues loopabsentinferred8 of 274
Generate is called exactly once per iterationabsentinferred8 of 274
Hooks fire in correct order during a generation cycleabsentinferred8 of 274
Interrupt stops loopabsentinferred8 of 274
MCP authorization denial propagates through engineabsentinferred8 of 274
Max iterations stops loopabsentinferred8 of 274
Metrics accurate after runabsentinferred8 of 274
Multi-turn engine calls retain contextabsentinferred8 of 274
Root conversation created at run() init when storage wired (gh#48)absentinferred8 of 274
Route callback is invoked for tier selectionabsentinferred8 of 274
Routing fires on_tier_selected callbackabsentinferred8 of 274
Single iteration completesabsentinferred8 of 274
Single-turn engine loop produces coherent responseabsentinferred8 of 274
State transitions IDLE->PLANNING->EXECUTING->COMPLETEabsentinferred8 of 274
Streaming generation worksabsentinferred8 of 274
Streaming interrupt propagates to backend cancel chain absentinferred8 of 274
Tier routing fires callbackabsentinferred8 of 274
Tool call cycle: generate, parse, execute, generateabsentinferred8 of 274
Tool call cycle: generate, parse, execute, regenerateabsentinferred8 of 274
True end-to-end: real prompts, real engine, real modelabsentinferred8 of 274
a context-overflow refusal fails the turn instead of retrying itabsentinferred8 of 274
auto_chain child sets COMPLETE at depth > 0absentinferred8 of 274
auto_chain does not fire without configabsentinferred8 of 274
auto_chain root fires tier change at depth 0absentinferred8 of 274
budget_exhausted child is relayed partial to lead (E2)absentinferred8 of 274
delegation guards reject depth/cycle/repeat/pipeline-depthabsentinferred8 of 274
delegation snapshot + per-tier metrics accumulationabsentinferred8 of 274
gh#105: constitutional validator's toolless render must NOT clobber absentinferred8 of 274
gh#111: a delegation whose child produces raw UTF-8 content does not absentinferred8 of 274
gh#111: a tool call whose arg carries raw UTF-8 is preserved, not absentinferred8 of 274
gh#111: raw UTF-8 in backend-cleaned content is sanitized before it absentinferred8 of 274
gh#119: delegation auto-complete folds child summary into lead's absentinferred8 of 274
gh#121: zero-tool-call correction names tier's actual toolsabsentinferred8 of 274
gh#123 part 1: zero-tool-call counter resets after genuine tool call progressabsentinferred8 of 274
gh#123 part 2: zero-tool-call ceiling is per-tier configurableabsentinferred8 of 274
gh#123 part 3: prose-only nudge turn does NOT set failure_reason in metadataabsentinferred8 of 274
gh#123 part 4: ChildContextInfo.max_consecutive_empty_turns_override wired through engineabsentinferred8 of 274
gh#158: two concurrent runs accumulate metrics safelyabsentinferred8 of 274
gh#160: an isolated delegation never writes the project, and absentinferred8 of 274
gh#162: a delegate seeded with context answers from the named absentinferred8 of 274
gh#162: resume by target picks that tier's latest delegationabsentinferred8 of 274
gh#169: a capped loop carries its last real content, annotatedabsentinferred8 of 274
gh#169: a capped loop that produced nothing stays distinguishableabsentinferred8 of 274
gh#169: the parent relay receives the capped child's real workabsentinferred8 of 274
gh#181: a hard cut with nothing substantive stays distinguishableabsentinferred8 of 274
gh#181: a thinking-budget hard cut carries the run's real contentabsentinferred8 of 274
gh#181: the parent relay receives the hard-cut child's real workabsentinferred8 of 274
gh#183: a fresh top-level run still clears a stale interruptabsentinferred8 of 274
gh#183: a tier's identity overrides reach a top-level runabsentinferred8 of 274
gh#209/#212: a turn that ends in ERROR records why, for the callerabsentinferred8 of 274
gh#77: entropic.complete is terminal when emitted with sibling pipelineabsentinferred8 of 274
gh#80: a tool call resets the budget windowabsentinferred8 of 274
gh#80: budget off (default) does not gate a tool-call-free spiralabsentinferred8 of 274
gh#80: tokens budget nudges then hard-cuts a tool-call-free spiralabsentinferred8 of 274
gh#81: interrupt during tool processing halts before pending dispatchabsentinferred8 of 274
gh#81: run_loop(inherit_interrupt=false) clears a stale interruptabsentinferred8 of 274
gh#81: run_loop(inherit_interrupt=true) preserves a pre-set interruptabsentinferred8 of 274
gh#84 combined: should_stop halts the loop when the duplicate absentinferred8 of 274
gh#84: a successful tool call DOES reset the budgetabsentinferred8 of 274
gh#84: rejected-duplicate tool calls do NOT reset the budgetabsentinferred8 of 274
gh#88 combined: process_tool_results defangs a meta {action} absentinferred8 of 274
gh#88: a gemma multi-turn session never accumulates a parrotable absentinferred8 of 274
hook dispatch: info / PRE_GENERATE cancel / POST_GENERATE rewrite / ON_ERRORabsentinferred8 of 274
last_loop_metrics populated after runabsentinferred8 of 274
max_iterations override caps loop before global limitabsentinferred8 of 274
queue capacity / cap mutation / clear / observer / state slotabsentinferred8 of 274
resume_delegation failure paths surface typed errorsabsentinferred8 of 274
set_storage wiring covers init_session_conversation pathsabsentinferred8 of 274
should_auto_chain false when no locked tierabsentinferred8 of 274
v2.14.6: a lead that answers in prose is nudged, and its forced absentinferred8 of 274
v2.14.6: after a nudge, a tier that owes a tool call is forced to make oneabsentinferred8 of 274
v2.14.6: an empty turn is retried, never accepted as completeabsentinferred8 of 274
v2.14.6: the model's own tool call stays in the history it is shownabsentinferred8 of 274
v2.14.6: with thinking on, each loop turn ends in a real tool callabsentinferred8 of 274
validation_provider variants are all non-fatalabsentinferred8 of 274
zero-tool-call with explicit_completion halts within retry capabsentinferred8 of 274
gh#182: a model-supplied max_turns bounds the delegated childabsentinferred8 of 275
v2.14.6: after a prose answer is nudged, the forced retry may only absentinferred8 of 275