Skip to content

Desktop bug-report AI unified via daemon (CloudBridge routing)

Desktop bug-report AI unified via daemon (CloudBridge routing)

Status: Delivered
CAS: CAS-2395
Delivered: 2026-05-12
PRs: #629

What’s new

Desktop bug-report chat now routes through the local daemon (same path iOS uses) instead of spawning Claude CLI directly. This fixes the “You’ve hit your limit” Sonnet quota errors that appeared on desktop — the daemon uses Opus, which the regent’s Claude Max plan handles without a weekly cap. All platforms now share a single AI code path with consistent model, persona, and conversation memory.

How to use it

Nothing changes for the user. Open the bug-report sheet on desktop and start chatting — the routing switch is transparent. If the daemon is unreachable, the app falls back to direct LocalCli (with a warning). Non-bug-report AI flows (expression generation, etc.) continue to use the direct spawn path; only bug-report chat was changed.

What changed under the hood

  • src-tauri/src/services/ai/manager.rs: new preferred_bugreport_stream_provider() returns CloudBridge (daemon at 127.0.0.1:7471) first, LocalCli as fallback.
  • src-tauri/src/commands/ai_commands.rs: bug-report streaming command updated to call the provider-selection function instead of hardcoding LocalCli.
  • Two Rust unit tests added: preferred_bugreport_stream_provider_prefers_cloudbridge and preferred_bugreport_stream_provider_falls_back_to_local_cli.

Why we built it

Desktop was spawning Claude Sonnet directly because Tauri’s process context has no AI_LOCAL_CLI_MODEL env var (that override lives in the launchd plist, which only the daemon inherits). iOS was fine because it already routed through the daemon. The regent hit the Sonnet weekly cap while the iOS app worked without issue — same product, two code paths, different behaviour. Unifying on the daemon path closes that gap and means any future daemon-side improvement (conversation memory, CAS-2372; Astrid persona grounding, CAS-2369) automatically benefits desktop too.

Known limitations / follow-on work

  • If the daemon is not running, the app falls back to direct LocalCli (Sonnet spawn). The quota issue can recur in that fallback scenario.
  • Windows/Linux ports have no daemon yet; this routing would need a daemon-or-API alternative when Casaconomy expands to those platforms.
  • Same-machine loopback encryption is present but not optimised; a zero-overhead loopback bypass could be added later if latency becomes measurable.