refactor(context_compressor): extract summary kernel and preserve compatibility - #81181
refactor(context_compressor): extract summary kernel and preserve compatibility#81181andrexibiza wants to merge 11 commits into
Conversation
…ll-prune Wave-2 dual REQUEST_CHANGES agreed LB2 skill-prune cannot extract first: it calls _redact_compaction_text and _content_text_for_contains (cycle). Move those two pure leaves into context_compressor_text_utils.py with is-identical re-export through the godfile. Golden bodies byte-exact. Part of NousResearch#78645 Part of NousResearch#78647 Signed-off-by: Andrex Ibiza <andrexibiza@users.noreply.github.com>
… (LB2) Wave-2 redraw: banner-inclusive window 404-618 (golden ec5defbef6a402ad302b28369c81f5f9182162f1c8353b231d2d863fe59305c0) into context_compressor_skill_prune.py. Deps on the two text-util leaves now import one-way from context_compressor_text_utils — no cycle. 12 members re-exported is-identical through the godfile. 35/35 targeted tests green. Part of NousResearch#78645 Part of NousResearch#78647 Signed-off-by: Andrex Ibiza <andrexibiza@users.noreply.github.com>
Window 420-649 (current numbering; pin 616-868 minus the text-util leaf) into context_compressor_budget.py. HISTORICAL_TASK_HEADING moves with the cluster (sole external dep, re-exported is-identical). 29 members re-exported through the godfile. 39/39 targeted tests green. Part of NousResearch#78645 Part of NousResearch#78647 Signed-off-by: Andrex Ibiza <andrexibiza@users.noreply.github.com>
Window 446-668 (banner-inclusive; pin 870-1111 minus leaves) into context_compressor_media.py. 9 members re-exported is-identical through the godfile; deps on typing/json/turn_context only (one-way). 43/43 targeted tests green. Part of NousResearch#78645 Part of NousResearch#78647 Signed-off-by: Andrex Ibiza <andrexibiza@users.noreply.github.com>
Window 459-634 (def-aligned; pin 1114-1289 per W2 redraw) into context_compressor_summarizers.py. 3 members re-exported is-identical; logger dep via lazy round-trip import (auth s2 seam pattern, zero behavior change); skill-prune deps one-way from skill_prune module. 47/47 targeted tests green. Part of NousResearch#78645 Part of NousResearch#78647 Signed-off-by: Andrex Ibiza <andrexibiza@users.noreply.github.com>
Window 1307-1422 (class attrs + 5 static/instance methods) into ContextCompressorThresholdMixin (MRO seam, SessionTitleMixin precedent). Mixin composed into ContextCompressor bases; members resolve is-identical through the class. One class-name reference retargeted to the mixin. Deps one-way on budget module + model_metadata. 52/52 targeted tests green. Part of NousResearch#78645 Part of NousResearch#78647 Signed-off-by: Andrex Ibiza <andrexibiza@users.noreply.github.com>
Window 762-1203 (pin 1589-2030) into ContextCompressorDurableGuardsMixin. Mixin composed BEFORE ContextEngine in bases so its on_session_end/start shadow the base (as the godfile's own defs did) — MRO pitfall documented in seam test. 15 members resolve is-identical through the class. Deps: typing + time (stdlib). 70/70 targeted tests green. Part of NousResearch#78645 Part of NousResearch#78647 Signed-off-by: Andrex Ibiza <andrexibiza@users.noreply.github.com>
…cope Blind review lanes caught: sqlite3/json used in exception handlers but not imported; PROACTIVE_PRUNE_REARM_MODEL_CONFIG_KEY co-moved at class scope but imported at module level; logger used without binding. Fix: module-level json/sqlite3 imports, constant at module scope, lazy round-trip logger imports per method (summarizers pattern). 70/70 green. Part of NousResearch#78645 Part of NousResearch#78647 Signed-off-by: Andrex Ibiza <andrexibiza@users.noreply.github.com>
…mixin Round-1 blind 5/5 REQUEST_CHANGES confirmed the import gaps; Pass E additionally caught UnboundLocalError: lazy logger import sat inside the first except clause while sibling except clauses also used logger. Move the round-trip import to the first statement of each method body so logger is bound before any branch. 94/94 targeted tests green. Part of NousResearch#78645 Part of NousResearch#78647 Signed-off-by: Andrex Ibiza <andrexibiza@users.noreply.github.com>
Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
|
LB8 bidirectional interlock — summary-kernel shard. Primary nodes:
Repair/final validation:
Scope:
This shard is one step toward the 2,000-line law. Related compressor shard PRs: #80626 #80628 #80634 #80636 #80644 #80645 #81074 Reverse-link requirement: #81105, #78645, and #78647 must each reference PR #81181 and keep the campaign table current. |
|
LB8 partial-run conjoin / supersession receipt. The earlier selected-candidate thread ( Surviving implementation: PR #81181, fork head The replacement passed parent verification and the post-repair 5×2×3 cross-check: 5/5 APPROVE. This comment conjoins the partial candidate posts to the repaired PR without deleting or rewriting the historical record. The shard remains one step toward the 2,000-line law; no final god-kill is claimed. |
refactor(context_compressor): extract summary kernel and preserve compatibility
|
Summary
Extract the graph-authorized ten-method summary/provenance kernel from
agent/context_compressor.pyintoContextCompressorSummaryKernelMixin, with compatibility synchronization for reloads and legacy monkeypatch surfaces.Commits
57570954260b370c5d9b4ac4ba0223f71e4fd880e40f2db1402cb629dedcff57e656dee439bb51c34effdf33967f49f19069c00c5b5348fd8c10539bgfg/cc-lb8-summary-repairExact scope
agent/context_compressor.py:2771–293232b86ff4151753a2a1bf1793090a145af18f485f308f0e0fb7f8e180a619b1bcagent/context_compressor.py: 5,350 lines; this shard is one step toward the hard 2K invariant and does not claim final god- compliance.Parent receipts
Interlock targets
Shard issue: refactor(context_compressor): extract summary kernel (LB8) #81105
Feature Package tracker: Repo-wide godfile eradication: residual 2K tasks after #102117 #78647
Prior compressor shard PRs: refactor(context_compressor): extract text-util leaves into context_compressor_text_utils #80626 refactor(context_compressor): extract skill-prune/ghost-skill cluster (LB2) #80628 refactor(context_compressor): extract token-budget estimators into context_compressor_budget (LB3) #80634 refactor(context_compressor): extract content/media strip helpers (LB4) #80636 refactor(context_compressor): extract threshold coercion mixin (LB7) #80644 refactor(context_compressor): extract tool-result summarizers (LB5a) #80645
Related collider/base-drift nodes: fix(agent,cli): case-insensitive context length lookup, multimodal token estimation, /q alias #6648 fix(context_compressor): harden tool-call previews in summaries #12588 Fix long-context compression with hierarchical summaries #25716 feat(context_compressor): add compression efficiency ratio logging #29859 fix(compression): attribute auxiliary failures to the actual wire route #72637 fix: add usedforsecurity=False to hashlib.md5 in context_compressor (#FIPS) #74632
Gate
This PR supersedes the pre-repair candidate thread and is filed from the fork branch after unanimous 5×2×3 validation. The prior candidate evidence remains preserved as historical provenance; it does not represent the shipped head. No final god- is claimed: the residual file remains above 2,000 lines.