Merge pull request #636 from pikasTech/fix/agentrun-backend-retry-225-20260621

fix: configure agentrun backend retry policy
This commit is contained in:
Lyon
2026-06-22 07:58:12 +08:00
committed by GitHub
3 changed files with 25 additions and 0 deletions
+8
View File
@@ -152,6 +152,10 @@ controlPlane:
jobNamePrefix: agentrun-v01-runner
idleTimeoutMs: 600000
missingTerminalAfterToolTimeoutMs: 60000
backendRetry:
maxAttempts: 1
initialBackoffMs: 1000
maxBackoffMs: 30000
apiKeySecretRef:
name: agentrun-v01-api-key
key: HWLAB_API_KEY
@@ -327,6 +331,10 @@ controlPlane:
jobNamePrefix: agentrun-v02-runner
idleTimeoutMs: 172800000
missingTerminalAfterToolTimeoutMs: 180000
backendRetry:
maxAttempts: 5
initialBackoffMs: 1000
maxBackoffMs: 30000
apiKeySecretRef:
name: agentrun-v02-api-key
key: HWLAB_API_KEY
+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) },