mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
perf: reject file-count labels before parsing edit patches (#20330)
Co-authored-by: Orca Worker <orca-worker@localhost>
This commit is contained in:
@@ -44,6 +44,10 @@ export function editFilesFromPatchText(
|
||||
callerPath: string | null,
|
||||
summaryOnly = false
|
||||
): NativeChatEditFileSummary[] | null {
|
||||
if (callerPath !== null && FILE_COUNT_PATH.test(callerPath)) {
|
||||
// A file count cannot name a card, regardless of the patch contents.
|
||||
return null
|
||||
}
|
||||
// The body carries its own marker when the journal clipped it. Read as
|
||||
// content it becomes a numbered line of the file, and the rows that follow
|
||||
// are reported complete.
|
||||
@@ -52,12 +56,6 @@ export function editFilesFromPatchText(
|
||||
// One card per file the patch touches: run together, the later files' rows
|
||||
// and gutter numbers sit under the first file's name.
|
||||
const split = unifiedPatchSections(moved.body)
|
||||
if (callerPath !== null && FILE_COUNT_PATH.test(callerPath)) {
|
||||
// The producer joined several files' patches and kept a count in place of a
|
||||
// path, so nothing here can name a file. Naming the card after the count
|
||||
// would assert a file that does not exist.
|
||||
return null
|
||||
}
|
||||
// A patch that names one file is the file the call is reporting on, so the
|
||||
// call's own path wins — it is the provider's, where the header's is relative
|
||||
// to the patch. A patch naming several has no one path, and a rename's
|
||||
|
||||
Reference in New Issue
Block a user