Skip to content

Commit f31d8c1

Browse files
authored
fix(ui): persist environment variable removal (NeuralNomadsAI#581)
## Summary - Send an explicit JSON Merge Patch deletion when removing an environment variable. - Prevent deleted variables from remaining in config.yaml and being injected into future OpenCode instances. - Maybe closes NeuralNomadsAI#575 ## Root Cause The previous removal flow submitted the remaining environment-variable record without the selected key. The settings API recursively applies JSON Merge Patch, where an omitted nested key means no change rather than deletion. ## Validation - npm run typecheck --workspace @codenomad/ui - npm run build --workspace @codenomad/ui - git diff --check
1 parent 1efe5e9 commit f31d8c1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/ui/src/stores/preferences.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,9 @@ function addEnvironmentVariable(key: string, value: string, secure: boolean = tr
647647
}
648648

649649
function removeEnvironmentVariable(key: string): void {
650-
const current = serverSettings().environmentVariables
651-
const { [key]: removed, ...rest } = current
652-
updateEnvironmentVariables(rest)
650+
void patchConfigOwner("server", { environmentVariables: { [key]: null } }).catch((error) =>
651+
log.error("Failed to remove environment variable", error),
652+
)
653653
}
654654

655655
function isSecureEnvVar(key: string): boolean {

0 commit comments

Comments
 (0)