fix(agent): rename context compressor headers to historical markers - #42813
Closed
JerryLiu369 wants to merge 1 commit into
Closed
fix(agent): rename context compressor headers to historical markers#42813JerryLiu369 wants to merge 1 commit into
JerryLiu369 wants to merge 1 commit into
Conversation
Renames the section headers in context compression summaries from
present-tense ("Active Task", "In Progress", "Pending User Asks",
"Remaining Work") to past-tense/historical markers ("Historical Task
(prior session)", "Previous Work In Progress", "Previously Pending User
Asks", "Previous Work Remaining"). This prevents stale summaries from
being interpreted as current instructions when a session is resumed.
Updates SUMMARY_PREFIX, deterministic fallback body, structured template,
and all affected test assertions.
Refs: NousResearch#35344, NousResearch#42812
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the context-compression summary template and regression tests to rename “## Active Task” (and related sections) to explicitly historical wording, reducing the chance that inherited summaries are interpreted as current intent when resuming a session.
Changes:
- Renamed summary section headers to “Historical/Previous …” in
agent/context_compressor.py. - Updated multiple tests to assert against the new headers and updated regression narrative.
- Adjusted deterministic-fallback summary content to emit the renamed headers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| agent/context_compressor.py | Renames prompt/template section headers and conflict-resolution rule text to emphasize historical context. |
| tests/agent/test_resume_stale_active_task.py | Updates regression tests and fixtures from “Active Task” to “Historical Task (prior session)”. |
| tests/agent/test_context_compressor_temporal_anchoring.py | Updates assertion for the structured template header rename. |
| tests/agent/test_context_compressor.py | Updates assertions/comments to match the renamed section header. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+46
to
+52
| "If the latest user message is consistent with the historical summary, " | ||
| "you may use it as background. If the latest user message contradicts, " | ||
| "supersedes, changes topic from, or in any way diverges from the " | ||
| "'## Historical Task (prior session)' / '## Previous Work In Progress' / " | ||
| "'## Previously Pending User Asks' / '## Previous Work Remaining' sections, " | ||
| "the latest message WINS — discard those stale items entirely and do not " | ||
| "'wrap up the old task first'. " |
| directive cannot survive into a resumed session.""" | ||
| stale_body = ( | ||
| "## Active Task\n" | ||
| "## Historical Task (prior session)\n" |
| """The same upgrade applies to the oldest ``[CONTEXT SUMMARY]:`` handoff | ||
| format that may sit in a long-lived resumed lineage.""" | ||
| legacy = f"{LEGACY_SUMMARY_PREFIX} ## Active Task\nUser asked: 'task A'" | ||
| legacy = f"{LEGACY_SUMMARY_PREFIX} ## Historical Task (prior session)\nUser asked: 'task A'" |
Comment on lines
+1316
to
+1318
| _template_sections = f"""## Historical Task (prior session) | ||
| [THE SINGLE MOST IMPORTANT FIELD. Capture the user's most recent unfulfilled | ||
| input verbatim — the exact words they used. This includes: | ||
| input from the PRIOR session verbatim — the exact words they used. This includes: |
Comment on lines
+1363
to
+1364
| ## Previous Work In Progress | ||
| [Work currently underway in the prior session — what was being done when compaction fired] |
Comment on lines
+1381
to
+1382
| ## Previous Work Remaining | ||
| [What remains to be done — framed as historical context, not instructions] |
19 tasks
Author
|
Close per author — the rename doesn't address the root cause (raw message loading boundary in gateway, not compaction summary framing). The real fix is tracked separately. |
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.
Renames the section headers in context compression summaries from present-tense ("Active Task", "In Progress", "Pending User Asks", "Remaining Work") to past-tense/historical markers ("Historical Task (prior session)", "Previous Work In Progress", "Previously Pending User Asks", "Previous Work Remaining"). This prevents stale summaries from being interpreted as current instructions when a session is resumed.
Updates SUMMARY_PREFIX, deterministic fallback body, structured template, and all affected test assertions.
Refs: #35344, #42812