Add durable error response parts and turn resume - #390
Draft
roblourens wants to merge 4 commits into
Draft
Conversation
Represent turn errors as durable response parts with optional host-provided recovery actions. Selecting an action records the decision and reopens the same turn without adding another user message.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Represent errors as durable response parts with an optional resumable flag and add chat/turnResume to reopen the latest errored turn without a new message.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Return no response-part identifier for durable error parts, which do not carry an id.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds durable turn-error response parts and resumable errored turns across the protocol and generated clients.
Changes:
- Introduces
ErrorResponsePartandchat/turnResume. - Updates reducers and fixtures for resume eligibility and error preservation.
- Regenerates schemas, SDK models, documentation, and changelog metadata.
Show a summary per file
| File | Description |
|---|---|
types/version/registry.ts |
Registers the resume action for protocol 0.8. |
types/test-cases/reducers/270-chat-responsepart-cannot-append-error.json |
Tests rejecting generic error-part appends. |
types/test-cases/reducers/269-chat-turn-resume-completes-one-turn.json |
Tests completing a resumed turn. |
types/test-cases/reducers/268-chat-turn-resume-preserves-errors-across-retries.json |
Tests preserving repeated errors. |
types/test-cases/reducers/267-chat-turn-resume-noop-for-unresumable-error.json |
Tests unresumable-error rejection. |
types/test-cases/reducers/266-chat-turn-resume-noop-for-nonlatest-turn.json |
Tests stale-turn rejection. |
types/test-cases/reducers/265-chat-turn-resume-noop-for-unknown-turn.json |
Tests unknown-turn rejection. |
types/test-cases/reducers/264-chat-turn-resume-noop-with-active-turn.json |
Tests active-turn rejection. |
types/test-cases/reducers/263-chat-turn-resume-reopens-turn.json |
Tests reopening an errored turn. |
types/test-cases/reducers/250-turncomplete-force-cancels-auth-required-tool-call.json |
Updates completed-turn expectations. |
types/test-cases/reducers/240-turn-duration-is-clamped-to-zero.json |
Updates completed-turn expectations. |
types/test-cases/reducers/161-chat-turn-lifecycle-on-chat.json |
Updates lifecycle expectations. |
types/test-cases/reducers/107-session-input-turn-end-cleans-turn-scoped-only.json |
Updates finalized-turn expectations. |
types/test-cases/reducers/099-endturn-force-cancels-running-tool-call.json |
Updates completed-turn expectations. |
types/test-cases/reducers/070-full-turn-flow-with-tool-calls-and-re-confirmation.json |
Updates full-flow expectations. |
types/test-cases/reducers/017-turncomplete-force-cancels-in-progress-tool-calls.json |
Updates completed-turn expectations. |
types/test-cases/reducers/016-session-error-finalizes-turn-with-error.json |
Moves errors into response parts. |
types/test-cases/reducers/015-session-turncancelled-finalizes-turn.json |
Removes obsolete null error state. |
types/test-cases/reducers/014-session-turncomplete-finalizes-turn.json |
Removes obsolete null error state. |
types/common/actions.ts |
Adds the resume action to common unions. |
types/channels-chat/state.ts |
Defines durable error response parts. |
types/channels-chat/reducer.ts |
Implements error finalization and resume behavior. |
types/channels-chat/actions.ts |
Defines error and resume action contracts. |
types/action-origin.generated.ts |
Marks resume as client-dispatchable. |
scripts/generate-swift.ts |
Adds Swift generation metadata. |
scripts/generate-rust.ts |
Adds Rust generation metadata. |
scripts/generate-kotlin.ts |
Adds Kotlin generation metadata. |
scripts/generate-go.ts |
Adds Go generation metadata. |
schema/state.schema.json |
Adds error-part state schema. |
schema/notifications.schema.json |
Propagates error-part definitions. |
schema/errors.schema.json |
Propagates action and error schemas. |
schema/commands.schema.json |
Propagates action and response schemas. |
schema/actions.schema.json |
Defines updated chat action schemas. |
docs/specification/chat-channel.md |
Documents recovery semantics and validation. |
docs/guide/state-model.md |
Documents durable errors in state. |
docs/guide/actions.md |
Lists the new resume action. |
docs/.changes/20260811-error-response-parts-and-turn-resume.json |
Records the user-visible change. |
clients/swift/AgentHostProtocol/Tests/AgentHostProtocolTests/ReducersTests.swift |
Tests resume dispatchability. |
clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/ToolCallStateExtensions.swift |
Handles the new response variant. |
clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Reducers.swift |
Implements Swift reducer behavior. |
clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/State.generated.swift |
Regenerates Swift state models. |
clients/swift/AgentHostProtocol/Sources/AgentHostProtocol/Generated/Actions.generated.swift |
Regenerates Swift actions. |
clients/rust/crates/ahp/src/reducers.rs |
Implements Rust reducer behavior. |
clients/rust/crates/ahp-types/src/state.rs |
Regenerates Rust state models. |
clients/rust/crates/ahp-types/src/actions.rs |
Regenerates Rust actions. |
clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/Reducers.kt |
Implements Kotlin reducer behavior. |
clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/State.generated.kt |
Regenerates Kotlin state models. |
clients/kotlin/src/main/kotlin/com/microsoft/agenthostprotocol/generated/Actions.generated.kt |
Regenerates Kotlin actions. |
clients/go/ahptypes/state.generated.go |
Regenerates Go state models. |
clients/go/ahptypes/actions.generated.go |
Regenerates Go actions. |
clients/go/ahp/reducers.go |
Implements Go reducer behavior. |
Review details
Tip
Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 47/51 changed files
- Comments generated: 5
- Review effort level: Balanced
Tighten generic response parts to exclude errors, align resumability across generated clients, preserve the Rust error discriminator, update the Swift example, and cover completed-turn rejection.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
ErrorResponsePartentries in the response stream while retainingTurnState.Erroras the top-level terminal signal.resumable: true; clients decide whether and how to present a resume affordance.chat/turnResumeaction, which reopens the latest resumable errored turn with the same turn ID, message, response parts, and usage—without adding a synthetic message or turn.Semantics
The host accepts
chat/turnResumeonly when no turn is active, the requested turn is the latest turn, that turn is errored, and its final response part is resumable. Invalid or stale resume actions are rejected before provider side effects run.Minimal clients can ignore
resumableand continue rendering a coherent terminal error. Clients that support resume can render any appropriate affordance and dispatchchat/turnResumewhen the user invokes it.Validation
npm test: 396 passing with 100% reducer branch coverage.cargo check --tests.(Written by Copilot)