Repository navigation
fix(cloud-agent-sdk): hold the context reading across a compaction - #6272
Merged
iscekic merged 1 commit intoSep 17, 2026
Merged
Conversation
iscekic
marked this pull request as draft
September 17, 2026 13:02
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe incremental fix resolves both prior findings and introduces no new issues in the changed lines of the compaction-boundary walk. Resolved Findings
Files Reviewed (2 files)
Previous Review Summary (commit ec60cde)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit ec60cde)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICALNone. WARNING
Files Reviewed (11 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
iscekic
force-pushed
the
kwf/in-a-remote-cli-session-the-context-window-163a
branch
from
September 17, 2026 13:57
07dc11b to
edd712c
Compare
iscekic
marked this pull request as ready for review
September 17, 2026 14:06
iscekic
enabled auto-merge (squash)
September 17, 2026 15:51
pandemicsyn
approved these changes
Sep 17, 2026
iscekic
deleted the
kwf/in-a-remote-cli-session-the-context-window-163a
branch
September 17, 2026 16:32
This was referenced Sep 18, 2026
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.
Changelog for users
/compact, the context indicator no longer reverts to the pre-compaction percentage.Changelog for maintainers
packages/cloud-agent-sdk/src/context-usage.ts:findLatestContextUsagewalks messages newest-first and stops at a compaction boundary, reporting no reading past it instead of an older message's figure.summary: trueassistant message, or any message carrying acompactionpart — the marker the mobile transcript renders as "Context compacted". A summary still running or failed is not a boundary./compactthe honest state is no figure until the next turn reports.findLatestContextUsagenow takes{ info, parts? }; stored session messages already carry their parts, so no session-manager wiring changed for the boundary.message.removedchat event (messageRemovedDataSchema) normalizes to{ sessionId, messageId }, joinsCHAT_EVENT_TYPES, and resolves to its session throughchatEventSessionId.reducemapsmessage.removedtodelete_message, and the chat processor deletes the message with its parts from session storage./compactand the next turn is intended; do not fill it from the summary's tokens. Start at the boundary checks incontext-usage.ts.E2E proof
[e1] Prove PR 6272 on android: the context indicator holds the compaction — pre-compaction figure, then no stale figure after /compact, then the compacted reading after one turn, and it survives leaving… — android emulator-5554, remote CLI session ses_f500fabc4ffe1uUhtoSTIKdXHQ (session.sh remote-enter + enter; 'link delivered on emulator-5554' in e1-reenter.log). Before /compact the header button read 'Context 17,820 of 1,310,720 tokens, 1% used' (e1-enter-digest.log); /compact was sent from the app's slash menu ('Use /compact' -> composer EditText '/compact' in e1-compact-send.log, pre-figure still present there), and immediately after sending, the indicator lost its figure and read 'cost 1 cent Tap to view context details.' with 'CONTEXT COMPACTED' in the transcript (e1-compact-sent.log)…
[e1] Prove PR 6272 on android: the context indicator holds the compaction — pre-compaction figure, then no stale figure after /compact, then the compacted reading after one turn, and it survives leaving…