mirror of
https://github.com/openai/codex-security.git
synced 2026-12-04 01:55:06 +08:00
refactor(deep-scan): strip the compaction prefix in one step
This commit is contained in:
@@ -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.") ||
|
||||
|
||||
Reference in New Issue
Block a user