Skip to content

fix: agent host confirmation creation#324886

Draft
justschen wants to merge 2 commits into
mainfrom
justin/greedent
Draft

fix: agent host confirmation creation#324886
justschen wants to merge 2 commits into
mainfrom
justin/greedent

Conversation

@justschen

@justschen justschen commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

fix #323262

fix bug where confirmation sub part's pill did contain the right metadata
image (102)

Copilot AI review requested due to automatic review settings July 8, 2026 08:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 a Creating … invocation message, carrying editKind into IChatModifiedFilesConfirmationData.
  • Centralize preview-editor-input creation (createModifiedFilePreviewEditorInput) and summary labels (getModifiedFilesSummaryLabel), and let inline anchor pills use a custom openResource callback 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>
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.

package.json file creation renders pill that shows error

3 participants