The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
fix(server): preserve adapter-agnostic keys when changing adapter type
Cody (Radius Red)ce8d9eb3234f
diff --git a/server/src/routes/agents.ts b/server/src/routes/agents.tsindex 2ad85e6313..c2cacfe492 100644--- a/server/src/routes/agents.ts+++ b/server/src/routes/agents.ts@@ -1772,6 +1772,18 @@ export function agentRoutes(db: Db) {rawEffectiveAdapterConfig = { ...existingAdapterConfig, ...requestedAdapterConfig };}if (changingAdapterType) {+ // Preserve adapter-agnostic keys (env, cwd, etc.) from the existing config+ // when the adapter type changes. Without this, a PATCH that includes+ // adapterConfig but omits these keys would silently drop them.+ const ADAPTER_AGNOSTIC_KEYS = [+ "env", "cwd", "timeoutSec", "graceSec",+ "promptTemplate", "bootstrapPromptTemplate",+ ] as const;+ for (const key of ADAPTER_AGNOSTIC_KEYS) {+ if (rawEffectiveAdapterConfig[key] === undefined && existingAdapterConfig[key] !== undefined) {+ rawEffectiveAdapterConfig = { ...rawEffectiveAdapterConfig, [key]: existingAdapterConfig[key] };+ }+ }rawEffectiveAdapterConfig = preserveInstructionsBundleConfig(existingAdapterConfig,rawEffectiveAdapterConfig,