Skip to content

feat: map confirmation isNonConsequential in AI capabilities extension#7857

Open
sebastienlevert wants to merge 3 commits into
mainfrom
feat/plugin-confirmation-isnonconsequential
Open

feat: map confirmation isNonConsequential in AI capabilities extension#7857
sebastienlevert wants to merge 3 commits into
mainfrom
feat/plugin-confirmation-isnonconsequential

Conversation

@sebastienlevert

Copy link
Copy Markdown
Contributor

Description

The x-ai-capabilities confirmation object supports isNonConsequential (plugin manifest 2.4, available in Microsoft.DeclarativeAgents.Manifest as Confirmation.IsNonConsequential), but Kiota was silently dropping it:

  • ExtensionConfirmation (the x-ai-capabilities parser model) only had Type/Title/Body.
  • ParseConfirmation / WriteConfirmation never read or wrote isNonConsequential.
  • PluginsGenerationService.GetFunctionCapabilitiesFromCapabilitiesExtension mapped only Type/Title/Body onto the generated manifest Confirmation.

As a result, a function could never be marked non-consequential in the generated plugin manifest, so the "Always Allow" confirmation option was unavailable.

Changes

  • OpenApiAiCapabilitiesExtension.cs: add IsNonConsequential to ExtensionConfirmation; parse it (boolean) in ParseConfirmation; emit it in WriteConfirmation.
  • PluginsGenerationService.cs: map capabilities.Confirmation.IsNonConsequentialConfirmation.IsNonConsequential.
  • Tests: extended the OpenApiAiCapabilitiesExtension parse + write round-trip tests and the end-to-end GeneratesManifestWithAiCapabilitiesExtensionAsync generation test to cover isNonConsequential.

Example

OpenAPI operation extension:

x-ai-capabilities:
  confirmation:
    type: AdaptiveCard
    title: Fill color
    body: Change the cell color?
    isNonConsequential: true

now produces in the generated plugin manifest:

"capabilities": {
  "confirmation": { "type": "AdaptiveCard", "title": "Fill color", "body": "Change the cell color?", "isNonConsequential": true }
}

Testing

  • dotnet test tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj --filter "FullyQualifiedName~OpenApiAiCapabilitiesExtension|FullyQualifiedName~PluginsGenerationService"96 passing, 0 failing.

Context

Complements the TypeSpec authoring side (@microsoft/typespec-m365-copilot) which emits x-ai-capabilities.confirmation.isNonConsequential — see microsoft/typespec-copilot-skills#530. The underlying manifest model already supports the property (Microsoft.DeclarativeAgents.Manifest@5.0.0-rc.2); this PR wires Kiota's generator to populate it.

The x-ai-capabilities confirmation object supports isNonConsequential
(plugin manifest 2.4), but Kiota dropped it: the ExtensionConfirmation
parser only read type/title/body and the generated manifest confirmation
was never populated with it. Parse, write, and map isNonConsequential to
the manifest Confirmation.IsNonConsequential property.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sebastienlevert sebastienlevert requested a review from a team as a code owner June 25, 2026 18:14
@msgraph-bot msgraph-bot Bot added this to Kiota Jun 25, 2026
@github-code-quality

github-code-quality Bot commented Jun 25, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: C#

C# / code-coverage/dotnet

The overall coverage in the branch is 71%. Coverage data for the branch is not yet available.

Show a code coverage summary of the most covered files.
File 2114d62 +/-
/home/runner/wo...guageRefiner.cs 98%
/home/runner/wo...criptRefiner.cs 98%
/home/runner/wo...MethodWriter.cs 97%
/home/runner/wo...MethodWriter.cs 96%
/home/runner/wo...MethodWriter.cs 96%
/home/runner/wo...MethodWriter.cs 95%
/home/runner/wo...rs/GoRefiner.cs 93%
/home/runner/wo...KiotaBuilder.cs 90%
/home/runner/wo...ationService.cs 89%
/home/runner/wo...xGenerator.g.cs 72%

Updated June 26, 2026 15:35 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures the x-ai-capabilities.confirmation.isNonConsequential flag is preserved end-to-end: parsed from the OpenAPI extension, re-serialized when needed, and mapped into the generated plugin manifest Confirmation so non-consequential confirmations enable the “Always Allow” UX.

Changes:

  • Added IsNonConsequential to the x-ai-capabilities confirmation model and implemented parse/write support.
  • Mapped capabilities.Confirmation.IsNonConsequential into the generated plugin manifest confirmation object.
  • Extended unit + end-to-end tests and documented the change in the changelog.
Show a summary per file
File Description
tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs Extends the end-to-end manifest generation test to assert IsNonConsequential is carried through.
tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiAiCapabilitiesExtensionTests.cs Updates parse/serialize tests to include isNonConsequential in the AI capabilities extension.
src/Kiota.Builder/Plugins/PluginsGenerationService.cs Maps IsNonConsequential from parsed capabilities into the generated manifest Confirmation.
src/Kiota.Builder/OpenApiExtensions/OpenApiAiCapabilitiesExtension.cs Adds IsNonConsequential to the extension model and implements parsing + JSON emission.
CHANGELOG.md Records the newly supported isNonConsequential confirmation property for the AI capabilities extension.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 1

…erialization

Assert the serialized output contains "isNonConsequential":true rather than just
the property name, so the test fails if the value is emitted incorrectly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants