fix: prevent Linux gateway mis-kill and calibration data resurrection

Linux cleanup_zombie_gateway_processes previously used fuser + kill -9 on
every PID bound to the gateway port, with no cmdline or /health checks.
This could terminate unrelated services or healthy Gateways during restart
timeouts. Align Linux with the Windows strategy: verify openclaw gateway
cmdline, retry /health, only kill unresponsive zombies, and adopt healthy
external instances.

Calibration inherit mode preferred the richer openclaw.json.bak over the
current file. Because every write copies the previous config to .bak,
intentional removals (providers/channels) could be resurrected on the next
calibration. Prefer current whenever it is non-empty; only fall back to
backup when current is effectively empty.

Add regression tests for calibration source selection and mirror the fix
in dev-api.js.

Co-authored-by: 晴天 <1186258278@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-06-14 11:09:42 +00:00
parent c86382adfa
commit 67ebd2410e
3 changed files with 226 additions and 21 deletions

View File

@@ -2443,9 +2443,11 @@ function calibrationRichnessScore(config) {
function selectCalibrationSource(current, backup) {
if (current && backup) {
return calibrationRichnessScore(backup) > calibrationRichnessScore(current)
? ['backup', backup]
: ['current', current]
const currentScore = calibrationRichnessScore(current)
if (currentScore === 0 && calibrationRichnessScore(backup) > 0) {
return ['backup', backup]
}
return ['current', current]
}
if (current) return ['current', current]
if (backup) return ['backup', backup]