Skip to content

Publish committed file diffs over ACP - #495

Draft
haveanicedavid wants to merge 1 commit into
vercel-labs:mainfrom
haveanicedavid:fix/acp-publish-file-diffs
Draft

Publish committed file diffs over ACP#495
haveanicedavid wants to merge 1 commit into
vercel-labs:mainfrom
haveanicedavid:fix/acp-publish-file-diffs

Conversation

@haveanicedavid

Copy link
Copy Markdown

Problem

fx computes and retains an authoritative committed-file handoff containing the
canonical path, previous content, new content, and tool-call identity.

The ACP adapter currently discards that handoff:

  • publishCommittedFileHandoff reports the diff as skipped.
  • ACP clients receive only completion text such as
    edited README.md (5115 bytes).
  • Clients therefore cannot render accurate inline diffs or file-change
    summaries.

A client cannot safely recover the missing information by parsing that prose,
watching the filesystem, or taking Git snapshots. Those approaches cannot
reliably attribute changes to a specific tool call and may include pre-existing
or concurrent edits.

ACP already defines structured diff tool-call content with path, oldText,
and newText, so no protocol extension is needed.

Change

Publish the existing committed-file handoff as an ACP tool_call_update
containing:

  • The canonical absolute file path
  • The exact previous content, or null for a new file
  • The exact committed content
  • The original tool-call ID

The subsequent completion update omits content. ACP content updates replace
the collection when present, so omitting it preserves the previously published
diff while still advancing the tool status to completed.

This uses fx's existing source of truth and adds no filesystem polling,
snapshotting, or provider-specific client behavior.

Verification

  • zig build
  • zig fmt --check src/
  • bun test acp.test.ts -t 'ACP publishes committed file changes as authoritative diffs'

The end-to-end test drives the freshly built fx acp binary and verifies:

  • The file is committed.
  • The diff update contains the canonical path and exact old/new contents.
  • The diff precedes the completed update.
  • Completion does not overwrite the diff content.
  • stderr remains empty.

Required label: type: bug.

@vercel-security-reviewer

Copy link
Copy Markdown

@haveanicedavid
haveanicedavid marked this pull request as ready for review August 28, 2026 06:17
@haveanicedavid
haveanicedavid marked this pull request as draft August 30, 2026 07:49
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.

1 participant