You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(desktop): Clear cookies also forgets clipboard and location answers - #45201
In the desktop browser panel, "Clear cookies" does not make a page ask again for clipboard or location access.
Steps (Linux works, no sign-in):
Open the browser panel and load any https page, for example https://example.com.
In DevTools for the tab, run await navigator.clipboard.readText() and click Block. It rejects.
Browser panel ... menu > Clear cookies (or Settings > Integrations, browser profile).
Run await navigator.clipboard.readText() again. It rejects at once with no prompt. Expected: the prompt shows again.
An Allow survives the clear too, so clearing a profile does not revoke clipboard read or location access. navigator.permissions.query({ name: "clipboard-read" }) keeps reporting the old answer.
Camera and microphone answers (#38146) are already reset by Clear cookies. This makes clipboard and location match.
Cause
In apps/desktop/src/preview/BrowserSession.ts, the clipboard and location answers (permissionDecisions) are Maps made per session. forgetMediaDecisions, which clearCookies and cookiesCleared call, clears only the camera and microphone Map. Nothing clears the other two. Also, an answer to a prompt that was open during the clear is stored after it, because only the camera path checks the reset counter.
Change
The clipboard and location Maps now sit on the session's consent record next to the camera and microphone one, so forgetMediaDecisions clears all of them. The prompt callback skips storing an answer when a reset happened while it was open, using the same resets guard the camera and microphone code already has. 14 lines added, 4 removed, one file.
Scope
Small fix of an obvious bug, steps reproduce it, so it needs no issue.
Verification
New test in BrowserSession.test.ts, run for clipboard-read and geolocation: block, clear cookies, ask again (a prompt shows, allow), then cookiesCleared revokes the allow and the next request prompts again.
× forgets clipboard-read answers when the profile's cookies are cleared
× forgets geolocation answers when the profile's cookies are cleared
AssertionError: expected false to be true (BrowserSession.test.ts:741, the request after clearCookies)
Tests 2 failed | 25 passed (27)
With the fix, the whole file:
Test Files 1 passed (1)
Tests 27 passed (27)
vp run check:changed: format, lint, knip, typecheck (2 packages) and test (1 file) all pass.
Not verified: I did not click Block and Clear cookies by hand in the running app; the unit test drives the session's permission request and check handlers directly. Chrome keeps site permissions when cookies are cleared, and #26173 says clipboard answers last for the browser session, so the maintainers may prefer the old behaviour.
Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.
No actionable comments were generated in the recent review.
Walkthrough
Clipboard and geolocation permission decisions now reset with media consent. Answers are stored only if the consent reset counter remains unchanged while a prompt is open. Tests cover decision reuse and invalidation during cookie clearing.
Session consent state now includes clipboard and geolocation decision maps. Consent resets clear these maps. Prompt answers are stored only if the reset counter has not changed. Tests cover decision reuse and invalidation during cookie clearing.
Clear cookies now also makes the desktop browser panel forget clipboard and location permission answers, as it already did for camera and microphone. No merge-blocking risk was found. The author did not manually test this in the running app.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(desktop): Clear cookies also forgets clipboard and location answers" follows conventional commit format and names the main change: clearing cookies now also resets clipboard-read and ge…
Description check
The description follows the template well. It has Problem, Change, Scope, and Verification sections. The problem has clear reproduction steps and expected behavior. The change explains the fix and the…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(desktop): Clear cookies also forgets clipboard and location answers" follows conventional commit format and names the main change: clearing cookies now also resets clipboard-read and geolocation permission answers in the desktop browser panel. The raw summary and objectives confirm this change, which is the primary purpose of the PR.
Full details: Description check
Explanation
The description follows the template well. It has Problem, Change, Scope, and Verification sections. The problem has clear reproduction steps and expected behavior. The change explains the fix and the reset guard. Scope explains why no issue is linked and cites #38146 and #26173. Verification gives focused test names, before/after failing and passing results, and a candid note of what was not verified. The template's model/harness attribution line is present. Minor gap: the Scope section says no issue is needed, which the template accepts for small obvious bugs, so this is acceptable.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 867da42 and 72f5482.
Files selected for processing: 2
apps/desktop/src/preview/BrowserSession.test.ts
apps/desktop/src/preview/BrowserSession.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
This branch has not been deployed
No deployments
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
size:S10-29 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
1 participant
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
In the desktop browser panel, "Clear cookies" does not make a page ask again for clipboard or location access.
Steps (Linux works, no sign-in):
await navigator.clipboard.readText()and click Block. It rejects.await navigator.clipboard.readText()again. It rejects at once with no prompt. Expected: the prompt shows again.An Allow survives the clear too, so clearing a profile does not revoke clipboard read or location access.
navigator.permissions.query({ name: "clipboard-read" })keeps reporting the old answer.Camera and microphone answers (#38146) are already reset by Clear cookies. This makes clipboard and location match.
Cause
In
apps/desktop/src/preview/BrowserSession.ts, the clipboard and location answers (permissionDecisions) are Maps made per session.forgetMediaDecisions, whichclearCookiesandcookiesClearedcall, clears only the camera and microphone Map. Nothing clears the other two. Also, an answer to a prompt that was open during the clear is stored after it, because only the camera path checks the reset counter.Change
The clipboard and location Maps now sit on the session's consent record next to the camera and microphone one, so
forgetMediaDecisionsclears all of them. The prompt callback skips storing an answer when a reset happened while it was open, using the sameresetsguard the camera and microphone code already has. 14 lines added, 4 removed, one file.Scope
Small fix of an obvious bug, steps reproduce it, so it needs no issue.
Verification
New test in
BrowserSession.test.ts, run forclipboard-readandgeolocation: block, clear cookies, ask again (a prompt shows, allow), thencookiesClearedrevokes the allow and the next request prompts again.Test commit alone, fails on main 867da42:
With the fix, the whole file:
vp run check:changed: format, lint, knip, typecheck (2 packages) and test (1 file) all pass.Not verified: I did not click Block and Clear cookies by hand in the running app; the unit test drives the session's permission request and check handlers directly. Chrome keeps site permissions when cookies are cleared, and #26173 says clipboard answers last for the browser session, so the maintainers may prefer the old behaviour.
Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.