Repository navigation
fix(compaction): record omitted images instead of dropping them silently - #131977
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 12:26 AM ET / 04:26 UTC. ClawSweeper reviewWhat this changesThis PR records bounded text markers for image and other non-text content omitted from built-in compaction summaries, while preserving image token pressure. Merge readinessNo introduced correctness finding: the PR repairs the canonical text-summary projection and remains needed because fetched main retains the prior silent-drop behavior. Its maintainer label and member authorship require an explicit maintainer decision after the current review context and checks are complete. Priority: P1 Review scores
Verification
How this fits togetherCompaction converts older session history into text summaries for future model turns. Session entries feed the serializer, whose output is sent to normal, split-turn, and branch summarizers before the resulting summary re-enters session context. flowchart LR
A[Persisted session history] --> B[Compaction preparation]
B --> C[Text summary serializer]
C --> D[Normal and split summaries]
C --> E[Branch summaries]
D --> F[Saved compaction summary]
E --> F
F --> G[Next model context]
Decision needed
Why: This member-authored PR carries the protected maintainer label, and filtered review comments prevent automation from determining whether intervening maintainer direction exists. Before merge
Agent review detailsSecurityNone. PR surfaceSource +16, Tests +328, Docs +2, Other 0. Total +346 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one shared serializer for all built-in summary paths, correct the PR-body marker rationale, and land only after the current maintainer review context and exact-head checks are satisfied. Do we have a high-confidence way to reproduce the issue? Yes, from source: fetched main serializes image-only user and tool-result content to an empty string and skips it, while the introduced tests exercise the same preparation-to-summary path. This review did not execute the tests. Is this the best way to solve the issue? Yes. The repair belongs in the one serializer shared by normal, split-turn, and branch summaries, rather than duplicating image markers in each caller or reusing the provider-prompt history-pruning transform. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1b2ce27355b8. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
08fde19 to
0e10db7
Compare
Record bounded image and non-text omission markers in text-only summarization input, including image-only user messages and tool results. Reuse the history-pruning image vocabulary without changing token estimates, retention, original transcript rows, or private reasoning handling.
Prove that image and non-text markers add exactly 103 characters without changing visible text or tool-result truncation. Exercise misleading metadata, long unknown type names, and non-text-only messages interspersed with empty messages to protect per-message omission tracking.
Cap omission details across each summarizer request and preserve one aggregate overflow fact. Count the records in token estimates while preserving image pressure, and describe omission without claiming prior model processing. Repair findings 1 and 3 for PR #131977.
0e10db7 to
dd74b4a
Compare
|
Merged via squash.
|
…tly (openclaw#131977) * fix(compaction): record omitted images instead of dropping them silently Record bounded image and non-text omission markers in text-only summarization input, including image-only user messages and tool results. Reuse the history-pruning image vocabulary without changing token estimates, retention, original transcript rows, or private reasoning handling. * test(compaction): enforce exact omission marker bounds Prove that image and non-text markers add exactly 103 characters without changing visible text or tool-result truncation. Exercise misleading metadata, long unknown type names, and non-text-only messages interspersed with empty messages to protect per-message omission tracking. * test(compaction): use synthetic model naming in image fixtures * fix(compaction): bound and account for summary omission records Cap omission details across each summarizer request and preserve one aggregate overflow fact. Count the records in token estimates while preserving image pressure, and describe omission without claiming prior model processing. Repair findings 1 and 3 for PR openclaw#131977.
What Problem This Solves
When a session was compacted, images vanished from the summarization input with no trace. The compaction serializer returned an empty string for image blocks, and the surrounding logic then skipped now-empty user messages and tool results entirely — so an image-only turn (or an image-only tool result, e.g. a screenshot) contributed nothing to the summary and left no marker. After compaction the model could not distinguish "an image was here and was omitted" from "no image ever existed", which is exactly the silent-drop class the repo doctrine ranks worst: an action must end in a visible outcome or a recorded non-outcome.
Confirmed reachable on shipped
v2026.7.1-2, not justmain.Why This Change Was Made
The canonical serializer now records the omission before the empty-content check, so the fact survives instead of the content being dropped. Deliberately minimal and bounded:
history-image-prune([image data removed - already processed by model]) rather than a second dialect; other omitted non-text blocks use the same shape withnon-text data. (Agent-core cannot import the host runner, so the literal is duplicated, not shared.)Why the nearby correct-looking code doesn't already cover this:
history-image-prunedoes insert proper markers, but its transform rewrites the provider projection, whereas compaction re-reads the original manager branch viasessionManager.getBranch(). The compaction safeguard preserves the last three user turns with placeholders but still routes older messages and split-turn prefixes through the defective serializer.User Impact
After a compaction, summaries and rebuilt context state that an image was omitted instead of silently losing it. Thresholds, retention, summarizer instructions, original transcript rows, schema, and persistence ownership are untouched, and custom compaction providers (which receive original arrays) are unaffected. Token accounting does change: omission records are now included in the estimate rather than left outside it. This establishes request bytes and deterministic replay plumbing; it does not guarantee what a model retains in its generated summary.
Evidence
prepareCompaction→compact→buildSessionContextwith an image-only user message, an image-only tool result, and a split-turn prefix (pre-fix: image serializes to"", no marker anywhere in the summarization input or rebuilt context).history-image-prune's own marker path verified untouched.