Skip to content

Commit b6c554f

Browse files
Copilotpelikhan
andauthored
test: guard codex active-goal error from retry loop
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 9a18c3d commit b6c554f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

actions/setup/js/codex_harness.test.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const {
2525
validateCodexOpenAIBaseURLFromReflect,
2626
hasNoopInSafeOutputs,
2727
} = require("./codex_harness.cjs");
28+
const { detectNonRetryableHarnessGuard } = require("./harness_retry_guard.cjs");
2829

2930
const agentTempDir = "/tmp/gh-aw/agent";
3031

@@ -409,11 +410,10 @@ env_key = "OPENAI_API_KEY"
409410
if (result.exitCode === 0) return false;
410411
const RATE_LIMIT_ERROR_PATTERN = /rate_limit_exceeded|429 Too Many Requests|RateLimitError/i;
411412
const SERVER_ERROR_PATTERN = /InternalServerError|ServiceUnavailableError|500 Internal Server Error|503 Service Unavailable/i;
412-
const GOAL_ALREADY_ACTIVE_PATTERN = /cannot create a new goal because this thread already has a goal|this thread already has a goal|use update_goal only when the existing goal is complete/i;
413413
if (attempt === 0 && isAuthenticationFailedError(result.output)) return false;
414414
if (isMissingApiKeyError(result.output)) return false;
415415
if (hasNumerousPermissionDeniedIssues(result.output)) return false;
416-
if (GOAL_ALREADY_ACTIVE_PATTERN.test(result.output)) return false;
416+
if (detectNonRetryableHarnessGuard(result.output).goalAlreadyActive) return false;
417417
const isTransient = RATE_LIMIT_ERROR_PATTERN.test(result.output) || SERVER_ERROR_PATTERN.test(result.output);
418418
return attempt < MAX_RETRIES && (result.hasOutput || isTransient);
419419
}

actions/setup/js/harness_retry_guard.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
const AI_CREDITS_EXCEEDED_PATTERNS = [/\bmax[\s_-]*ai[\s_-]*credits[\s_-]*exceeded\b/i, /\bai[\s_-]*credits[\s_-]*rate[\s_-]*limit[\s_-]*error\b/i, /ai[\s_-]*credits?.*(?:rate[\s-]*limit|limit exceeded|budget exceeded|exceeded)/i];
66

77
const AWF_API_PROXY_BLOCKING_REQUESTS_PATTERNS = [/\bawf\b.*\bapi[\s_-]*proxy\b.*\bblocking requests\b/i, /\bapi[\s_-]*proxy\b.*\bblocking requests\b/i, /\bapi[\s_-]*proxy\b.*\bblocked requests?\b/i, /\bDIFC_FILTERED\b/];
8-
const GOAL_ALREADY_ACTIVE_PATTERNS = [/\bcannot create a new goal because this thread already has a goal\b/i, /\bthis thread already has a goal\b/i, /\buse update_goal only when the existing goal is complete\b/i];
8+
const GOAL_ALREADY_ACTIVE_PATTERNS = [/\bthis thread already has a goal\b.*\buse update_goal only when the existing goal is complete\b/i];
99

1010
/**
1111
* Detect retry guard conditions that should stop harness retries immediately.

0 commit comments

Comments
 (0)