Skip to content

The open-source app everyone uses to manage agents at work

fix(ui): preserve env var when switching type from Plain to Secret

Cody (Radius Red)06cf00129fa6
diff --git a/ui/src/components/AgentConfigForm.tsx b/ui/src/components/AgentConfigForm.tsx
index 06c74e65ee..7d5c4f4582 100644
--- a/ui/src/components/AgentConfigForm.tsx
+++ b/ui/src/components/AgentConfigForm.tsx
@@ -1170,8 +1170,12 @@ function EnvVarEditor({
const k = row.key.trim();
if (!k) continue;
if (row.source === "secret") {
- if (!row.secretId) continue;
- rec[k] = { type: "secret_ref", secretId: row.secretId, version: "latest" };
+ if (row.secretId) {
+ rec[k] = { type: "secret_ref", secretId: row.secretId, version: "latest" };
+ } else {
+ // Preserve as plain during transition to avoid data loss
+ rec[k] = { type: "plain", value: row.plainValue };
+ }
} else {
rec[k] = { type: "plain", value: row.plainValue };
}