Skip to content

feat(models): Cloudflare Workers AI preset, model discovery, and expandable failover cascade - #769

Merged
wangzan101 merged 2 commits into
wangzan101:mainfrom
shlokkokk:feature/cloudflare-workers-ai-preset
Nov 21, 2026
Merged

wangzan101 merged 2 commits into
wangzan101:mainfrom
shlokkokk:feature/cloudflare-workers-ai-preset

Conversation

@shlokkokk

Copy link
Copy Markdown
Contributor

Overview

This PR adds a dedicated Cloudflare Workers AI preset and significantly upgrades Mika's failover architecture to support seamless multi-account and multi-provider backup cascades:

  1. Cloudflare Workers AI Preset & Discovery:

    • Integrated Cloudflare Workers AI with dedicated Account ID input and automatic URL formatting (https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/v1).
    • Dynamic model discovery via Cloudflare's /models/search?task=Text%20Generation endpoint with automatic capability parsing (tool calling, vision, context length, reasoning).
    • Filters out deprecated models (planned_deprecation_date) and prioritizes free tool-calling models (e.g. llama-3.3-70b, gpt-oss, gemma-4-26b).
    • Handles Cloudflare Workers Free plan limitations gracefully (HTTP 403 code 5035 / "not available on Workers Free plan") as ModelNotAvailable so probe failover continues without stopping.
  2. Automatic Multi-Account Badging:

    • When configuring multiple Cloudflare accounts (e.g. to pool free daily Neurons), the UI automatically detects the distinct Account IDs and badges provider cards with short ID snippets (e.g. Cloudflare Workers AI (b289…5bbd) vs Cloudflare Workers AI (a5c8…3f13)).
  3. Expandable Waterfall Failover Cascade:

    • Expanded maximum fallback slots from 2 up to 8 (MAX_FALLBACKS = 8), allowing users to cascade multiple free accounts and backup providers.
    • Nested Tray UI: Redesigned the failover view into an expandable nested card container:
      • Collapsed: Sleek 1-row summary card showing the active count pill and the full compact chain with arrows (Primary ➔ Backup #1 ➔ Backup #2).
      • Expanded: Indented nested tray drawer clearly visually grouped, showing numbered cascade steps (1, 2, 3) with monospace model IDs and provider subtitles.
      • Accidental Deletion Protection: Added a confirmation MikaDialog before removing any backup slot from the failover chain to prevent unintended deletions.
  4. Localization & Documentation:

    • Added complete string resources for the cascade and deletion confirmation across all 12 supported UI languages.
    • Updated README.md, docs/readme/README.zh-CN.md, and docs/dev/architecture.md.

Verification & Testing

  • Unit Tests:
    • ModelCatalogTest.cloudflareWorkersAiSearchesModelsAndParsesCapabilities passed.
    • ModelAccessErrorsTest passed with Cloudflare free plan error tests.
    • ProviderStoreTest, ModelSetupViewModelTest, ProviderPresetsTest passed.
  • i18n: Verified with python tools/i18n/translations.py check (passed 100% across all 12 locales / 3,682 resources).
  • On-Device Run (SM-S721B): Verified on device with real 23-step autonomous execution using Cloudflare Workers AI (@cf/google/gemma-4-26b-a4b-it) to 100% success.
  • UI Polish: Verified expandable cascade drawer, removal confirmation modal, and responsive non-wrapping layout on mobile screen.

Copilot AI balanced review requested due to automatic review settings November 20, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@shlokkokk
shlokkokk force-pushed the feature/cloudflare-workers-ai-preset branch 2 times, most recently from 9ad112e to d7fdb56 Compare November 20, 2026 18:15
…ndable failover cascade

- Add Cloudflare Workers AI provider preset with Account ID auto-injection into base URL.
- Support automatic model discovery and capability detection via /models/search.
- Filter deprecated models and handle Workers Free plan restrictions gracefully.
- Distinguish multiple Cloudflare accounts in the UI with automatic account snippet badging.
- Expand maximum failover models from 2 to 8 for multi-account resilience.
- Redesign failover UI with an expandable nested cascade tray and accidental removal confirmation dialog.
- Localize all fallback strings across 12 UI languages and update provider documentation.
@shlokkokk
shlokkokk force-pushed the feature/cloudflare-workers-ai-preset branch from d7fdb56 to dd82224 Compare November 20, 2026 18:43
@wangzan101
wangzan101 merged commit 9e23d01 into wangzan101:main Nov 21, 2026
4 checks passed
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.

3 participants