Skip to content

chat: add judge confirmation rationale#333

Merged
justschen merged 6 commits into
mainfrom
justin/nickit
Jul 14, 2026
Merged

chat: add judge confirmation rationale#333
justschen merged 6 commits into
mainfrom
justin/nickit

Conversation

@justschen

@justschen justschen commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds model-judge confirmation rationale for the SDK auto-approval flow, mirroring microsoft/vscode#325547.

  • Add typed judge rationale to chat/toolCallReady
  • Persist the rationale in pending-confirmation state
  • Propagate it through all client reducers
  • Regenerate schemas and SDK types
  • Add reducer fixtures and a changelog fragment

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>

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

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 ToolCallJudgeConfirmationReason and plumb confirmationReason through chat/toolCallReady into ToolCallPendingConfirmationState.
  • 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

Comment thread types/channels-chat/state.ts Outdated
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>
Comment thread types/channels-chat/actions.ts Outdated
justschen and others added 2 commits July 14, 2026 10:33
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>
Comment thread types/channels-chat/state.ts Outdated
Comment on lines +1154 to +1155
/** Why the tool requires user confirmation. */
confirmationReason?: ToolCallJudgeConfirmationReason;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's rename from confirmationReason to something like riskAssessment, and likewise update the interfaces/enums. Then I think this should be good.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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
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>
@justschen justschen marked this pull request as ready for review July 14, 2026 19:47
@justschen justschen enabled auto-merge July 14, 2026 19:56
@justschen justschen merged commit fead59f into main Jul 14, 2026
9 checks passed
@justschen justschen deleted the justin/nickit branch July 14, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants