Skip to content

feat(desktop): support manual context compaction in Side Conversations #4521

Description

@1625567290

Problem

Desktop supports manual context compaction through an exact /compact command in the main conversation, but Side Conversations do not dispatch slash commands. Entering /compact in a Side Conversation is sent as an ordinary prompt when idle or as steering text while a Turn is running.

A Side Conversation can begin with a large copied context and then accumulate several turns of its own. When that temporary Session approaches its context limit, the user has no way to request compaction for it. Closing the tab removes the temporary fork and its transcript; compacting the source Session targets the wrong conversation.

Runtime Host already exposes Session-scoped context compaction and does not exclude a Session because it carries mode:side_conversation. The missing boundary is Desktop Side Conversation command admission and presentation.

Desired outcome

Support the exact /compact command in a committed, idle Side Conversation and route it to the existing context-compaction operation for that companion Session.

  • Recognize /compact before ordinary send or mid-Turn steering.
  • Target the Side Conversation fork ID, never the source Session ID.
  • Do not persist /compact as a user message or steering message.
  • Use the same Runtime Host admission and compaction semantics as an ordinary Session.
  • Show the same started, completed, unchanged, and failed feedback as the main conversation, attributed to the Side Conversation that requested it.
  • Preserve the Side Conversation transcript, draft, staged quotes, pending attachments, model, permission mode, and temporary-session identity.
  • If the fork is still preparing or has an active Turn, reject the command cleanly without consuming the draft or sending text to the model.
  • Keep existing cross-model checkpoint compatibility rules when the Side Conversation has changed models.

Acceptance criteria

  1. Submitting exact /compact in an idle, committed Side Conversation invokes context compaction with the companion Session ID.
  2. The source Session receives no message, Turn, checkpoint, or configuration change from that command.
  3. /compact never appears in the Side Conversation transcript and is never delivered as Steer input.
  4. Asynchronous compaction remains visibly in progress until its terminal outcome is delivered, without duplicate completion feedback.
  5. Preparing, running, archived, unavailable, and failed compaction paths preserve the current draft, quotes, and attachments and remain retryable where applicable.
  6. Closing the Side Conversation continues to remove the temporary fork and its compaction state through the existing cleanup path.

Alternatives or workarounds

  • Close and reopen the Side Conversation. This discards the temporary transcript instead of compacting it.
  • Compact the source Session. This mutates a different Session and does not reduce the Side Conversation's own accumulated history.
  • Rely only on automatic compaction. This removes the explicit recovery and control surface that ordinary Desktop conversations already provide.

Non-goals

  • Adding every Desktop slash command to Side Conversations
  • Changing automatic compaction thresholds or checkpoint formats
  • Making Side Conversations durable across restart
  • Promoting a Side Conversation to an ordinary Session
  • Changing model selection, permissions, or cleanup ownership

This is a focused Side Conversation command-parity follow-up under #4331 and is independent of the model-selection work in #4495.

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