Expose managed approval requirement on permission requests - #2080
Expose managed approval requirement on permission requests#2080joshspicer wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Exposes managed approval requirements to TypeScript permission handlers.
Changes:
- Adds optional
managedApprovalRequiredmetadata. - Adds package-root type coverage.
Show a summary per file
| File | Description |
|---|---|
nodejs/src/types.ts |
Overlays managed approval metadata onto permission requests. |
nodejs/test/session-event-types.test.ts |
Verifies the field is publicly importable. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Medium
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 18f1bbc1-6001-43e2-b293-724505087f6a
13c3d37 to
03184d2
Compare
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (1)
nodejs/src/types.ts:1108
- This overlay only updates the standalone type and
PermissionHandler; the publicSessionEvent/PermissionRequestedDatatypes still come from the generated schema, wherepermissionRequestlacks this property. Consequently, an event-only host (the documented path whenonPermissionRequestis omitted) cannot compileevent.data.permissionRequest.managedApprovalRequiredeven though the runtime sends it. Please overlay thepermission.requestedevent payload as well so every public permission-request surface exposes the metadata.
export type PermissionRequest = GeneratedPermissionRequest & {
readonly managedApprovalRequired?: boolean;
};
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Medium
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c7f00b84-b0a7-4cdf-aca9-ffd49737f26e
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (1)
nodejs/src/types.ts:1145
- The behavior change leaves the public README inaccurate:
nodejs/README.md:39,:133, and:856-866still describeapproveAllas allowing every request/tool call. With a managed request it now returnsno-result, so following those docs can leave execution pending until the consumer explicitly resolves the permission. Please update the permission-handling docs and examples to describe this exception and how hosts should resolve it.
export const approveAll: PermissionHandler = (request) =>
request.managedApprovalRequired ? { kind: "no-result" } : { kind: "approve-once" };
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Medium
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (1)
nodejs/README.md:869
- The immediately following custom-handler example still returns
approve-oncefor every non-shell request without checkingmanagedApprovalRequired. Copying it therefore auto-approves managed Read, Edit, or Domain asks, contradicting the human-approval requirement documented here. Update that example to route flagged requests through a human confirmation flow (or leave them unanswered).
For requests with `managedApprovalRequired: true`, `approveAll` returns `{ kind: "no-result" }`. The request remains pending and the host must present a human-facing confirmation flow to resolve it explicitly.
- Files reviewed: 5/5 changed files
- Comments generated: 0 new
- Review effort level: Medium
|
Linked end-to-end validation completed against SDK head Cross-layer audit of the latest runtime session and AHP transcript confirmed:
The assistant's final table overstated downstream tool success for two approved Domain asks (HTTP redirect/404) and mislabeled the |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Why
Enterprise-managed permission
askrules must be answered by a person. SDK hosts need to distinguish those requests from ordinary permission prompts that client settings may auto-approve.This is the public SDK contract for:
The initial runtime scope supports managed Shell, Read, Edit, and Domain selectors. Tool and MCP selectors are deferred.
What
Adds optional
managedApprovalRequiredmetadata to the public TypeScriptPermissionRequesttype.When true, hosts should bypass automatic approval and present their normal confirmation UI. The runtime remains authoritative for the managed verdict and approve-once-only behavior; the flag is request metadata, not an administrator setting.
The field is overlaid at the hand-authored public type boundary because the runtime schema change has not shipped in a published CLI package yet. This avoids committing unrelated generated-schema drift. A later normal schema regeneration can absorb the field into generated bindings without changing the public TypeScript shape.
Validation
npm run buildnpm run typechecknpm test -- session-event-types.test.ts— 5 passednpm run format:checknpm run lint— 0 errors; 3 pre-existing warnings in unrelated tests