Skip to content

[BUG] Session rollover bypasses compaction backoff and rolls over on a failed summary #1592

Closed

Description

@edenreich

Summary

Session rollover (internal/conversation/session_rollover.go) runs at the top of every headless turn and compacts with force=true, which bypasses the backoff added in #1584, and it rolls the session over even when the summary failed. Its gate also estimates over a different message set than it compacts. Split out of #1586, where this explains the force: true on every auto compaction and the five compaction_started in six minutes.

Steps to Reproduce

  1. Run infer headless with compact.enabled: true, a model with a known context window and a conversation past auto_at percent of it.
  2. Make the summary request fail (for example an unreachable summary model).
  3. Watch the next turns.

Expected Behavior

One compaction_started, one compaction_failed, then the backoff from #1584 holds for buffer_size turns. No new session is created while the summary fails.

Actual Behavior

  • maybeRolloverSession (internal/agent/loop/utils.go) calls PerformRollover every turn, which calls OptimizeMessages(messages, model, true). The !force guard in OptimizeMessages skips inBackoff(), so the summary is retried on every turn.
  • PerformRollover ignores whether the optimizer reduced anything. On failure it logs "optimizer returned no reduction, copying messages as-is", still calls StartNewConversation and copies the full history into the new session, so each failed attempt also churns the session and the group index.
  • ShouldRollover estimates over all entries including hidden system reminders, while PerformRollover drops hidden entries first. The run in [TASK] Spike: why the compaction trigger estimate exceeds the provider's prompt_tokens #1586 shows the gate firing at an estimate above 500k and the compaction it started reporting current_tokens: 497420 under the 500k threshold.

Activity

  1. added
    bug
    on Oct 20, 2026
  2. added theissue type on Oct 20, 2026
  3. moved this from Todo to QA in 2026on Oct 20, 2026
  4. moved this from QA to Done in 2026on Oct 20, 2026
  5. inference-gateway-releaser commented on Oct 20, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.234.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions