refactor(deep-scan): strip the compaction prefix in one step

This commit is contained in:
Codex
2026-10-26 16:41:26 +00:00
parent 05ce68f2aa
commit d103eaab00
@@ -31,14 +31,9 @@ const USAGE_LIMIT_MESSAGES = new Set([
"You hit your spend cap set by the owner of your workspace. Ask an owner to increase your spend cap to continue.",
]);
// Codex reports failures from remote context compaction with this prefix.
const REMOTE_COMPACTION_ERROR_PREFIX = "Error running remote compact task: ";
// Codex exec exposes only text for failed turns. Match its native quota messages here.
export function codexWorkerTurnError(message: string): Error {
const reason = message.startsWith(REMOTE_COMPACTION_ERROR_PREFIX)
? message.slice(REMOTE_COMPACTION_ERROR_PREFIX.length)
: message;
const reason = message.replace(/^Error running remote compact task: /, "");
if (
USAGE_LIMIT_MESSAGES.has(reason) ||
reason.startsWith("You’ve hit your usage limit.") ||