Skip to content

Commit e793eb8

Browse files
whyovoclaude
andcommitted
fix: use claw_config_set to clear vision config and fix syslog race
- Replace config_del with claw_config_set(key, "") per review feedback, using the public API instead of the non-public config_del function - Move syslog before pthread_mutex_unlock to avoid reading s_vision_model/s_vision_host after lock release Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 433bd0b commit e793eb8

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/llm/llm_proxy.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ int llm_set_vision_model(const char* host, const char* model,
270270
strncpy(s_vision_host, host, sizeof(s_vision_host) - 1);
271271
s_vision_host[sizeof(s_vision_host) - 1] = '\0';
272272
} else {
273-
config_del(AGENT_CFG_KEY_VISION_HOST);
273+
claw_config_set(AGENT_CFG_KEY_VISION_HOST, "");
274274
s_vision_host[0] = '\0';
275275
}
276276

@@ -279,7 +279,7 @@ int llm_set_vision_model(const char* host, const char* model,
279279
strncpy(s_vision_model, model, sizeof(s_vision_model) - 1);
280280
s_vision_model[sizeof(s_vision_model) - 1] = '\0';
281281
} else {
282-
config_del(AGENT_CFG_KEY_VISION_MODEL);
282+
claw_config_set(AGENT_CFG_KEY_VISION_MODEL, "");
283283
s_vision_model[0] = '\0';
284284
}
285285

@@ -288,15 +288,15 @@ int llm_set_vision_model(const char* host, const char* model,
288288
strncpy(s_vision_api_key, api_key, sizeof(s_vision_api_key) - 1);
289289
s_vision_api_key[sizeof(s_vision_api_key) - 1] = '\0';
290290
} else {
291-
config_del(AGENT_CFG_KEY_VISION_API_KEY);
291+
claw_config_set(AGENT_CFG_KEY_VISION_API_KEY, "");
292292
s_vision_api_key[0] = '\0';
293293
}
294294

295-
pthread_mutex_unlock(&s_llm_lock);
296-
297295
syslog(LOG_INFO, "[%s] Vision LLM config updated: model=%s host=%s\n",
298296
TAG, s_vision_model[0] ? s_vision_model : "(inherit)",
299297
s_vision_host[0] ? s_vision_host : "(inherit)");
298+
299+
pthread_mutex_unlock(&s_llm_lock);
300300
return OK;
301301
}
302302

0 commit comments

Comments
 (0)