Skip to content

Compaction replay injects fake user message "What did we do so far?" causing unwanted summary generation #13838

@jdocker8

Description

@jdocker8

Description

When a session is compacted (via /compact or auto-compaction), resuming the session injects a synthetic user message "What did we do so far?" into the conversation. This causes the model to treat it as a real user request and generate a long summary/recap — even when the user's rules explicitly prohibit summaries.

Root cause

Found via strings on the compiled binary (v1.2.5):

if (part.type === "compaction") {
  userMessage.parts.push({
    type: "text",
    text: "What did we do so far?"
  });
}

This string appears twice in the binary (likely two code paths for provider-specific message formatting).

Steps to reproduce

  1. Start a session with significant context
  2. Run /compact (or let auto-compaction trigger)
  3. Continue the session — the model receives "What did we do so far?" as a user message
  4. The model responds with a full summary, even if the user didn't ask for one

Impact

  • Wastes tokens on an unwanted summary response
  • Violates user-defined rules (e.g. "no summaries or recaps" in AGENTS.md)
  • Confusing UX — the user sees a response to a question they never asked
  • The model may reference this fake message in reasoning ("the user asked what we did so far")

Suggested fix

Instead of injecting a fake user prompt, the compaction summary could be:

  • Injected as a system message (not a user message)
  • Use a more neutral framing like "[Session context restored from compaction]" that doesn't prompt the model to generate a response
  • Or simply replay the compaction content as an assistant message without a corresponding user message

Environment

  • OpenCode v1.2.5
  • macOS arm64
  • Model: claude-opus-4.6 via github-copilot

Metadata

Metadata

Assignees

No one assigned

    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