Repository navigation
feat(web): compact a thread from the context meter - #256
Merged
Merged
Conversation
Web half of context compaction, on top of the server support from #252. - The context meter gains a Compact context action that sends /compact on its own, leaving the draft and its attachments in the composer. It names the thread's model and marks Claude's auto-compact threshold. - The timeline shows a compaction as a static divider, folds it with a finished turn's other work, and shows "Compacting context" with a static icon while it runs instead of the pulsing dots. - A failed compaction or dropped queued message now acknowledges the send, so the composer no longer waits on a session change that never comes. - Old Claude threads get the "Resume with less context" banner, and Claude's native resume dialog renders as a dedicated prompt with its three answers. "Don't ask again" silences the banner on this device. - /compact appears in the slash menu only as a whole message on a thread that can compact. Ported from pingdotgg#9293 Ported from pingdotgg#8144 Ported from pingdotgg#4772 Ported from pingdotgg#11103 Ported from pingdotgg#9623 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
TheDarkPhantom
enabled auto-merge
September 30, 2026 12:42
…on-web # Conflicts: # CHANGELOG.md # apps/web/src/components/ChatView.logic.ts # apps/web/src/components/ChatView.tsx
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.
#252 landed context compaction on the server, but the web client had no way to trigger it besides typing
/compact, no timeline rendering for it, and no handling of Claude's resume prompt.This ports the web parts of upstream pingdotgg#9293 and pingdotgg#8144, plus pingdotgg#4772 (
ContextWindowMeter.logic.ts), pingdotgg#11103 (drafts survive compaction) and pingdotgg#9623 (compaction folds with a settled turn).Context meter
/compactas its own turn start and leaves the draft and attachments where they are (fix(web): preserve drafts when compacting context pingdotgg/t3code#11103). It is disabled while work runs, before the thread has any conversation, while a question or approval is pending, or when the provider doesn't advertise/compact, and the popover says why.autoCompactThresholdand adds the text "Compacts automatically at N tokens".Timeline
context-compactionactivities get their own static divider row (for example "Compacted context 899K → 19K tokens"). They are never grouped into work rows./compactruns, the working row reads "Compacting context for Ns" with a static icon instead of the pulsing dots. The only repaint is the existing once-a-second timer text.provider.turn.start.failedrows ("Context compaction failed", "Queued message was not sent") still render as error work rows. They now also acknowledge the local send, so the composer stops waiting for a session change that never comes (upstreamlatestTurnStartFailureId).Claude resume
isClaudeResumeCompactionQuestion),ComposerPendingUserInputPanelshows a dedicated prompt with Compact and continue, Keep full history and Don't ask again. Upstream shows the generic questionnaire here. The answers go through the same option-selection path, so the server-side mapping is unchanged.Slash menu
/compact(advertised by the server) is offered only as the whole message, with no attachments or contexts, on a thread that can compact.composer-logic.tsitself is unchanged; the filter lives inChatComposer's menu items.No server, contract or migration changes. The larger additions went into new files (
ContextWindowMeter.logic.ts,contextCompaction.logic.ts,useResumeCompactionBanner.tsx,ClaudeResumeCompactionPrompt.tsx), and the edits toChatView,ChatComposerandMessagesTimelinestay small and local.Verification
vp test runon the new and touched tests: meter logic and render, compaction state, timeline rows, local-dispatch acknowledgement, resume prompt, settings form, changelog. All pass.tsgo --noEmit -p apps/web,vp lintandvp fmton the changed paths, andvp run check:avicodeall pass.Manual checks
Built by Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code