Repository navigation
SDK: Surface structured Policy Helper failures - #2849
Draft
carlorivera wants to merge 2 commits into
Draft
carlorivera wants to merge 2 commits into
carlorivera wants to merge 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Generate the structured failure and scoped recheck surface from runtime contract b7b80ebc085, with capability, compatibility, and RPC error preservation coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
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.
Problem
Policy Helper failures currently reach SDK consumers only through generic managed-settings state or process diagnostics. Clients cannot reliably show the helper's actionable explanation, identify fail-closed restrictions, perform a fresh scoped recovery check, or retain helper context when session creation, resume, or policy-dependent activation fails.
This SDK change depends on the additive runtime contract in github/copilot-agent-runtime#26937. The projections and APIs in this pull request require a runtime implementing that contract; older runtimes remain compatible by omitting the optional fields and method capability.
Changes
PolicyHelperFailure,PolicyHelperFailureDetail,PolicyHelperHelpLink, andPolicyHelperCapabilitiesprojections.policyHelperFailureandpolicyHelperCapabilitiesfields toManagedSettingsResolvedData.category,failureMode,severity,reason, and optionalauthorityas strings; helper-definedcodealso remains arbitrary bounded text.error.data.policyHelperFailureonsession.create,session.resume, and policy-dependent activation failures without replacing the primary JSON-RPC code or message.session.managedSettings.recheckPolicyHelper, returning the authoritativeManagedSettingsResolvedDatasnapshot after a fresh evaluation for the current session policy context.structuredFailureandrecheckcapabilities. Capability presence is authoritative; absence ofpolicyHelperFailurealone does not establish support or recovery.policyHelperReason: "pluginActivation"to sessionlessmanagedSettings.resolvecalls for policy-dependent activation.rpc_data()extraction.The DTO contains:
category,failureMode,severity, andreasonauthoritypreviousPolicyRetainedcodemessageremediationhelpLink { url, label? }details[] { path?, message }diagnosticSchema provenance
Authoritative runtime revision:
a617cebec90a3566e39cdcfbb20daea1efc98d61Runtime implementation commit:
b7b80ebc085SDK protocol version: 3
generated/api.schema.json:ab10e6fd502ef59fcf3403ce62b8588def4613c41c311c6573ab5d0aee990938generated/session-events.schema.json:8a307582a38de7a015b4bac1dca2fa16045930405789775d3d6c418c10d41a3aThe runtime checkout's SDK baseline is newer than this repository's pinned CLI
1.0.99-0. To avoid unrelated projection drift, this branch applied the exact conflict-freeb7b80ebc085^..b7b80ebc085JSON-schema delta to the pinned schemas, then regenerated Node and Rust with this repository's generators. The delta contained 10 API-schema operations and 6 session-event-schema operations, limited to the Policy Helper definitions, snapshot/result fields, resolve request, and scoped recheck RPC. Regeneration was idempotent; the generated projection diff SHA-256 was40c3107cdfd8f30bc131c554094b3bb98d62c3f78ded9b09d69e733955dc89b3.The completed handwritten SDK tests and documentation were reconciled back into the runtime repository in commit
e34645fb5f02ae67faef6bdb63f372d22f6216e9; the runtime kept its newer generated projections authoritative.Validation
npm run check:nodejs: passed formatting, ESLint, and type checking; ESLint reported 7 pre-existing warnings in unrelated tests and 0 errors.nodejs/test/rust-codegen.test.tsexpects the nested runtime path../../../../generated/api.schema.json.test/harnessdependencies were unavailable (tsxmissing). Installing the unchanged harness lockfile was environment-blocked: the configured package feed lacks lockedip-address@10.7.4, and public npm access returnedENOTCONN.git diff --check: passed.Product impact
Node and Rust SDK clients can render actionable bounded Policy Helper failures, distinguish warning and fail-closed states, explain retained previous policy, preserve failure context on failed operations, and request an explicitly capability-gated fresh scoped recheck. Existing clients and older runtimes remain compatible with the additive optional contract.