mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-10 01:50:13 +01:00
fix(server): shed only retryable object-journal reads under load (#19176)
Client polling can exhaust the shared object journal queue and reject log persistence. Bound ordinary object-log and trace reads, keep persistence and internal verification queued, and return retryable 503 responses when reads are busy. Leave feedback exports unsent until every log page is available.
Validation: 72 latest-master affected tests and 10 workflow tests pass locally, with the workflow fixture passing strict TypeScript checks. The preceding broader run passed 280 server tests with two opt-in S3 skips. All applicable checks on d0a937768d are green (56 success, three skipped); exact-head Apex review is 5/5 with no unresolved findings. Background persistence still has no fixed queue bound during a prolonged storage outage.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
18 files changed
+382
-33
No files matched your search
@@ -18,6 +18,7 @@ import {
|
||||
redactSensitiveValueOccurrences,
|
||||
} from "./redact-sensitive.js";
|
||||
import { recordResponsibleUserDenialOnActiveRun } from "../services/responsible-user-denial-run-outcomes.js";
|
||||
import { isObjectJournalBusyError } from "../services/object-byte-journal.js";
|
||||
import { isExpectedMcpConnectionFailure } from "../services/mcp-connection-failure.js";
|
||||
import { isEndedDbPoolError } from "../database-retry.js";
|
||||
import { ToolGatewayHttpError } from "../services/tool-gateway.js";
|
||||
@@ -323,6 +324,16 @@ export function errorHandler(
|
||||
return;
|
||||
}
|
||||
|
||||
if (isObjectJournalBusyError(rootError)) {
|
||||
if (!res.headersSent) {
|
||||
res.set("Retry-After", "2");
|
||||
res.status(503).json({ error: rootError.message, code: rootError.code });
|
||||
} else {
|
||||
res.end();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const reportableError = sanitizeSecretSensitiveError(req, rootError);
|
||||
attachErrorContext(
|
||||
req,
|
||||
|
||||
Reference in new issue
Block a user