fix: agent host confirmation creation#324886
Draft
justschen wants to merge 2 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #323262, where a pending file-creation confirmation (e.g. the agent creating package.json) rendered a file pill that opened an error instead of a preview of the proposed content. The root cause was that the confirmation sub-part's pill lost the "create" metadata and proposed-content URI, so clicking it tried to open a non-existent file. The fix threads a new editKind through the state→progress adapter and confirmation data, distinguishes "Create file?" vs "Write file?" in the permission display, and routes pill clicks through a shared editor-input builder so created files preview as an empty→proposed diff.
Changes:
- Derive whether a write permission targets a new file (
isNewFile) and surface distinct "Create file?" wording plus aCreating …invocation message, carryingeditKindintoIChatModifiedFilesConfirmationData. - Centralize preview-editor-input creation (
createModifiedFilePreviewEditorInput) and summary labels (getModifiedFilesSummaryLabel), and let inline anchor pills use a customopenResourcecallback so confirmation-message links preview the pending change. - Restore single external-edit pills to their original parent in the thinking content part, and add tests across the affected layers.
Show a summary per file
| File | Description |
|---|---|
copilotAgentSession.ts |
Computes isNewFile from built edits and passes it to getPermissionDisplay. |
copilotToolDisplay.ts |
Adds isNewFile param to emit Create-vs-Write title and invocation message. |
stateToProgressAdapter.ts |
Propagates edit.kind into modifiedFiles[].editKind (missing as ChatExternalEditKind cast — see comment). |
chatService.ts |
Adds optional editKind to IChatModifiedFilesConfirmationData.modifiedFiles. |
chatModifiedFilesConfirmationSubPart.ts |
New helpers for entry lookup, summary label, and preview-input creation; wires pill clicks to openModifiedFilePreview. |
chatInlineAnchorWidget.ts |
Adds openResource option and hoists editor-option computation before the override path. |
chatMarkdownDecorationsRenderer.ts |
Passes the new options argument to InlineAnchorWidget. |
chatThinkingContentPart.ts |
Adds restoreToOriginalParent so external-edit pills restore correctly. |
copilotAgentSession.test.ts |
Fake IFileService gains exists/writeFile/del; new create-wording test. |
copilotToolDisplay.test.ts |
Tests create-vs-edit write permission display. |
stateToProgressAdapter.test.ts |
Tests editKind/proposed-content mapping for pending create confirmations. |
chatModifiedFilesConfirmationSubPart.test.ts |
New unit tests for the extracted helpers. |
chatInlineAnchorWidget.test.ts |
Tests the custom openResource opener path. |
chatThinkingContentPart.test.ts |
Tests external-edit pill restoration beside a hidden tool invocation. |
Review details
- Files reviewed: 14/14 changed files
- Comments generated: 1
- Review effort level: Medium
Co-authored-by: justschen <54879025+justschen@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.
fix #323262
fix bug where confirmation sub part's pill did contain the right metadata
