From a12a2384520ae7b7232510c1ceb9e6e2fee30c93 Mon Sep 17 00:00:00 2001 From: Codex Date: Mon, 1 Jun 2026 19:14:33 +0800 Subject: [PATCH] fix: pin agentrun bundle to v02 source --- scripts/g14-gitops-render.mjs | 3 +++ scripts/g14-gitops-render.test.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/scripts/g14-gitops-render.mjs b/scripts/g14-gitops-render.mjs index c066354f..92b9713f 100644 --- a/scripts/g14-gitops-render.mjs +++ b/scripts/g14-gitops-render.mjs @@ -832,6 +832,9 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch = upsertEnv(container.env, "HWLAB_GITOPS_TARGET", gitopsTarget); upsertEnv(container.env, "HWLAB_GITOPS_PROFILE", profileLabel); upsertEnv(container.env, "HWLAB_GITOPS_SOURCE_COMMIT", profile === "v02" ? runtimeCommit : source.full); + if (profile === "v02" && serviceId === "hwlab-cloud-api") { + upsertEnv(container.env, "HWLAB_CODE_AGENT_AGENTRUN_SOURCE_COMMIT", source.full); + } if (bootMetadata) { upsertEnv(container.env, "HWLAB_RUNTIME_MODE", bootMetadata.runtimeMode); upsertEnv(container.env, "HWLAB_BOOT_REPO", bootMetadata.bootRepo); diff --git a/scripts/g14-gitops-render.test.ts b/scripts/g14-gitops-render.test.ts index 4a2e7940..5497dadc 100644 --- a/scripts/g14-gitops-render.test.ts +++ b/scripts/g14-gitops-render.test.ts @@ -225,6 +225,10 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots assert.ok(devicePodEnv.some((entry) => entry.name === "HWLAB_BOOT_SH" && entry.value === "deploy/runtime/boot/hwlab-device-pod.sh")); assert.equal(devicePod.spec.template.metadata.annotations["hwlab.pikastech.local/runtime-mode"], "env-reuse-git-mirror-checkout"); assert.equal(devicePod.spec.template.metadata.annotations["hwlab.pikastech.local/boot-commit"], sourceRevision); + const cloudApi = workloadsJson.items.find((item) => item.metadata?.name === "hwlab-cloud-api"); + assert.ok(cloudApi, "expected v02 hwlab-cloud-api workload"); + const cloudApiEnv = cloudApi.spec.template.spec.containers[0].env; + assert.ok(cloudApiEnv.some((entry) => entry.name === "HWLAB_CODE_AGENT_AGENTRUN_SOURCE_COMMIT" && entry.value === sourceRevision)); const agentWorker = workloadsJson.items.find((item) => item.metadata?.name === "hwlab-agent-worker"); const agentWorkerEnv = agentWorker?.spec?.template?.spec?.containers?.[0]?.env ?? []; assert.equal(agentWorkerEnv.some((entry) => entry.name === "HWLAB_BOOT_COMMIT"), false, "agent-worker must not be switched to env reuse by device-pod work");