Skip to content

fix(agent): skip compression when latest summary leaves no messages to summarize - #59737

Closed
ms-alan wants to merge 1 commit into
NousResearch:mainfrom
ms-alan:fix/59496-context-compression-empty-window
Closed

fix(agent): skip compression when latest summary leaves no messages to summarize#59737
ms-alan wants to merge 1 commit into
NousResearch:mainfrom
ms-alan:fix/59496-context-compression-empty-window

Conversation

@ms-alan

@ms-alan ms-alan commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Closes #59496

When a persisted handoff summary sits in the protected head after resume, the compression window recomputes turns_to_summarize as an empty slice. Previously Hermes would call _generate_summary([]), which triggers a noisy 'Context compression aborted' warning with no actual data loss.

This adds an early-return guard immediately after the slice is recomputed, mirroring the earlier compress_start >= compress_end no-op path and avoiding an unnecessary context engine request.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state duplicate This issue or pull request already exists labels Jul 6, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #59526 — both add the identical if not turns_to_summarize: early-return guard at the same site in agent/context_compressor.py (verified from the diffs), and both close #59496. #59526 is the earlier (opened 09:31 vs this PR's 16:07) and still-open canonical PR; #59526 also carries a regression test. Marking this later PR as a duplicate for tracking — maintainer to pick.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused compression no-op guard. Current main still recomputes the post-handoff slice at agent/context_compressor.py:3105-3108 and calls _generate_summary(...) unconditionally at agent/context_compressor.py:3139-3141, so the proposed guard addresses a real path.

Problems

  • This branch has no regression test. The existing protected-head continuity case in tests/agent/test_context_compressor_summary_continuity.py:72-87 verifies a non-empty update path, not the empty post-handoff window.

Suggested changes

  • Add a test that fixes the tail cut directly after the latest handoff summary and asserts no summary call occurs, the original messages are returned, and ineffective-compression accounting is updated.

This is an automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform area/compression Context compression and continuation sessions labels Jul 15, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks @ms-alan — you independently identified the empty post-handoff window bug (and the correct early-return site). The fix landed via salvage PR #70251, built on #59526 which was the 7-hours-earlier duplicate carrying a regression test — per our earliest-submitter convention that PR was the vehicle, but your identification is credited in the salvage PR body. Closing as landed on main.

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

Labels

area/compression Context compression and continuation sessions comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Context compression calls context engine with empty window after summary boundary adjustment

3 participants