fix: configure agentrun backend retry policy

This commit is contained in:
Codex
2026-06-21 23:57:35 +00:00
parent 3580e3729a
commit e1bab4853a
3 changed files with 25 additions and 0 deletions
+14
View File
@@ -105,6 +105,11 @@ export interface AgentRunLaneSpec {
readonly jobNamePrefix: string;
readonly idleTimeoutMs: number;
readonly missingTerminalAfterToolTimeoutMs: number;
readonly backendRetry: {
readonly maxAttempts: number;
readonly initialBackoffMs: number;
readonly maxBackoffMs: number;
};
readonly apiKeySecretRef: { readonly name: string; readonly key: string };
readonly egressProxyUrl: string | null;
readonly noProxyExtra: readonly string[];
@@ -543,6 +548,7 @@ function parseDeployment(input: Record<string, unknown>, path: string): AgentRun
jobNamePrefix: stringField(runner, "jobNamePrefix", `${path}.runner`),
idleTimeoutMs: positiveIntegerField(runner, "idleTimeoutMs", `${path}.runner`),
missingTerminalAfterToolTimeoutMs: positiveIntegerField(runner, "missingTerminalAfterToolTimeoutMs", `${path}.runner`),
backendRetry: parseRunnerBackendRetry(recordField(runner, "backendRetry", `${path}.runner`), `${path}.runner.backendRetry`),
apiKeySecretRef: parseSecretRef(recordField(runner, "apiKeySecretRef", `${path}.runner`), `${path}.runner.apiKeySecretRef`),
egressProxyUrl: optionalStringField(runner, "egressProxyUrl", `${path}.runner`) ?? null,
noProxyExtra: optionalStringArrayField(runner, "noProxyExtra", `${path}.runner`),
@@ -573,6 +579,14 @@ function parseRunnerRetention(input: Record<string, unknown>, path: string): Age
};
}
function parseRunnerBackendRetry(input: Record<string, unknown>, path: string): AgentRunLaneSpec["deployment"]["runner"]["backendRetry"] {
return {
maxAttempts: positiveIntegerField(input, "maxAttempts", path),
initialBackoffMs: positiveIntegerField(input, "initialBackoffMs", path),
maxBackoffMs: positiveIntegerField(input, "maxBackoffMs", path),
};
}
function positiveIntegerField(input: Record<string, unknown>, key: string, path: string): number {
const value = integerField(input, key, path);
if (value <= 0) throw new Error(`${path}.${key} must be a positive integer`);
+3
View File
@@ -440,6 +440,9 @@ function managerEnv(spec: AgentRunLaneSpec, sourceCommit: string, imageRef: stri
{ name: "AGENTRUN_RUNNER_JOB_NAME_PREFIX", value: spec.deployment.runner.jobNamePrefix },
{ name: "AGENTRUN_RUNNER_IDLE_TIMEOUT_MS", value: String(spec.deployment.runner.idleTimeoutMs) },
{ name: "AGENTRUN_RUNNER_MISSING_TERMINAL_AFTER_TOOL_TIMEOUT_MS", value: String(spec.deployment.runner.missingTerminalAfterToolTimeoutMs) },
{ name: "AGENTRUN_BACKEND_RETRY_MAX_ATTEMPTS", value: String(spec.deployment.runner.backendRetry.maxAttempts) },
{ name: "AGENTRUN_BACKEND_RETRY_INITIAL_BACKOFF_MS", value: String(spec.deployment.runner.backendRetry.initialBackoffMs) },
{ name: "AGENTRUN_BACKEND_RETRY_MAX_BACKOFF_MS", value: String(spec.deployment.runner.backendRetry.maxBackoffMs) },
{ name: "AGENTRUN_RUNNER_RETENTION_MAX_RUNNERS", value: String(spec.deployment.runner.retention.maxRunners) },
{ name: "AGENTRUN_RUNNER_RETENTION_CLEANUP_ORDER", value: spec.deployment.runner.retention.cleanupOrder },
{ name: "AGENTRUN_RUNNER_RETENTION_ACTIVE_HEARTBEAT_MAX_AGE_MS", value: String(spec.deployment.runner.retention.activeHeartbeatMaxAgeMs) },