fix: persist 'Always' for file uploads globally, not per client#951
Merged
fix: persist 'Always' for file uploads globally, not per client#951
Conversation
In #950 I added resource_extractor=client_name to upload_to_storage and organize_file. The intent was per-turn approval coalescing, but ApprovalGate.request_approval passes the same resource to set_permission() when the user picks "Always" -- so instead of recording "upload_to_storage = always" globally it recorded "upload_to_storage + David Graham = always". The dashboard permissions page still showed "ask" and the user would have been re-prompted for every new client they ever upload for. Drop resource_extractor from both file tools. The per-turn approval cache still coalesces retries of the same tool (cache key is (tool_name, None)). Permissions now persist globally as users expect. Regression test verifies that ALWAYS_ALLOW on upload_to_storage with client_name=David Graham applies when checking permission for a different client, confirming the global persistence. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Description
Follow-up to #950. The user reported: "I said 'Always' but the permissions page still says 'ask'."
Root cause: PR #950 added `resource_extractor=lambda args: args.get("client_name")` to `upload_to_storage` and `organize_file` for per-turn approval coalescing. But `core.py:600-605` passes the same `resource` to `store.set_permission()` when the user picks ALWAYS_ALLOW. So "Always" recorded a per-client override (`upload_to_storage + "David Graham" = always`) instead of the global permission (`upload_to_storage = always`). The dashboard reads the global level, which stayed at "ask", and a future upload for a different client would prompt again.
Fix
Drop `resource_extractor` from both file tools. The per-turn approval cache still coalesces retries of the same tool (cache key becomes `(tool_name, None)`, which is coarser but fine — users almost never upload for multiple different clients in one agent turn). Permissions now persist globally.
Type
Tests
Checklist
AI Usage
🤖 Generated with Claude Code