Conversation
Internal compaction summaries are assistant messages marked with summary: true. The ACP event layer forwarded their text and reasoning parts as ordinary agent output because part metadata did not track the summary flag. Track summary on recorded part metadata, only reuse cached part metadata once the summary decision is known, and skip replaying the content of summary messages during session/load. Internal compaction and summary storage are unchanged. Related to anomalyco#40494.
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
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.
Issue for this PR
Related to #40494. This does not close it: it takes a different (narrower) approach than the one suggested in the issue.
Type of change
What does this PR do?
Auto-compaction creates an internal assistant message with
summary: true. The ACP layer forwarded its text and reasoning parts to chat clients as ordinary agent output because the ACP part-metadata cache never tracked the summary flag, so both livemessage.part.deltaupdates andsession/loadreplay leaked internal compaction content.This patch filters internal summaries directly, rather than passing a summary marker through ACP or adding lifecycle notifications as suggested in #40494. No public ACP protocol field is added, and compaction plus summary storage are unchanged.
packages/opencode/src/acp/session.ts: add an optionalsummaryboolean toKnownMessagePartMetadataandRecordPartMetadataInput, and persist it inrecordPartMetadata.packages/opencode/src/acp/event.ts:summary = role === "assistant" && info.summary === trueexplicitly (falsefor other messages), so "known non-summary" is distinct from "not yet inspected".agent_message_chunkoragent_thought_chunk. A reasoningpart.updatedstill cachesrole: "assistant", so the summary decision is re-derived instead of trusted from that cache.replayMessagekeeps recording part metadata but skips replaying the content of a summary assistant message, so later deltas for those parts stay filtered.#42316fixes the same class of leak for CLI JSONL output; this patch covers the ACP path.How did you verify your code works?
Added regression tests in
packages/opencode/test/acp/event.test.ts:part.updated;session/loadreplay suppresses summary text and reasoning;Existing tests that build known normal part metadata directly now record
summary: false, and the reasoning-delta service test provides a message fixture instead of weakening the filter.On this machine with Bun 1.3.14 and locked dependencies:
bun test test/acp/ --timeout 30000 --only-failures-> 146 pass, 0 fail.bun typecheck-> clean.git diff --checkclean.Not verified against a real chat client deployment (e.g. a bridge forwarding ACP updates).
Checklist