Repository navigation
feat(acp): report compaction with standard session updates - #52737
Merged
Merged
Conversation
This was referenced Oct 6, 2026
Ichinose-Kazuki
pushed a commit
to Ichinose-Kazuki/opencode
that referenced
this pull request
Oct 7, 2026
3 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why the change
ACP now defines standard
compaction_updateandcompaction_summary_chunksession updates, so clients that support them can show a compaction where it happened, stream its summary, and rebuild it onsession/load, instead of reading opencode's private_metamarker.Special things to note
initializehasclientCapabilities.session.compactionset to an object. If it is missing ornull, the client gets the existing_meta["opencode/compaction"]marker, unchanged, except that a compaction abandoned by a cancelled turn's wind-down now closes asfailedwith anabortederror instead of stayingstarted.packages/tui/src/routes/session/index.tsx:2022-2023, 2064-2077), the mini TUI streams it from the deltas (packages/tui/src/mini/stream-v2.transport.ts:1094-1110), and the app (packages/session-ui/src/message/message-content.tsx:405, 442-450). A provider's encrypted native compaction has no summary, so it sendssummary: null.opencode/child-session-updatesget standard updates inside those notifications.Change outline
Core to ACP mapping, all in
ACPCompaction:inputIDfor/compact, otherwise derived from the event ID, the same ID the marker'smessageIduses)compactionIdsession.compaction.startedstatus: "in_progress"session.compaction.deltacompaction_summary_chunk, only while the compaction is opensession.compaction.ended/ completed messagecompleted,summary: [text], ornullwhen the summary is emptyabortedorcompaction.interruptedcancelled,summary: nullfailed,summary: null,error: message(a defect's pretty-printed cause becomes"Compaction failed")Live and replay:
Cancel: if the server's wind-down reports the interruption, the compaction settles as
cancelled. If the wind-down times out,abandonsettles the session's open compaction through the same builder before the prompt response (cancelledin standard mode, theabortedmarker otherwise). Child compactions keep going and are reported by the consumer that follows children after the turn.packages/cli/src/acp/ +├── compaction.ts # compaction types, core→ACP mapping, standard vs marker choice, start/chunk/settle/abandon/replay builders ├── translate.ts # routes compaction events to ACPCompaction ├── turn.ts # `abandon` replaces `abandonTools`; `run` reads the capabilities ├── service.ts # stores `compaction` from initialize; replay reads capabilities once └── agent.ts # initial `compaction: false`Tests in
packages/cli/test/acp/compaction.test.tsrun over the wire fixture:in_progressthenfailed), a defect giving the generic error, and chunks outside an open compaction being dropped.abandonafter a timeout, in both standard and marker mode.nullcapability falls back to the marker.