Backend half of #2693 P3.
- `ModelCatalogService` normalizes `services.llm.fallbacks` on every save: only
well-formed `{profile_id, model_id}` entries survive, duplicates collapse, and
the list is capped at 4 so a failure cannot multiply the retry budget.
- `POST /api/settings/apply/service` no longer drops the chain. The settings UI
edits providers and does not carry a `fallbacks` key, and that endpoint
replaces the whole service object — so an absent key now means "keep what is
stored" instead of "clear it". An explicit key still replaces the chain.
- Covered by tests for normalization, save round-trip and the preserve rule.
Still to come: the read-only chain display on the LLM settings page, the
`provider_switched` copy, and the integrated chat/services failover tests.
Chat-path wiring for #2693 P1. `AgenticChatPipeline` now builds its client
through `build_chain_client`, which returns today's single client unless the
catalog declares fallbacks *and* at least two candidates are healthy — so the
default configuration is untouched.
When a chain exists, the loop spends its existing pre-output retry on the next
candidate: it records the failure (cooling that candidate down), advances,
announces the switch, and retries the same round. This happens only where the
loop already knows nothing was emitted, so no partial answer is ever replayed.
After the switch the provider label and fallback count come from the new
candidate, so the P0 failure copy keeps telling the truth.
Not in this commit: the services-layer path (P2), catalog validation and the
settings editor (P3). Those, plus the integrated failover tests, are next.
Core of #2693 P1/P2, deliberately not wired into the call paths yet: this
commit adds the pieces, their contract and their tests, so the two integrations
(catalog-driven client construction and the agent loop's pre-output retry) can
be reviewed on their own.
- `resolve_candidates()` builds the ordered chain: active model first, then the
catalog's declared fallbacks, de-duplicated, unresolvable entries dropped.
- `ProviderHealthRegistry` cools a candidate down instead of removing it
(rate limits honour their hint, transport failures 30s, auth disables until the
profile is edited, consecutive failures escalate 60s → 5m → 15m). Expiry is the
failback: the next request tries the primary again. State is per owner, so one
account's exhausted key cannot cool a shared profile for everyone.
- `call_with_failover()` walks the healthy candidates, records each failure and
reports every switch; non-provider exceptions are re-raised untouched, and an
exhausted chain raises `AllProvidersUnavailable` with the attempt list.
- `drop_foreign_message_state()` strips `thinking_blocks`,
`_provider_response_state` and `_responses_output_items` so a candidate never
receives another provider's private replay state.
The 10-minute silence in #2693 does not come from the agent loop: a 401/429/5xx
is retried inside the provider on the configured schedule (5s → 120s per attempt,
8 attempts), and those sleeps emit no stream events at all. The turn looks
frozen until the final error.
- `LLMProvider` gains an optional async `retry_observer`, called before each
retry sleep with the attempt number, total and delay. A failing observer is
logged and ignored: visibility must never turn a retry into a failure.
- The agent loop attaches an observer before every model call and emits the same
`provider_retry` notice the transport-retry path already used, now with the
provider label, attempt count and `retry_delay_s` /
`fallbacks_configured` in the trace metadata.
- Covered by unit tests for the observer contract (called once per retry, and
inert when it raises).
Part of #2693, visibility only: the turn still runs the one active model, but a
failed turn no longer reads as "the provider connection was interrupted" with
no name, no attempt count, and no hint that an alternative is already
configured.
- `provider_visibility.py` builds the retry and final-failure copy from a
pipeline's binding, model and endpoint host, plus the number of configured
fallbacks (`services/model_selection/fallbacks.py`: read-only, bounded,
tolerant of a hand-edited catalog).
- Non-transport provider errors (401/403/429/5xx, model-not-found) are mapped
through the existing error taxonomy before they are raised, so the user reads
"provider X returned a server-side error" instead of the SDK's raw
"Error code: 502" — while the typed error, status code and retry flags that
the loop and the forced-finish path branch on are preserved.
- The failure trace metadata gains `provider`, `attempts` and
`fallbacks_configured`.
- zh and en chat prompt copy updated; other capabilities keep the code defaults
until their prompt packs are updated.
No failover yet: switching, cooldowns and failback land in P1.
Prepare v1.7.3 notes for reading and book editing, expanded provider and
agent connections, learning records, model streams, and desktop upgrades.
Sync README prose and 11 translations, archive older release notes, and
update the package version. Resolve release lint/type blockers with explicit
parser and capability contracts, compatible Book call forwarding, accurate
auth task types, and quoted SQLite schema identifiers. Cover positional Book
calls and quoted legacy columns; align KB seed tests with visible retrieval
failure reporting. Keep HTTP fixtures independent of host proxies and translate
new Portuguese UI copy.
Release notes: assets/releases/ver1-7-3.md
Local dev repairs for #2681.
The existing narrow-grid fix is preserved; Next up no longer overlays content on phones. Web typecheck, 1407 Node tests, eslint and i18n passed.
Local dev repairs for #2478.
UI interaction test verifies two selections, preserved search and no premature write. Web typecheck, 1407 Node tests, eslint and i18n passed.
Local dev repairs for #2586.
OAuth owner isolation and refresh-token stability verified. Hook polls until connected, refreshes on focus and stops on unmount. Python rechecks: 56 passed; UI batch: 25 passed. Web typecheck, 1407 Node tests, eslint and i18n passed.
Local dev repairs for #2132, #2133.
Turkish UI prefers Windows-1254 after UTF-8; strict explicit encoding is available for mixed legacy collections. Tested both upload bytes and file reads, short Turkish strings, GBK, GB18030 and Windows-1252. Encoding and memory suite: 398 passed.
Local dev repairs for #2168, #2631.
Real child-process recovery: 16 tests passed, including queued, running, waiting_input, process exit and PID reuse. Existing coordination/application tests: 65 passed, 10 optional Redis skips.