Skip to content

Add managed permission settings to session startup - #2139

Draft
joshspicer wants to merge 1 commit into
github:mainfrom
joshspicer:joshspicer-sdk-managed-settings-permissions
Draft

Add managed permission settings to session startup#2139
joshspicer wants to merge 1 commit into
github:mainfrom
joshspicer:joshspicer-sdk-managed-settings-permissions

Conversation

@joshspicer

Copy link
Copy Markdown

Why

SDK hosts need a typed way to inject enterprise permission policy at session startup, independent of the runtime server/device managed-settings fetch path.

What

Adds optional managedSettings.permissions support alongside enableManagedSettings for create and resume across Node, Python, Go, .NET, Rust, and Java. The public types expose bypass disable plus deny/ask/allow rule arrays, and each client forwards the same camelCase JSON shape. Generated RPC mirrors are updated where the language consumes SessionOpenOptions; protocol version remains unchanged because the field is optional.

The setting is startup-only and must be re-supplied on resume. It composes restrictively with runtime-fetched policy.

Validation

  • Go full suite
  • Rust session tests (116 passed)
  • Java managed-settings tests and Spotless
  • Node format/lint/typecheck
  • Python Ruff and type checks
  • .NET build and format check

Runtime-backed Node/Python tests are locally blocked by a corrupted installed CLI native addon; .NET test execution is locally blocked by the missing .NET 8 runtime, while the SDK builds successfully.

…/resume

Add an optional per-session `managedSettings` field (permissions-only
contract) across all six language SDKs, alongside the existing
`enableManagedSettings` boolean. Hosts can inject enterprise permission
policy at session startup via:

  managedSettings.permissions = {
    disableBypassPermissionsMode?: "disable",
    deny?: string[],
    ask?: string[],
    allow?: string[],
  }

Semantics: startup-only (not persisted), must be re-supplied on resume,
composes restrictively with runtime-managed settings, and older runtimes
fail closed. Wired through hand-written wire types at both create and
resume in Node, Python, Go, .NET, Rust, and Java, plus tests, docs, and
a CHANGELOG entry. Generated RPC mirror types regenerated from the
runtime schema (TS/Python/Go/Rust; C# unaffected as it does not mirror
SessionOpenOptions). No SDK protocol bump.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 29, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

Files not reviewed (2)
  • go/rpc/zrpc.go: Generated file
  • go/rpc/zrpc_encoding.go: Generated file
  • Files reviewed: 25/30 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread go/types.go
Comment on lines +1470 to +1472
// Allow lists operations permitted without prompting. Every declared allow
// list across managed layers must admit an operation for it to be allowed.
Allow []string `json:"allow,omitempty"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants