Skip to content

fix(agent): rename context compressor headers to historical markers - #42813

Closed
JerryLiu369 wants to merge 1 commit into
NousResearch:mainfrom
JerryLiu369:fix/historical-task-prefixes
Closed

fix(agent): rename context compressor headers to historical markers#42813
JerryLiu369 wants to merge 1 commit into
NousResearch:mainfrom
JerryLiu369:fix/historical-task-prefixes

Conversation

@JerryLiu369

Copy link
Copy Markdown

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

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
Copilot AI review requested due to automatic review settings June 9, 2026 11:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]
@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint labels Jun 9, 2026
@JerryLiu369

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants