2 Commits

  • fix(usage): improve usage-query resilience and error surfacing
    - useUsageQuery: retry once + keep-last-good — show the last successful
      result for up to 10min when a query fails transiently (network/timeout/
      HTTP 5xx), so a single blip no longer flips the card to red. Deterministic
      failures (auth, empty key, unknown provider, 4xx) surface immediately and
      clear the snapshot so a stale quota can't resurface after credentials change.
    - bump native balance/coding-plan/subscription request timeouts 10s -> 15s
      for slow cross-border endpoints.
    - coding_plan: return explicit errors ("API key is empty" / "Unknown coding
      plan provider") instead of a blank failure, mirroring balance.
    - add unit tests for keep-last-good and transient/deterministic classification.
  • feat(provider-form): custom User-Agent presets dropdown in advanced settings
    Polish the provider-level User-Agent override UI on the Claude and Codex forms.
    
    - Add a shared CustomUserAgentField (label + input + preset dropdown + live
      validation) so both forms stay in sync.
    - Provide curated UA presets (Claude Code / Kilo Code families that pass
      coding-plan UA whitelists per #3671); the first is Claude Code's real
      `claude-cli/x (external, cli)` format. Whitelists gate on the name prefix,
      not the version, so static values stay valid across upgrades.
    - Expose presets via a dropdown to the right of the input (z-[200] so it
      renders above the dialog layers) instead of inline chips.
    - Move the field into the existing advanced/reasoning collapsibles.
    - userAgent.ts mirrors the backend byte rule (reject only control chars;
      non-ASCII is allowed) for a non-blocking inline hint.
    - i18n for all four locales (zh/en/ja/zh-TW).