From 08ace1c8b3e159ac085ecafd19d83bf642194b85 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Feb 2026 19:49:23 +0000 Subject: [PATCH] fix: deploy cleans stale kimi/moonshot config from server The server's config.json and .env persist old moonshot/kimi values across deploys. Even though env.Parse() overrides these at runtime, stale config causes confusion. This commit: - Removes old PICOCLAW_PROVIDERS_ZHIPU/MOONSHOT env vars from .env - Force-updates config.json model/provider if they still reference kimi or moonshot https://claude.ai/code/session_01MYemTMPtHrcgidWs8UdjcG --- .github/workflows/deploy-hostinger.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/deploy-hostinger.yml b/.github/workflows/deploy-hostinger.yml index 2f15a9b76..1bcb1466b 100644 --- a/.github/workflows/deploy-hostinger.yml +++ b/.github/workflows/deploy-hostinger.yml @@ -118,6 +118,13 @@ jobs: echo "WARNING: PICOCLAW_ZAI_API_KEY secret is empty" fi + # Remove stale moonshot/zhipu env vars that conflict with Z.ai migration + for old_key in PICOCLAW_PROVIDERS_ZHIPU_API_KEY PICOCLAW_PROVIDERS_ZHIPU_API_BASE \ + PICOCLAW_PROVIDERS_MOONSHOT_API_KEY PICOCLAW_PROVIDERS_MOONSHOT_API_BASE \ + PICOCLAW_ZHIPU_API_KEY PICOCLAW_MOONSHOT_API_KEY; do + sed -i "/^\${old_key}=/d" "\$ENV_FILE" 2>/dev/null || true + done + # Create config.json if it doesn't exist (copy from example) if [ ! -f "\$CONFIG_FILE" ]; then if [ -f "/opt/picoclaw/src/config/config.example.json" ]; then @@ -126,6 +133,25 @@ jobs: fi fi + # Force-update model and provider in existing config.json to prevent + # stale kimi/moonshot values from persisting across deploys. + # env.Parse() overrides these at runtime, but keeping config.json + # consistent avoids confusion when debugging. + if [ -f "\$CONFIG_FILE" ]; then + # Update model if it still references kimi/moonshot + if grep -q '"model".*kimi\|"model".*moonshot' "\$CONFIG_FILE" 2>/dev/null; then + sed -i 's/"model"[[:space:]]*:[[:space:]]*"[^"]*kimi[^"]*"/"model": "glm-4.7"/' "\$CONFIG_FILE" + sed -i 's/"model"[[:space:]]*:[[:space:]]*"[^"]*moonshot[^"]*"/"model": "glm-4.7"/' "\$CONFIG_FILE" + echo "Updated config.json: replaced kimi/moonshot model with glm-4.7" + fi + # Update provider if it still references zhipu/moonshot + if grep -q '"provider".*zhipu\|"provider".*moonshot' "\$CONFIG_FILE" 2>/dev/null; then + sed -i 's/"provider"[[:space:]]*:[[:space:]]*"zhipu"/"provider": "zai"/' "\$CONFIG_FILE" + sed -i 's/"provider"[[:space:]]*:[[:space:]]*"moonshot"/"provider": "zai"/' "\$CONFIG_FILE" + echo "Updated config.json: replaced zhipu/moonshot provider with zai" + fi + fi + # Verify critical config echo "" echo "=== Deploy Config Verification ==="