mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 08:02:31 +00:00
- Gracefully fall back to file-name summaries when staged diffs exceed node/ssh execution maxBuffer limits, preventing generation failures. - Split oversized diffs by file and allocate budget via water-filling, ensuring single huge files do not starve smaller human changes. - Clip truncated diff sections on line boundaries to avoid half-lines.
23 lines
654 B
TypeScript
23 lines
654 B
TypeScript
export function isMaxBufferOverflowError(error: unknown): boolean {
|
|
if (!error || typeof error !== 'object') {
|
|
return false
|
|
}
|
|
|
|
const maybeError = error as { code?: unknown; message?: unknown }
|
|
if (maybeError.code === 'ENOBUFS') {
|
|
return true
|
|
}
|
|
|
|
return typeof maybeError.message === 'string' && /\bmaxBuffer\b/i.test(maybeError.message)
|
|
}
|
|
|
|
export function describeMaxBufferOverflowError(error: unknown): string {
|
|
if (error && typeof error === 'object') {
|
|
const message = (error as { message?: unknown }).message
|
|
if (typeof message === 'string' && message.length > 0) {
|
|
return message
|
|
}
|
|
}
|
|
return String(error)
|
|
}
|