Skip to content

fix(runtime): prevent restart loop after model config switch [Sprint 2.5 D10] #39

@Piboonsak

Description

@Piboonsak

Sprint 2.5 — D10: Fix P0 Restart Loop หลัง Model Switch

Branch: feat/sprint-2.5-d10-restart-loop
Base: main
Depends on: D4 ✅ (schema validation merged — prevents future bad config)

Task

Fix the P0 restart loop that occurs after switching the model in config.

Investigation needed:

  1. Find runtime config reload logic
  2. Find container restart / supervisor logic
  3. Identify why model switch causes restart loop

Fix requirements:

  • Model switch should trigger at most one clean restart
  • If new model is invalid or unavailable → fall back to previous working model, do NOT enter crash loop
  • Add safeguard: if restart count exceeds 3 within 5 minutes → stop restarting and log alert
  • Add clear error logging when model switch fails

Acceptance Criteria

  • No restart loop after model config switch
  • Model switch triggers at most one clean restart
  • Invalid model → graceful fallback to previous model, not crash loop
  • Restart loop detection: if >3 restarts in 5 minutes, stop and alert
  • Clear error message logged when model switch fails

Commit Message

fix(runtime): prevent restart loop after model switch (#196)

Reference

  • Issue: Piboonsak/Openclaw#196

Labels

  • sprint-2.5
  • copilot

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions