GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Overflow compaction produces incomplete summaries in tool-heavy sessions · Issue #20246 · anomalyco/opencode

Overflow compaction produces incomplete summaries in tool-heavy sessions #20246

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Overflow compaction produces incomplete summaries in tool-heavy sessions#20246
Copy link
Assignees
rekram1-node

Description

@jphpeete
jphpeete
opened on Mar 31, 2026
Issue body actions

When a session primarily uses tool-based interactions (e.g. the question tool) rather than direct user messages, overflow compaction produces a summary that only covers the beginning of the conversation.

Steps to reproduce:

  1. Start a session and send one message
  2. Interact extensively through tool calls (question tool, etc.) — the model loops many times creating assistant messages, but no new user messages are created
  3. Hit the provider's context limit (e.g. 200K tokens on GitHub Copilot) so overflow compaction triggers

Expected: The summary covers the full session including all tool interactions.

Actual: The summary only covers the very beginning of the session. All tool interaction context from after the initial user message is lost.

Root cause:
The replay-point search in processCompaction (packages/opencode/src/session/compaction.ts) walks backward looking exclusively for role === "user" messages. In sessions where interactions happen through tool responses (stored as tool parts on assistant messages), user messages are rare. The search skips over all assistant turns and lands on the initial user message, causing messages.slice(0, i) to either produce an empty array (triggering the fallback) or a tiny prefix of the session.

Activity

  1. github-actions
    assigned
    rekram1-node
    on Mar 31, 2026
  2. github-actions
    added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 31, 2026
  3. github-actions commented on Mar 31, 2026

    @github-actions
    github-actionsBot
    on Mar 31, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • bug: control user messages are treated as real user history #19319: Also describes how role === "user" checks in compaction/history logic incorrectly handle synthetic or sparse user messages — the root cause overlaps with what you describe in processCompaction's replay-point search.
  4. alario-tang commented on Mar 31, 2026

    @alario-tang
    alario-tang
    on Mar 31, 2026
    More actions

    This feels related to how replay-point selection and compaction fallback interact in tool-heavy sessions.

    If the summary is incomplete in tool-heavy history, one likely reason is that the current compaction flow has limited options once the summarize set becomes awkwardly large or noisy:

    • strip media
    • summarize
    • replay a prior user turn if possible
    • stop if compaction itself still overflows

    A more robust path here may be:

    • aggressively prune older completed tool output before summary generation
    • if compaction still overflows, retry compaction with progressively less early history
    • preserve stronger continuity metadata for the immediate next turn

    That would probably improve both compact quality and continuation quality in tool-heavy sessions.

  5. jphpeete commented on Mar 31, 2026

    @jphpeete
    jphpeete
    on Mar 31, 2026
    Author
    More actions

    Agreed on the pruning and retry ideas — those would help with compaction quality regardless of how the split point is chosen.

    The PR (#20247) addresses the immediate split-point issue: in tool-heavy sessions the backward walk only matches role === "user" messages, so it jumps over all assistant turns and slices at the start of the conversation. The fix checks for finished assistant turns first, which finds a split point close to the overflow and keeps most of the session in the summary.

    The pruning/retry improvements you describe would be good follow-ups on top of this — especially for sessions where even with a good split point, the summarization input is still large.

  6. thdxr
    removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  7. github-actions commented on Jul 4, 2026

    @github-actions
    github-actionsBot
    on Jul 4, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  8. github-actions
    closed this as not plannedon Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.