altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

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

Open sahrizvi opened this issue 4 weeks ago • 0 comments

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.

sahrizvi avatar Nov 06 '26 18:11 sahrizvi