Repository navigation
Closed
Description
Problem
After restoring a free model via WebUI ("恢复启用", POST /api/models/restore), the model shows manually_enabled and works, but the next hourly automatic probe overwrites that state. AvailabilityStore.Record() only guards on Generation, so a new probe round with the current generation unconditionally rewrites Disabled/Reason. Models that succeed on retry therefore get pulled again one hour after a manual restore. There is also no UI switch to choose manual vs automatic control — only a one-way restore button (disabled while the model is enabled).
Two related defects in the same path:
RestoreModeldereferencesm.current.Load()without a nil check, so an admin call during startup / config-reload window can panic.- An inconclusive recheck (timeout / transport error) of a still-disabled model resets
NextCheckto 1h and overwrites the disable reason, shrinking the intended 24h backoff and losing the disable evidence.
Evidence
internal/models/availability.go:Restore()setsReason="manually_enabled",NextCheck=now+1h;Record()(called frominternal/gateway/availability.gocheckFreeModels) rewritesDisabled/Reason/NextCheckon generation match with no manual-state branch.internal/gateway/availability.go:checkFreeModelsprobes every non-manual due model hourly;RestoreModeldoesm.current.Load().availability...with no nil guard.webui/app.jsloadAvailability(): only a "恢复启用" button,disabled = !item.disabled; no toggle back to automatic.- Runtime observation: availability file showed
disabled:true, reason:http_401across models while the same models succeed on manual retry.
Scope
internal/models/availability.go(Availabilityrecord,Restore/Record)internal/gateway/availability.go(checkFreeModels,RestoreModel)internal/admin/*+webui/app.js,webui/index.html(manual/auto control API + toggle)
Expected Outcome
- A manually restored model stays enabled and is not overwritten by later automatic probe results, until the operator explicitly switches it back to automatic.
- WebUI offers a per-model manual/automatic toggle with the control mode visible.
- Admin model endpoints handle "runtime not loaded" without panicking; inconclusive rechecks of disabled models preserve the 24h backoff and original disable reason.
Related
- Related: [BUG]免费模型可用性探测疑似使用了非 OpenCode 格式的会话 ID,导致大量健康模型被误判为不可用并禁用 24 小时 #54 (probe session-ID fix — different root cause, same symptom area)
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix: preserve manual control of free models (jasonxu114514#57)
fix: preserve manual control of free models (#57)
jasonxu114514 commentedon Oct 8, 2026
已通过 #57 合入 main,提交 1e2702f。手动恢复现在会持久化为手动模式,后续探测和在途结果不会覆盖;可在 WebUI 切回自动探测。
审查时补充修复了到期复测不确定后 NextCheck 仍过期、造成每分钟重复探测的问题,并确保重复切换到同一模式不会清除禁用证据。已禁用模型遇到临时错误继续按 24 小时复测,已启用模型按 1 小时复测。
本地回归验证通过,PR 和合并后主分支的五项 Checks 均通过。最终提交不含测试文件。此修复已进入 main,当前发布版本仍为 v1.3.7。