Skip to content

Reapply: route desktop beta channel to dev backend#7232

Merged
kodjima33 merged 1 commit into
mainfrom
worktree-redo-beta-dev-routing
May 11, 2026
Merged

Reapply: route desktop beta channel to dev backend#7232
kodjima33 merged 1 commit into
mainfrom
worktree-redo-beta-dev-routing

Conversation

@kodjima33
Copy link
Copy Markdown
Collaborator

Reapplies #7224 after the #7230 revert. Verified locally this time:

  • Named bundle (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/).
  • Signed in with kodjima33@gmail.com — landed on prod UID viUv7GtdoHXbK1UBCDlPuTDuPgJ2 (not a ghost dev UID).
  • Existing chat history and tasks loaded.
  • New requests go through dev backend: POST https://api.omiapi.com/v2/desktop/messages, /v3/memories, /v1/action-items — all succeeding, AgentSync pushing rows.
  • Confirms dev backend's SERVICE_ACCOUNT_JSON, FIREBASE_API_KEY, FIREBASE_PROJECT_ID are 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

@kodjima33 kodjima33 merged commit 3e6a2da into main May 11, 2026
3 checks passed
@kodjima33 kodjima33 deleted the worktree-redo-beta-dev-routing branch May 11, 2026 00:29
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 11, 2026

Greptile Summary

This PR re-enables beta-to-dev backend routing for the desktop app's production bundle (com.omi.computer-macos), replacing the hard-coded return false guard that was put in place after the previous revert. It also introduces an OMI_FORCE_DEV_BACKENDS escape hatch so non-production bundles can opt in explicitly.

  • DesktopBackendEnvironment.swift: shouldUseDevelopmentBackends now returns true when the production bundle is on the beta/staging channel, or unconditionally when OMI_FORCE_DEV_BACKENDS is set to "1", "true", or "yes". The new isAffirmative helper handles the env-var check.
  • APIClientRoutingTests.swift: Test function previously asserting false for all cases is replaced by four targeted functions covering the beta+prod-bundle true path, stable false path, non-prod bundle false path, and force-override path.

Confidence Score: 4/5

Safe 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

Filename Overview
desktop/Desktop/Sources/DesktopBackendEnvironment.swift Re-enables beta-to-dev routing for the production bundle by replacing the hard-coded return false with a bundle+channel check; adds OMI_FORCE_DEV_BACKENDS escape hatch via a new isAffirmative helper. Logic is sound and well-commented.
desktop/Desktop/Tests/APIClientRoutingTests.swift Tests are updated to reflect the new routing semantics. New test functions cover the beta+prod-bundle true path, stable false path, non-prod bundle false path, and force-override path. One accepted affirmative value ("yes") is not exercised by any test case.

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]
Loading

Comments Outside Diff (1)

  1. desktop/Desktop/Sources/DesktopBackendEnvironment.swift, line 98 (link)

    P2 The applyReleaseChannelDefaults log message still says "beta channel" but shouldUseDevelopmentBackends can now return true via the OMI_FORCE_DEV_BACKENDS path on any bundle/channel combination. A developer debugging a force-override scenario will see a misleading message that suggests they're on the beta channel when they may not be.

Reviews (1): Last reviewed commit: "Reapply "feat(desktop): route beta chann..." | Re-trigger Greptile

Comment on lines +195 to +204
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"
))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 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.

Suggested change
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"
))

kodjima33 added a commit that referenced this pull request May 12, 2026
…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)
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.

1 participant