Skip to content

Fix #1899 fallback circuit breaker gap#1938

Open
TianchunGu wants to merge 1 commit into
MemTensor:bugfix/autodev-1897from
TianchunGu:codex/fix-1897-fallback-circuit-breaker
Open

Fix #1899 fallback circuit breaker gap#1938
TianchunGu wants to merge 1 commit into
MemTensor:bugfix/autodev-1897from
TianchunGu:codex/fix-1897-fallback-circuit-breaker

Conversation

@TianchunGu

@TianchunGu TianchunGu commented Jun 17, 2026

Copy link
Copy Markdown

Summary

This is a small follow-up to #1899 that addresses the maintainer review comment about the default fallbackToHost path.

In #1899, a terminal primary-provider error rescued by host fallback keeps the breaker closed. Because fallbackToHost is enabled by default, later pipeline calls can still hit the broken paid provider once before falling back, so the request storm can continue.

This patch changes that behavior:

  • Terminal primary errors trip the circuit breaker even when host fallback succeeds.
  • While the breaker is open, calls with host fallback available go directly to host fallback and do not touch the primary provider.
  • Replaces the previous test that asserted fallback success does not trip the breaker with the requested regression test: first call hits primary once and falls back; second call is served by host fallback without invoking primary again.

Validation

From apps/memos-local-plugin:

npx vitest run tests/unit/llm/client.test.ts
# Test Files 1 passed (1)
# Tests 23 passed (23)

npm run lint
# tsc -p tsconfig.json --noEmit
# passed

I also tried npm run test:unit -- tests/unit/llm/client.test.ts, but that package script always prepends the full tests/unit suite. The LLM client test passed there too, while unrelated server tests failed in my sandbox with listen EPERM: operation not permitted 127.0.0.1, and the known storage tests still show existing base-branch failures.

Related: #1897, #1899

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