Repository navigation
file attachment support
Date: 2026-07-19 Tracking: Issue #67, sub-issues #68, #69, #70, #71, and #72
Implement file attachments in the chat tool window: the paperclip button opens
a multi-file picker, a # token in the composer opens an inline workspace-file
suggestion list, and pending attachments render as removable chips above the
composer. On send, attachments become turn/start input items — local image
files as localImage items and other files as mention items, reusing the
existing IDE-context mention serialization.
Drag & drop is explicitly deferred: Remote UI supports no code-behind or event
handlers, so drop events cannot deliver file paths to the extension process.
An upstream SDK feature request is open (VSExtensibility request 561). The
deferral is recorded in doc/adr.md.
- Chips are the single source of truth for attachments; the
#filenametext is a visual echo. Remote UI exposes no caret position, so token tracking is unreliable; deleting the text does not detach the file — the chip's remove button does. - User-picked files may live outside the workspace, but both the extension and the worker validate existence and the protected-directory policy (defense in depth). IDE-context mentions remain workspace-only.
- Steering turns stay text-only; pending chips are consumed by the next
turn/start. Chips clear only after a successful send.
- Contracts and worker: add
AttachmentInfo { Path, Kind }andStartTurnRequest.Attachments; emitlocalImage/mentionitems inBuildTurnInputbehind a newIsAllowedAttachmentPathgate with deduplication against IDE-context mentions and a cap of 10. - Services:
IFilePickerServicewrapping the shell multi-file dialog, andIWorkspaceFileSearchServicebacked by the workspace project query with a bounded disk-enumeration fallback, a short TTL cache, and testable filter/rank logic (top 20, filename prefix > substring > path substring). - Chips UI:
AttachmentChipViewModeldata contract,PendingAttachmentscollection on the chat view model, a chip row in the composer grid, and a real attach-button handler (validate, dedupe, cap, announce). -
#trigger: a file-suggestion presentation view model parallel to the slash-command one, trailing-token detection with##escape and mutual exclusion with slash suggestions, 150 ms debounce, and accept behavior that rewrites the token and adds a chip. - Docs: create
doc/adr.md(drag & drop deferral and the decisions above) and record the work indoc/task.md.
- Unit tests for turn-input shapes, path-policy gating, deduplication, and the empty-attachment regression case.
- View-model tests for chip add/remove/cap, send copy-and-clear, failure retention, and steering retention with a fake picker and search service.
- Trigger tests: trailing-token-only activation,
##escape, slash/file mutual exclusion, accept rewrite, chip survival after token edits, and debounce cancellation. - Release build with warnings as errors; manual checks in the experimental
instance for picker flow, chip rendering,
#navigation keys, and caret stability while typing.
- No code-behind or event handlers in Remote UI XAML; all new view-model
types carry
DataContract/DataMemberattributes. -
localImagesupport depends on the installed Codex CLI version; an unsupported item type surfaces through the existing app-server error path.