Skip to content

Session title attempt counter reads the compacted history, so compaction resets the five-attempt bound and the title context #1692

Open

Description

@sahrizvi

Found during the consensus and release reviews of #1688 "fix(session): retry a failed session title on later turns and report why it failed". Deferred as edge input: the worst outcome is a late or odd title, or the placeholder, which is what the code before #1688 always kept.

What happens

ensureTitle in packages/opencode/src/session/prompt.ts derives attempt from the number of real user messages in the filtered history and stops after five. The history it sees is the compacted view, so:

  • a compaction lowers the count and the five-attempt bound restarts;
  • after a compaction the first "real" message can be the compaction marker, so a retry describes the marker rather than the conversation's start;
  • a message that joins a running loop advances the count without sending a request, and the attempt value in title_generation_failed telemetry is then not the number of requests made.

Expected

Count title attempts per session (for example in the session's metadata or the in-flight set), independent of compaction, and always build the title context from the conversation's first real user message even after compaction.

Activity

  1. self-assigned this
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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