Skip to content

[FEATURE]: Async background compaction — don't block chat input #27359

Closed as not planned

Description

@4nur44g

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Problem

When auto-compaction fires (compaction.auto: true), it runs synchronously in the session loop, freezing the prompt input until it completes. On slow models or large contexts, this can lock the user out for minutes. The TUI becomes unresponsive and you can't even type.

Proposed behavior

  • Compaction runs as a background job — user keeps chatting uninterrupted
  • New messages sent during compaction get appended to the uncompacted history
  • Once compaction finishes, the old history gets replaced by the compacted summary
  • A toast or indicator shows "Compacting…" while it runs
  • On completion, emit session.compacted and swap in the compacted context

Existing foundation

SDK already defines CompactionPart and EventSessionCompacted — the event plumbing is there, only the execution path needs to become non-blocking.

Config

Could expose a toggle (default false for safety):

"compaction": {
  "auto": true,
  "background": true
}

Activity

  1. github-actions commented on May 13, 2026

    @github-actions
    Contributor

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

    Please close one of the two issues to avoid splitting the discussion.

  2. github-actions commented on Jul 13, 2026

    @github-actions
    Contributor

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

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