Skip to content

fix(providers): retry the local probe after a startup miss - #110

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/high-severity-issues-10b9
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/high-severity-issues-10b9

Conversation

@cursor

@cursor cursor Bot commented Oct 6, 2026

Copy link
Copy Markdown

Bug and impact

If llama-server is not listening when ShellClaw starts, local_init sets s_local_unavailable and that flag stays set for the life of the process on the default chain (anthropic, openai, local). Later chats return Local inference server unreachable without contacting the server, even after the model has finished loading.

That disables the offline path:

  • fallback_chain = ["local"] never recovers until the process is restarted.
  • When cloud providers fail after startup, the local fallback is still skipped.

Router recovery cannot clear the flag in the default order. It only probes backends that sit before the active index, and local is last.

Root cause

local_chat treated the one-time init probe as permanent. provider_local_recovery_probe_succeeded() only runs from that earlier-index recovery scan, so a startup miss on the last chain entry is never retried.

Fix

While the flag is set, local_chat probes /v1/models or /health again. A successful probe clears the flag and the turn is sent. A failed probe still returns the unreachable error and the router can fall through.

Validation

  • Added test_chat_reprobes_when_server_comes_up. It failed before the fix (chat stayed unreachable after init) and passes after.
  • make test_local_provider
  • make test_router
Open in Web聽View Automation聽

Init marks llama-server unreachable once. The default chain puts local
last, so router recovery never clears that flag and offline chat stays
dead until restart. The next chat probes again before refusing.

Co-authored-by: esadrianno <esadrianno@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant