feat: resolve declared resource dependencies at request start (chat path) - #1943
Open
serguei-gorokhov wants to merge 1 commit into
Open
serguei-gorokhov wants to merge 1 commit into
serguei-gorokhov wants to merge 1 commit into
Conversation
…ath) A new enhancement-chain function runs for chat-completion calls to an application, before the per-request key is assigned — while the context still carries the originating user, so the reach checks evaluate the USER's permissions, not the app's (load-bearing timing, made loud by an assert). Per declared record: resolve the target (current-user/… against the originating user's bucket, concrete global-view paths as-is), verify fresh against the user's reach, intersect with the content-bound admin-consent record, and bake the passing grants into the key the application will hold — both halves of the delivery: perRequestSharedResources serves the app's own direct calls, perRequestReceivers[app] carries the grants down chained calls. Fail-closed per record: unreachable or unconsented targets simply do not grant; a required record that cannot resolve fails the call with an explicit 403 instead of the app half-working. Malformed records (config-file apps bypass write-time validation) are unresolvable — never a crash, never a grant; the read side re-enforces the write-side vocabulary (kind, READ/WRITE only). Runtime audit events on the DIAL_RESOURCE_DEPS_AUDIT stream: one grant line per run (what was granted), one denial line (unreachable or unconsented), one runtime-fail line when a required record rejects the call. Enforcement is unchanged — the existing per-request permission rule honors the grants, folder targets by prefix. Smoke test proves the v1 happy path end to end: admin-authored app declares current-user/prompts/dep-smoke/ (write, required) → admin grants → user chats → the app's key writes inside the declared folder (200) and is refused outside it (403). Spec: documentation repo, offline-access-delegation/implementation-specs/pr4-request-start-resolution.md Co-Authored-By: Claude Code <noreply@anthropic.com>
serguei-gorokhov
requested review from
Oleksii-Klimov and
astsiapanay
as code owners
September 9, 2026 18:37
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.
Applicable issues
Description of changes
A new enhancement-chain function,
ResolveResourceDependenciesFn, runs for chat-completion calls to an application, before the per-request key is assigned — while the context still carries the originating user, so the reach checks evaluate the USER's permissions, not the app's (load-bearing timing, made loud by an assert).Per declared record: resolve the target (
current-user/…against the originating user's bucket, concrete global-view paths as-is), verify fresh against the user's reach, intersect with the content-bound admin-consent record, and bake the passing grants into the key the application will hold.requiredrecord that cannot resolve fails the call with an explicit 403 instead of the app half-working. Reach is all-or-nothing per record — no half-grants.DIAL_RESOURCE_DEPS_AUDITstream: one grant line per run (what was granted), one denial line (unreachable or unconsented), one runtime-fail line when a required record rejects the call.Smoke test proves the v1 happy path end to end: admin-authored app declares
current-user/prompts/dep-smoke/(write, required) → admin grants → user chats → the app's key writes inside the declared folder (200) and is refused outside it (403).Behavior changes flagged for review
requireddependency can now fail chat-completion calls with an explicit 403 (reach or consent missing) — new failure mode, only for apps that opt in by declaring.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
🤖 Generated with Claude Code