chat: add judge confirmation rationale#333
Merged
Merged
Conversation
Expose model-judge explanations on pending tool confirmations and propagate them through every generated SDK and reducer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a typed “model judge” confirmation rationale to the chat/toolCallReady action and carries it through pending-confirmation state across the protocol schema and all generated SDKs, with updated reducer fixtures and a changelog fragment.
Changes:
- Introduce
ToolCallJudgeConfirmationReasonand plumbconfirmationReasonthroughchat/toolCallReadyintoToolCallPendingConfirmationState. - Regenerate protocol JSON schemas and all client SDK state/action types and reducers (Swift/Rust/Kotlin/Go).
- Update reducer fixtures and add a
docs/.changes/changelog fragment.
Show a summary per file
| File | Description |
|---|---|
| types/test-cases/reducers/220-toolcall-actions-update-meta.json | Updates expected reducer state to include confirmationReason. |
| types/test-cases/reducers/127-toolcallready-with-confirmation-options.json | Adds a judge rationale payload in the action and expected pending-confirmation state. |
| types/test-cases/reducers/111-toolcall-pending-confirmation-sets-input-needed-status.json | Updates expected pending-confirmation state to include confirmationReason. |
| types/test-cases/reducers/026-toolcallready-transitions-running-tool-back-to-pending-confirmation.json | Updates expected transition output to include confirmationReason. |
| types/index.ts | Re-exports the new judge rationale types/kinds. |
| types/channels-chat/state.ts | Defines ToolCallJudgeConfirmationReasonKind and ToolCallJudgeConfirmationReason; adds confirmationReason to pending-confirmation state. |
| types/channels-chat/reducer.ts | Persists confirmationReason into ToolCallPendingConfirmationState when handling chat/toolCallReady. |
| types/channels-chat/actions.ts | Adds typed confirmationReason to ChatToolCallReadyAction. |
| scripts/generate-swift.ts | Includes the new kind/struct in Swift codegen lists. |
| scripts/generate-rust.ts | Includes the new kind/struct in Rust codegen lists and action imports. |
| scripts/generate-kotlin.ts | Includes the new kind/struct in Kotlin codegen lists. |
| scripts/generate-go.ts | Includes the new kind/struct in Go codegen lists. |
| schema/state.schema.json | Adds ToolCallJudgeConfirmationReason and references it from pending-confirmation state. |
| schema/notifications.schema.json | Adds ToolCallJudgeConfirmationReason and references it where pending-confirmation appears in notifications. |
| schema/errors.schema.json | Adds ToolCallJudgeConfirmationReason and references it where pending-confirmation appears in errors. |
| schema/commands.schema.json | Adds ToolCallJudgeConfirmationReason and references it where pending-confirmation appears in commands. |
| schema/actions.schema.json | Adds ToolCallJudgeConfirmationReason and references it from chat/toolCallReady. |
| docs/.changes/20260713-tool-call-judge-confirmation.json | Adds a changelog fragment announcing the new judge rationale support. |
| clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Reducers.swift | Plumbs confirmationReason into Swift pending-confirmation reducer output. |
| clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/State.generated.swift | Adds generated Swift types/fields for the judge rationale. |
| clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Actions.generated.swift | Adds generated Swift action field for confirmationReason. |
| clients/rust/crates/ahp/src/reducers.rs | Plumbs confirmation_reason into Rust pending-confirmation reducer output. |
| clients/rust/crates/ahp-types/src/state.rs | Adds Rust types/fields for the judge rationale in pending-confirmation state. |
| clients/rust/crates/ahp-types/src/actions.rs | Adds Rust action field for confirmation_reason. |
| clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/Reducers.kt | Plumbs confirmationReason into Kotlin pending-confirmation reducer output. |
| clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/State.generated.kt | Adds generated Kotlin types/fields for the judge rationale. |
| clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Actions.generated.kt | Adds generated Kotlin action field for confirmationReason. |
| clients/go/ahptypes/state.generated.go | Adds generated Go types/fields for the judge rationale in pending-confirmation state. |
| clients/go/ahptypes/actions.generated.go | Adds generated Go action field for ConfirmationReason. |
| clients/go/ahp/reducers.go | Plumbs ConfirmationReason into Go pending-confirmation reducer output. |
Review details
- Files reviewed: 26/30 changed files
- Comments generated: 1
- Review effort level: Low
Use StringOrMarkdown for the user-visible judge explanation so clients can render it consistently with other confirmation text. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
connor4312
reviewed
Jul 14, 2026
Model judge rationale as loading and complete states, include the normalized safety score, and preserve confirmation context when the async result updates a pending tool call. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Apply cargo fmt to the pending-confirmation preservation logic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
connor4312
reviewed
Jul 14, 2026
Comment on lines
+1154
to
+1155
| /** Why the tool requires user confirmation. */ | ||
| confirmationReason?: ToolCallJudgeConfirmationReason; |
Member
There was a problem hiding this comment.
Let's rename from confirmationReason to something like riskAssessment, and likewise update the interfaces/enums. Then I think this should be good.
Contributor
Author
There was a problem hiding this comment.
oh sorry i meant to do that yeah! sounds good thanks!
Use riskAssessment and ToolCallRiskAssessment across the protocol, generated SDKs, reducers, schemas, and fixtures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
connor4312
previously approved these changes
Jul 14, 2026
Apply gofmt to the pending risk-assessment update logic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
connor4312
approved these changes
Jul 14, 2026
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.
Summary
Adds model-judge confirmation rationale for the SDK auto-approval flow, mirroring microsoft/vscode#325547.
chat/toolCallReady