-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Description
When a thread auto-compacts (or when the user runs /compact), users lose visibility into what the model now actually has in-context. This makes it very hard to understand or debug behavior changes after compaction, and it erodes trust when the agent forgets/denies earlier work.
A concrete example is #5957, where auto-compaction caused the agent to forget it had edited files and it confidently denied having made those edits.
Current state
Recent work introduced contextCompaction as a v2 ThreadItem / item lifecycle marker (see the recent compaction work, e.g. #10034 and the item notification tests in #10123). However, contextCompaction currently only carries { id }.
At the same time, the existing thread/compacted notification (ContextCompactedNotification) can carry summary and the full compacted message (prompt), but it is now marked Deprecated: Use ContextCompaction item type instead.
Request
Please don't remove/deprecate the only user-visible carrier of compaction text until there's an equivalent replacement.
Two viable options:
- Keep
thread/compacted(ContextCompactedNotification) as a supported event (even if marked legacy), because it's extremely useful for users/UIs to show the compacted summary and/or compacted prompt. - Alternatively, extend the
contextCompactionitem to includesummary?: stringandmessage?: string(optional) so new clients can rely purely on the item stream. Thenthread/compactedcan be deprecated later with a clear timeline.
Why this matters
Showing the compacted text lets the user immediately see why the agent forgot or misunderstood something after compaction. It also helps debugging support requests, since a repro often hinges on whether compaction dropped key state.
Implementation note: for providers/paths where plaintext isn't available (e.g. remote compaction that can return encrypted content), summary/message can simply be omitted; but when available, exposing them to the UI is very valuable.
Ref:
"compaction" #10034