fix: restore pending permissions via REST API after session switch#365
Merged
sudo-tee merged 3 commits intosudo-tee:mainfrom Apr 28, 2026
Merged
fix: restore pending permissions via REST API after session switch#365sudo-tee merged 3 commits intosudo-tee:mainfrom
sudo-tee merged 3 commits intosudo-tee:mainfrom
Conversation
7f27e47 to
2aeed6a
Compare
Owner
|
Thanks for the PR. Should we check the permission status ? I did something similar for questions a while back |
renderer.reset() clears the permission queue on every session change. The previous approach (preserve_permissions flag) tried to keep the queue alive across resets, but permissions that arrived for a different worktree while the user was away were never in the queue to begin with. Mirror the question_window.restore_pending_question pattern instead: after the session loads, query GET /permission for pending permissions, filter for ones belonging to the active session, and show them. This removes all preserve_permissions plumbing and the auto-deny behaviour from reset() (the cancel function handles explicit abort).
Add list_permissions to the shared mock API client so tests exercising render_full_session() don't crash on the new restore_pending_permissions code path. Add a dedicated test verifying that pending permissions are fetched and re-queued via on_permission_updated after a session switch.
2aeed6a to
10ccc62
Compare
Contributor
Author
Yeah that makes sense, let me take a look and see if I can figure it out 🙂 |
Owner
|
Great thanks for the PR. Looks good to me |
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.
Summary
restore_pending_questionpattern inquestion_window.luaChanges
api_client.lua— Addedlist_permissions()method (GET /permission) to fetch pending permissions from the server.permission_window.lua— Addedrestore_pending_permissions(session_id)which:renderer.lua—restore_pending_permissions()alongsiderestore_pending_question()inrender_full_session()reset()logic that auto-denied all pending permissions on session switch