feat(sessions): add compact option to stale conversation cost warning#3154
Merged
Merged
Conversation
The stale-costly-conversation dialog previously offered only "Continue anyway" (pay full input price) or "Not now". Add a "Compact instead" action that runs the agent's existing `/compact` command, so the user can shrink the thread's context in place rather than reloading it whole or losing the context by starting fresh. Generated-By: PostHog Code Task-Id: d2fc766b-7a43-4840-859b-efc65c2a3965
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
|
Reviews (1): Last reviewed commit: "feat(sessions): add compact option to st..." | Re-trigger Greptile |
There was a problem hiding this comment.
Small UI-only change that adds a "Compact instead" button to the stale session cost dialog. The implementation is straightforward — it reuses the existing onContinue gate-clear path and dispatches /compact via onSendPrompt. No data models, API contracts, or business logic touched.
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.
Problem
When a large, idle conversation's prompt cache has expired, staff get a warning that continuing will re-process the whole thread at full input price (the "≈$33" notice). The dialog only offered two ways out: Continue anyway (pay the full reload) or Not now (pause). There was no way to keep the thread's context without the expensive reload, so the useful middle option — compacting — was missing.
Changes
Add a Compact instead action to
StaleConversationCostDialog. It runs the agent's existing manual-compaction command (/compact), summarizing the history so the thread's context shrinks to a fraction of its size instead of being reloaded whole or thrown away.StaleConversationCostDialoggains anonCompactprop and a third button; the copy now names compaction as the cheap middle path.SessionViewwiresonCompactto acknowledge the gate (closing the dialog and unlocking the composer) and send/compact, which surfaces the usual "Compacting conversation history…" progress.Screenshots: n/a (copy + one button in an existing dialog).
How did you test this?
biome checkon both changed files (clean)./compactis the same command the context-error tip already directs users to type, sent through the normal prompt path, so it queues/spawns like any message and drives the existing compaction UI.Automatic notifications
Created with PostHog from a Slack thread