fix(agent): frame compaction handoff sections as historical context#44345
Closed
konsisumer wants to merge 1 commit into
Closed
fix(agent): frame compaction handoff sections as historical context#44345konsisumer wants to merge 1 commit into
konsisumer wants to merge 1 commit into
Conversation
Contributor
|
Code Review — Positive Verification Reviewed the full diff across What was checked:
Verdict: Clean. The rename from imperative headings ("Active Task", "Remaining Work") to historical framing ("Historical Task Snapshot", "Historical Remaining Work") directly addresses the stale-task-hijack failure mode documented in #35344 — models treating inherited compaction handoffs as live instructions. Well-structured refactoring with comprehensive test coverage. |
This was referenced Jun 11, 2026
Merged
Contributor
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.
What does this PR do?
Reframes persisted context-compaction summaries so earlier work is serialized under explicitly historical section headings instead of live-sounding
## Active Task/## Pending User Asks/## Remaining Worklabels. This reduces the chance that a resumed or long-idle conversation treats stale compaction handoff text as the current instruction.Related Issue
Refs #42812
Type of Change
Changes Made
agent/context_compressor.py: introduced historical handoff heading constants and updated the compaction prefix, fallback summary body, and LLM summary template to use historical section names.tests/agent/test_summary_prefix_semantics.py: added coverage that the prefix references historical headings and no longer names active-sounding sections.tests/agent/test_resume_stale_active_task.py: updated resumed-handoff regression fixtures to the new historical task heading.tests/agent/test_context_compressor.py: updated fallback-summary assertions to match the historical heading.tests/agent/test_context_compressor_temporal_anchoring.py: updated structured-template assertion to match the historical heading.How to Test
pytest tests/agent/test_summary_prefix_semantics.py tests/agent/test_resume_stale_active_task.py tests/agent/test_context_compressor.py tests/agent/test_context_compressor_temporal_anchoring.py -q.## Historical Task Snapshot,## Historical Pending User Asks, and## Historical Remaining Workinstead of the old active-sounding headings.pytest tests/ -q -x --timeout=60currently aborts during collection ontests/hermes_cli/test_dashboard_auth_401_reauth.pybecausefastapiis missing in this environment.What platforms tested on
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
110 passed in 8.61s.ruffchecks passed on the changed Python files.python scripts/check-windows-footguns.py --allpassed.git diff --checkpassed.fastapiduring collection oftests/hermes_cli/test_dashboard_auth_401_reauth.pyin this local environment.