fix(core): coalesce equivalent pending permission requests#36091
fix(core): coalesce equivalent pending permission requests#36091umi008 wants to merge 2 commits into
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
I don't think coalescing by The bug in #36055 is about duplicate pending requests for the same effective In
Because of that, two requests with the same The issue case should be fixed by coalescing only semantically equivalent pending As written, this PR seems to widen one approval to unrelated resources, which |
The previous coalescing key (sessionID + action) was too broad. The permission system evaluates per (action, resource) pair, so two fs_write requests to different files must each show their own dialog. Changed the coalescing key to sessionID + action + normalized resources + normalized save. Only genuinely identical requests now coalesce. Added tests verifying: - Identical requests still coalesce (one dialog) - Different resources trigger separate dialogs - Different save patterns trigger separate dialogs
|
thanks for the review @hcsum — the current implementation already addresses this concern. the coalescing key includes the tests added in this PR verify this explicitly:
mind taking another look? |
Issue for this PR
Closes #36055
Type of change
What does this PR do?
When multiple tools request the same permission type simultaneously (e.g., two
fs_writecalls to different files), the system spawned duplicate permission dialogs. The user had to approve the same permission type multiple times.Added coalescing logic: when a new permission request arrives for the same
sessionID + action(e.g.,fs_write), it's attached to the existing pending request instead of creating a new dialog. When the primary request is approved or denied, all coalesced requests receive the same resolution. The "always" saved-rule propagation also applies to coalesced requests.How did you verify your code works?
bun run typecheckpasses frompackages/opencodefs_writerequests show one dialog, approval applies to all pending requests of that typeChecklist