Repository navigation
fix(chat): refresh context ring after /compact - #2091
Open
xiaozou-second wants to merge 3 commits into
Open
xiaozou-second wants to merge 3 commits into
xiaozou-second wants to merge 3 commits into
Conversation
/compact shrinks the thread server-side without a model call, so the stream hint never drops on its own and the ring stayed at its pre-compaction percentage. - Record the hint each snapshot was fetched against; the snapshot is authoritative only while the hint has not moved. - Sequence snapshots so a slow response cannot overwrite a newer one, and invalidate in-flight requests on thread switch. - Refetch on the isStreaming true->false edge, dropping the cached snapshot if that refetch fails. - Forward isStreaming from ChatInputActionsRow.
The ring memo read breakdownHintRef.current but only depended on [breakdown, hintUsed, max]. Refs do not trigger recomputation, so after a failed post-compaction refetch -- the one path that clears the hint without touching state -- the memo kept serving the pre-compaction value until something else re-rendered. Hold the hint in state so the memo's inputs are complete, and make isStreaming required so a future host that forgets it fails tsc instead of silently never refetching.
Author
Resolve both-added prop conflicts in ChatInputActionsRow.tsx and ContextWindowRing.tsx by keeping mine (isStreaming) and upstream's (decisionSaved) side by side. Keep the hintMoved cache guard from upstream alongside the local force alias. Verified: vitest ContextWindowRing + ChatInputActionsRow 17 passed; tsc --noEmit exit 0.
This branch has not been deployed
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.


Summary
Fixes the context-window ring staying at 100% after
/compact./compactshrinks the thread server-side without a model call, so the stream hint (usedTokens) never drops on its own — and the ring preferred that hint whenever it was non-zero. Now:isStreamingtrue→false edge, and drops the cached snapshot if that refetch failsChatInputActionsRowforwardsisStreaming(new optional prop, defaults tofalse)Target branch
developType of change
Test plan
dashboard/src/pages/Chat/components/ContextWindowRing.test.tsx:make allpasses locallyFrontend — 17 passed,
tscandeslintclean:cd dashboard npx vitest run src/pages/Chat/components/ContextWindowRing.test.tsx \ src/pages/Chat/components/ChatInputActionsRow.test.tsx --reporter=verbose npx tsc --noEmit npx eslint src/pages/Chat/components/ContextWindowRing.tsx \ src/pages/Chat/components/ContextWindowRing.test.tsx \ src/pages/Chat/components/ChatInputActionsRow.tsxChecklist
CHANGELOG.mdIssue
Closes #2071