fix(memory): task-aware context pruning critical fixes (#1851)#2066
Merged
fix(memory): task-aware context pruning critical fixes (#1851)#2066
Conversation
Fixes 5 critical issues in task-aware self-adaptive context pruning: 1. CRIT-1: Remove dead TaskAwareMig enum variant (was routed to TaskAware, never called MIG scoring). Fallback via FromStr with warning for backward compat. 2. CRIT-2: Add MIG eviction ordering test to verify lowest-MIG blocks evicted first. 3. CRIT-3: Enforce prune_protect_tokens in scored/MIG pruning paths (was missing). Extract common helper prune_protection_boundary(). 4. CRIT-4: Document tokio::spawn limitation for goal extraction (not cancelled on shutdown). TODO(I3) for separate PR. 5. CRIT-5: Cap goal string length at 500 chars to prevent memory explosion. Serde fix: Hand-written Deserialize impl routes through FromStr, enabling graceful fallback for config files with removed task_aware_mig variant. Tests: +31 (6065 → 6096 total) - 3 serde round-trip tests - MIG eviction ordering test - prune_protect_tokens enforcement tests (scored/MIG paths) - CLI and init wizard tests Backward compatibility: Users with strategy="task_aware_mig" in config files now receive a warning and fallback to reactive pruning. CHANGELOG updated. Docs updated (book/src/changelog.md).
Main branch added Subgoal/SubgoalMig pruning strategies (#2022). Our branch removed TaskAwareMig variant (dead code) and added hand-written Deserialize impl for graceful fallback. This merge reapplies our CRIT-1 fixes (TaskAwareMig removal + task_aware_mig fallback) while keeping the new Subgoal variants from main. Changes: - Removed TaskAwareMig variant reference (pruning_strategy was dead code) - Added hand-written Deserialize impl routing through FromStr - Added task_aware_mig → Reactive fallback with warning in FromStr - Added 3 serde round-trip tests for backward compat - Updated init.rs wizard to remove task_aware_mig option - Updated summarization.rs match statement to remove TaskAwareMig arm All tests pass, build clean.
…undary The prune_protection_boundary() helper is only used in feature-gated code (prune_tool_outputs_scored and prune_tool_outputs_mig). When building with features that don't include context-compression (server, chat, ide), the function was unreachable and caused a compiler error. Fixes Bundle Check failures for server, chat, ide bundles on PR #2066.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 5 critical issues in task-aware self-adaptive context pruning:
TaskAwareMigenum variant (was functionally identical toTaskAware). Backward compat viaFromStrfallback with warning.prune_tool_outputs_mig).prune_protect_tokensin scored/MIG pruning paths (was missing protection).tokio::spawnlimitation for background goal extraction. TODO(I3) for separate PR.Serde fix: Hand-written
Deserializeimpl routes throughFromStr, enabling graceful fallback for config files with removedtask_aware_migvariant.Validation
Tests: 6093 → 6096 (+31 new, all pass)
Validators:
Backward Compatibility
Users with
strategy = "task_aware_mig"in config files now receive:tracing::warn!message about the removalReactivepruning strategyChanges
crates/zeph-config/src/memory.rs: RemoveTaskAwareMigvariant, hand-writtenDeserializeimplcrates/zeph-core/src/agent/context/summarization.rs: Add MIG test, enforceprune_protect_tokenssrc/cli.rs,src/init.rs: Removetask_aware_migfrom CLI/wizardconfig/default.toml,book/src/changelog.md: Update documentationCHANGELOG.md: Document all 5 fixes and backward compat behaviorPre-merge checks
cargo +nightly fmt --checkcargo clippy --workspace --features full -- -D warningscargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins(6096 passed)Resolves #1851.