agentHost: resume failed turns without a new message - #329506
Draft
roblourens (roblourens) wants to merge 13 commits into
Draft
agentHost: resume failed turns without a new message#329506roblourens (roblourens) wants to merge 13 commits into
roblourens (roblourens) wants to merge 13 commits into
Conversation
Add capability-gated same-turn retries for Copilot and Codex without creating another user message. Reuse the existing Try Again error affordance, preserve partial output across retries and reloads, and reconcile concurrent client resumes safely.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep standalone context compaction as its own /compact turn while continuing to coalesce true empty-input retry turns. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds AHP 0.8 failed-turn resumption while preserving logical turn state across clients and providers.
Changes:
- Adds resumable turn protocol state, dispatch, reconciliation, and Try Again UI.
- Implements zero-message resume for Copilot and Codex, including replay and turn-ID mapping.
- Expands unit coverage for retries, concurrency, restoration, file changes, forks, and truncation.
Show a summary per file
| File | Description |
|---|---|
src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.ts |
Adds sequenced action dispatch. |
src/vs/workbench/contrib/terminal/test/browser/agentHostPty.test.ts |
Updates connection mock. |
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts |
Tests retry UI and reconciliation. |
src/vs/workbench/contrib/chat/test/browser/agentHost/agentHostResponseFileChanges.test.ts |
Tests synthetic retry IDs. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts |
Supports custom restored errors. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts |
Implements retry UI and observation. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostResponseFileChanges.ts |
Resolves retry IDs to turns. |
src/vs/platform/agentHost/test/node/reducers.test.ts |
Tests resume reducer behavior. |
src/vs/platform/agentHost/test/node/mockAgent.ts |
Adds mock resume support. |
src/vs/platform/agentHost/test/node/mapSessionEvents.test.ts |
Tests restored Copilot failures. |
src/vs/platform/agentHost/test/node/copilotTestEvents.ts |
Types session-error fixtures. |
src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts |
Tests zero-message Copilot resume. |
src/vs/platform/agentHost/test/node/copilotAgent.test.ts |
Tests Copilot resume routing. |
src/vs/platform/agentHost/test/node/codex/codexReplayMapper.test.ts |
Tests retry-turn coalescing. |
src/vs/platform/agentHost/test/node/codex/codexMapAppServerEvents.test.ts |
Tests resumable Codex errors. |
src/vs/platform/agentHost/test/node/codex/codexForkPlan.test.ts |
Tests coalesced fork mapping. |
src/vs/platform/agentHost/test/node/agentSideEffects.test.ts |
Tests resume side effects. |
src/vs/platform/agentHost/test/node/agentService.test.ts |
Tests concurrent resume rejection. |
src/vs/platform/agentHost/node/copilot/mapSessionEvents.ts |
Restores resumable Copilot errors. |
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts |
Continues Copilot with no messages. |
src/vs/platform/agentHost/node/copilot/copilotAgent.ts |
Routes Copilot resume operations. |
src/vs/platform/agentHost/node/codex/codexReplayMapper.ts |
Coalesces physical retry turns. |
src/vs/platform/agentHost/node/codex/codexMapAppServerEvents.ts |
Marks eligible Codex failures. |
src/vs/platform/agentHost/node/codex/codexForkPlan.ts |
Maps logical to physical turns. |
src/vs/platform/agentHost/node/codex/codexAgent.ts |
Implements empty-input Codex retry. |
src/vs/platform/agentHost/node/agentSideEffects.ts |
Executes provider resume operations. |
src/vs/platform/agentHost/node/agentService.ts |
Validates resume transitions. |
src/vs/platform/agentHost/electron-browser/localAgentHostService.ts |
Exposes sequenced dispatch locally. |
src/vs/platform/agentHost/common/state/sessionActions.ts |
Re-exports resume action. |
src/vs/platform/agentHost/common/state/protocol/version/registry.ts |
Registers AHP 0.8 action. |
src/vs/platform/agentHost/common/state/protocol/common/actions.ts |
Adds resume action type. |
src/vs/platform/agentHost/common/state/protocol/channels-chat/state.ts |
Adds per-turn eligibility. |
src/vs/platform/agentHost/common/state/protocol/channels-chat/reducer.ts |
Reopens failed turns. |
src/vs/platform/agentHost/common/state/protocol/channels-chat/actions.ts |
Defines resume protocol data. |
src/vs/platform/agentHost/common/state/protocol/action-origin.generated.ts |
Updates generated action metadata. |
src/vs/platform/agentHost/common/state/protocol/.ahp-version |
Pins protocol dependency. |
src/vs/platform/agentHost/common/agentService.ts |
Extends agent and connection APIs. |
src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.ts |
Returns optimistic sequence IDs. |
src/vs/platform/agentHost/browser/nullAgentHostService.ts |
Implements unsupported dispatch stub. |
Review details
- Files reviewed: 39/39 changed files
- Comments generated: 3
- Review effort level: Balanced
(Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Prevent retries for archived and read-only chats, and preserve Codex model, customization, and trace context when resuming a turn.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Explain how keyboard and screen reader users can focus and activate Try Again for resumable failures.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Try Again affordance uses an existing standard Chat error button and does not need dedicated accessibility help text.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reserve the development-only recoverable error injection for the exact prompt so ordinary error requests run normally.\n\n(Written by Copilot)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Record and replay a full Copilot failure-to-resume flow, asserting one durable AHP turn and no duplicate user message. Remove Codex failed-turn resume support after black-box testing showed that an empty turn/start completes without invoking the model.\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
sendMessages({ messages: [] })and Codex throughturn/startwith an empty inputProtocol dependency
Depends on microsoft/agent-host-protocol#371, which adds
chat/turnResumedand per-turnresumablestate for AHP 0.8.Review notes
The highest-risk areas are:
The implementation intentionally avoids a static agent capability:
Turn.resumableis the precise gate, and provider resume is an optional host-side operation.Validation
npm run typecheck-clientnpm run valid-layers-checknpm run precommit(Written by Copilot)