Skip to content

Commit bfcb834

Browse files
authored
docs(protocol): allow Clients to tolerate a/ and b/ prefixes on relative git_patch paths (#2578)
The parsing note said to configure diff parsers not to strip any leading component. Absolute paths never carry Git's prefixes, so stripping only matters for relative paths, which already come from Agents that don't follow the rules. Say not to strip from absolute paths, and that Clients can still strip a/ or b/ from relative paths to tolerate Git's default output while changes decides the file.
1 parent 0948e17 commit bfcb834

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎docs/protocol/v2/draft/tool-calls.mdx‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,9 +594,12 @@ Git can produce most of this. With `$ROOT` set to the repository root,
594594
repository root prepended, with Git's quoting applied to the full path.
595595

596596
Many diff parsers strip one leading path component by default to remove Git's
597-
`a/` and `b/` prefixes, so configure them not to strip any. Take paths from
598-
`changes`, or from the `---`, `+++`, rename, and copy lines, rather than by
599-
splitting the `diff --git` header, which is ambiguous when paths contain spaces.
597+
`a/` and `b/` prefixes. Don't strip anything from an absolute path, which has no
598+
such prefix. A Client can still strip a leading `a/` or `b/` from a relative
599+
path to tolerate Agents that send Git's default output, as long as `changes`
600+
decides which file a patch belongs to. Take paths from `changes`, or from the
601+
`---`, `+++`, rename, and copy lines, rather than by splitting the `diff --git`
602+
header, which is ambiguous when paths contain spaces.
600603

601604
</ParamField>
602605

‎docs/protocol/v2/tool-calls.mdx‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,9 +594,12 @@ Git can produce most of this. With `$ROOT` set to the repository root,
594594
repository root prepended, with Git's quoting applied to the full path.
595595

596596
Many diff parsers strip one leading path component by default to remove Git's
597-
`a/` and `b/` prefixes, so configure them not to strip any. Take paths from
598-
`changes`, or from the `---`, `+++`, rename, and copy lines, rather than by
599-
splitting the `diff --git` header, which is ambiguous when paths contain spaces.
597+
`a/` and `b/` prefixes. Don't strip anything from an absolute path, which has no
598+
such prefix. A Client can still strip a leading `a/` or `b/` from a relative
599+
path to tolerate Agents that send Git's default output, as long as `changes`
600+
decides which file a patch belongs to. Take paths from `changes`, or from the
601+
`---`, `+++`, rename, and copy lines, rather than by splitting the `diff --git`
602+
header, which is ambiguous when paths contain spaces.
600603

601604
</ParamField>
602605

0 commit comments

Comments
 (0)