fix: 用 YAML 声明 AgentRun runner 保活策略

This commit is contained in:
Codex
2026-06-16 05:00:40 +00:00
parent f00b9385dd
commit ff7dbc7898
3 changed files with 12 additions and 0 deletions
+9
View File
@@ -102,6 +102,7 @@ export interface AgentRunLaneSpec {
readonly runner: {
readonly serviceAccount: string;
readonly jobNamePrefix: string;
readonly idleTimeoutMs: number;
readonly apiKeySecretRef: { readonly name: string; readonly key: string };
readonly egressProxyUrl: string | null;
readonly noProxyExtra: readonly string[];
@@ -284,6 +285,7 @@ export function agentRunLaneSummary(spec: AgentRunLaneSpec): Record<string, unkn
runner: {
serviceAccount: spec.deployment.runner.serviceAccount,
jobNamePrefix: spec.deployment.runner.jobNamePrefix,
idleTimeoutMs: spec.deployment.runner.idleTimeoutMs,
apiKeySecretRef: spec.deployment.runner.apiKeySecretRef,
egressProxyUrl: spec.deployment.runner.egressProxyUrl,
noProxyExtra: spec.deployment.runner.noProxyExtra,
@@ -519,6 +521,7 @@ function parseDeployment(input: Record<string, unknown>, path: string): AgentRun
runner: {
serviceAccount: stringField(runner, "serviceAccount", `${path}.runner`),
jobNamePrefix: stringField(runner, "jobNamePrefix", `${path}.runner`),
idleTimeoutMs: positiveIntegerField(runner, "idleTimeoutMs", `${path}.runner`),
apiKeySecretRef: parseSecretRef(recordField(runner, "apiKeySecretRef", `${path}.runner`), `${path}.runner.apiKeySecretRef`),
egressProxyUrl: optionalStringField(runner, "egressProxyUrl", `${path}.runner`) ?? null,
noProxyExtra: optionalStringArrayField(runner, "noProxyExtra", `${path}.runner`),
@@ -527,6 +530,12 @@ function parseDeployment(input: Record<string, unknown>, path: string): AgentRun
};
}
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`);
return value;
}
function parseLocalPostgres(input: Record<string, unknown>, path: string): AgentRunLaneSpec["deployment"]["localPostgres"] {
const enabled = booleanField(input, "enabled", path);
if (!enabled) {