Reapply: route desktop beta channel to dev backend#7232
Conversation
Greptile SummaryThis PR re-enables beta-to-dev backend routing for the desktop app's production bundle (
Confidence Score: 4/5Safe to merge — the routing logic is gated correctly on the production bundle identifier and beta channel, with the force-override only reachable via an explicitly set env var. The change is narrow and well-tested. The only findings are a missing "yes" test case for isAffirmative and a stale log message in applyReleaseChannelDefaults that says "beta channel" even when the force-override path triggers it — neither affects runtime correctness. Both files are straightforward; the only items worth a second look are the applyReleaseChannelDefaults log string and the missing "yes" test case in APIClientRoutingTests. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[shouldUseDevelopmentBackends called] --> B{OMI_FORCE_DEV_BACKENDS\nisAffirmative?}
B -- yes --> C[return true\nUse dev backends]
B -- no --> D{bundleIdentifier ==\ncom.omi.computer-macos?}
D -- no --> E[return false\nUse prod backends]
D -- yes --> F{normalizedChannel ==\n'beta'?}
F -- no --> G[return false\nUse prod backends]
F -- yes --> H[return true\nUse dev backends]
|
| XCTAssertTrue(DesktopBackendEnvironment.shouldUseDevelopmentBackends( | ||
| bundleIdentifier: "com.omi.omi-beta-dev-test", | ||
| updateChannel: "stable", | ||
| forceOverride: "true" | ||
| )) | ||
| XCTAssertFalse(DesktopBackendEnvironment.shouldUseDevelopmentBackends( | ||
| bundleIdentifier: "com.omi.computer-macos", | ||
| updateChannel: "stable", | ||
| forceOverride: "0" | ||
| )) |
There was a problem hiding this comment.
isAffirmative explicitly accepts "yes" as a truthy value but no test exercises it. If the acceptance of "yes" is ever accidentally removed from the helper (e.g., someone trims the list to just "1" and "true"), this test suite would not catch the regression.
| XCTAssertTrue(DesktopBackendEnvironment.shouldUseDevelopmentBackends( | |
| bundleIdentifier: "com.omi.omi-beta-dev-test", | |
| updateChannel: "stable", | |
| forceOverride: "true" | |
| )) | |
| XCTAssertFalse(DesktopBackendEnvironment.shouldUseDevelopmentBackends( | |
| bundleIdentifier: "com.omi.computer-macos", | |
| updateChannel: "stable", | |
| forceOverride: "0" | |
| )) | |
| XCTAssertTrue(DesktopBackendEnvironment.shouldUseDevelopmentBackends( | |
| bundleIdentifier: "com.omi.omi-beta-dev-test", | |
| updateChannel: "stable", | |
| forceOverride: "true" | |
| )) | |
| XCTAssertTrue(DesktopBackendEnvironment.shouldUseDevelopmentBackends( | |
| bundleIdentifier: "com.omi.omi-beta-dev-test", | |
| updateChannel: "stable", | |
| forceOverride: "yes" | |
| )) | |
| XCTAssertFalse(DesktopBackendEnvironment.shouldUseDevelopmentBackends( | |
| bundleIdentifier: "com.omi.computer-macos", | |
| updateChannel: "stable", | |
| forceOverride: "0" | |
| )) |
…7249) ## What was broken The AgentPill router (the Claude Haiku classifier that decides whether a floating-bar query stays in chat or spawns a background agent pill) has been **broken since the agent-pills feature shipped**. Every router call returns HTTP 400 (empty body) and the Swift client falls back to the chat route — so agent pills never spawn from natural-language prompts. Only the explicit `Execute` button on notification/task cards (which bypasses the router) ever triggers them. Confirmed live with curl against both dev and prod desktop-backend Cloud Run services — same 400 on both. Root cause: `MODEL_ROUTES` in `desktop/Backend-Rust/src/models/chat_completions.rs` only allowlists Sonnet/Opus variants. The router sends `claude-haiku-4-5-20251001` (defined in `ModelQoS.swift` and used in `AgentPill.swift` lines 152 + 547). `resolve_model` returns None → 400. ## Fix - Add two MODEL_ROUTES entries: `claude-haiku-4-5-20251001` (dated) and `claude-haiku-4-5` (bare), both upstream → `claude-haiku-4-5` - Add Anthropic-published Haiku 4.5 pricing to `model_cost` ($1/MTok in, $5/MTok out) so cost tracking is right - Unit test for the new routes ## Deploys to - **Dev Cloud Run** via `desktop_backend_auto_dev.yml` (auto-fires on `desktop/Backend-Rust/**` changes) — ~5 min - **Prod Cloud Run** via Codemagic `omi-desktop-swift-release` workflow alongside the next Swift release — ~25 min User has a launch in <7h; want this on dev first so beta channel (routed to dev backend via #7232) gets agent pills working in the demo. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Reapplies #7224 after the #7230 revert. Verified locally this time:
com.omi.omi-beta-dev-test) launched with shell-bundled dev URLs (OMI_PYTHON_API_URL=https://api.omiapi.com/,OMI_DESKTOP_API_URL=https://desktop-backend-dt5lrfkkoa-uc.a.run.app/).kodjima33@gmail.com— landed on prod UIDviUv7GtdoHXbK1UBCDlPuTDuPgJ2(not a ghost dev UID).POST https://api.omiapi.com/v2/desktop/messages,/v3/memories,/v1/action-items— all succeeding, AgentSync pushing rows.SERVICE_ACCOUNT_JSON,FIREBASE_API_KEY,FIREBASE_PROJECT_IDare all on prod Firebase (based-hardware), so dev-issued custom tokens resolve to the same prod UID.This time the change ships through the existing #7227 diagnostic patch (already on main), so if Codemagic's universal-bundle step trips again we'll get a real error instead of a 0.6s opaque failure.
🤖 Generated with Claude Code