fix(web): do not persist terminal context chips - #8422
Conversation
Drafts saved chip metadata and dropped the selected text. Reload filled empty text, so the chip still showed and send skipped the snippet. Do not write those chips. Drop old ones on load and strip the leftover prompt markers.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused composer persistence fix: terminal context chips are removed from saved drafts and legacy chips are discarded on reload, while active-session behavior and surrounding prompt text remain unchanged. The behavior is localized and covered by targeted round-trip tests. You can add or adjust custom eligibility rules. Learn more. |
What Changed
Composer drafts no longer save terminal context chips.
Those chips only stored metadata. The selected text was dropped. Reload filled empty text, so the chip still showed and send skipped the snippet.
Old saved chips are dropped on load. Leftover prompt markers for those chips are stripped. The live session is unchanged. Chips still work until you reload.
Why
The chip looked attached. The snippet was not. Easy to miss.
We are not saving the text, so we should not save the chip.
UI Changes
After a reload, expired terminal chips no longer stay in the composer. No other visual change.
Checklist
Note
Low Risk
Localized composer draft persistence behavior; in-session terminal chips are unchanged, with a one-time loss of misleading chips on reload for users with old storage.
Overview
Composer draft persistence no longer saves terminal context chips. Chips still work in an active session; only what gets written to and read from local storage changes.
On save,
partializestrips inline terminal placeholder markers from the prompt and omitsterminalContextsentirely (previously it stored metadata without the selected text). On load and migration, persisted terminal context entries are ignored, placeholders are stripped from the prompt, and hydrated drafts get an emptyterminalContextslist. The dedicatednormalizePersistedTerminalContextDraftpath was removed.Tests now assert chips are not round-tripped and that legacy stored chips disappear after reload while surrounding prompt text is kept.
Reviewed by Cursor Bugbot for commit 0bfec13. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Stop persisting terminal context chips in composer draft store
terminalContextsfrom persisted drafts and strips inline terminal context placeholders from the saved prompt inpartializeComposerDraftStoreStateandnormalizePersistedDraftsByThreadIdin composerDraftStore.tstoHydratedThreadDraftnow always setsterminalContextsto an empty array and strips placeholders from the persisted promptnormalizePersistedTerminalContextDrafthelperterminalContextswill have them dropped on next hydrate; drafts containing only terminal context placeholders are omitted from persistence entirelyMacroscope summarized 0bfec13.