Skip to content

fix: desktop env hardcodes + onboarding tasks dead-end - #5783

Closed
beastoin wants to merge 8 commits into
mainfrom
fix/desktop-env-hardcodes
Closed

beastoin wants to merge 8 commits into
mainfrom
fix/desktop-env-hardcodes

Conversation

@beastoin

Copy link
Copy Markdown
Collaborator

Summary

  • Auth URL configurable: AuthService.swift auth backend URL was hardcoded to Cloud Run (omi-desktop-auth-*.run.app). Now reads from OMI_AUTH_URL env var with fallback to existing URL. This unblocks local development setups.
  • Onboarding tasks escape hatch: The Tasks onboarding step (step 4) was the only step without a Skip button, trapping users when the "Take me to my tasks" button was unresponsive. Added Skip button consistent with all other onboarding steps.
  • Skip wired up properly: The new Skip on the tasks step calls handleOnboardingComplete() so all services (transcription, AgentVM, goals, etc.) are properly initialized.
  • Documentation: Added OMI_AUTH_URL to .env.example.

Context

Found during local Rust backend setup on Mac Mini — the hardcoded auth URL meant OAuth always went through Cloud Run even when running a local backend. The onboarding dead-end was discovered by ren during app flow exploration.

Test plan

  • Build desktop app with OMI_AUTH_URL set — verify auth redirects to custom URL
  • Build without OMI_AUTH_URL — verify fallback to Cloud Run auth service
  • Walk through onboarding to Tasks step — verify Skip button appears
  • Click Skip on Tasks step — verify onboarding completes and services start normally
  • Click "Take me to my tasks" — verify existing flow still works

🤖 Generated with Claude Code

beastoin and others added 4 commits March 18, 2026 07:03
The auth backend URL was hardcoded to the Cloud Run service, preventing
local development setups from using a custom auth endpoint. Now reads
from OMI_AUTH_URL env var with fallback to the existing Cloud Run URL.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
The Tasks onboarding step was the only step without a Skip option,
trapping users if the 'Take me to my tasks' button was unresponsive.
Adds an optional onSkip callback consistent with all other steps.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Connects the new onSkip parameter in OnboardingTasksStepView so
skipping the tasks step still calls handleOnboardingComplete() and
properly initializes all services.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Documents the new configurable auth backend URL for local development.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@greptile-apps

greptile-apps Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes two targeted quality-of-life fixes for the desktop app: it moves the auth backend URL from a hardcoded Cloud Run constant to a runtime-configurable environment variable (OMI_AUTH_URL), and it adds a Skip button to the final onboarding Tasks step that was previously a dead-end if the primary button was unresponsive.

Key changes:

  • AuthService.swift: apiBaseURL is now resolved from getenv("OMI_AUTH_URL") at property-initialization time, with automatic trailing-slash normalization and a fallback to the original Cloud Run URL. No URL format validation is performed before the value is put into use.
  • OnboardingTasksStepView.swift: An optional onSkip: (() -> Void)? parameter is added; the Skip button renders only when the caller provides the closure, keeping the component backward-compatible.
  • OnboardingView.swift: The Tasks step's onSkip handler correctly calls handleOnboardingComplete(), mirroring the onComplete path and ensuring all services (transcription, AgentVM, goals, etc.) start regardless of which button is tapped. The analytics event name "Tasks_Skipped" is consistent with the naming convention used for every other skippable step.
  • .env.example: OMI_AUTH_URL is documented with a comment and the Cloud Run default shown as a commented-out example.

Confidence Score: 4/5

  • Safe to merge; changes are small, targeted, and non-breaking with a single minor hardening opportunity in AuthService.
  • Both changes are straightforward. The onboarding Skip wiring is identical in structure to the three already-working Skip buttons in the same file. The auth URL change uses a safe fallback pattern and handles the trailing-slash edge case. The only gap is the absence of URL-scheme validation on OMI_AUTH_URL, which could produce confusing failures during local dev setup but has no impact on production builds where the env var is not set.
  • desktop/Desktop/Sources/AuthService.swift — consider adding a URL scheme prefix check on OMI_AUTH_URL before it is used.

Important Files Changed

Filename Overview
desktop/Desktop/Sources/AuthService.swift Auth backend URL is now read from OMI_AUTH_URL env var with correct trailing-slash normalization and fallback to the original Cloud Run URL. No URL format validation is performed before the value is used, which could lead to confusing runtime failures.
desktop/Desktop/Sources/OnboardingTasksStepView.swift Optional onSkip callback added; a Skip button is rendered conditionally and matches the visual style (plain, tertiary color) used by all other onboarding steps. Backward-compatible change.
desktop/Desktop/Sources/OnboardingView.swift onSkip handler for step 4 properly calls handleOnboardingComplete(), ensuring all services start regardless of how the Tasks step is exited. Analytics event name "Tasks_Skipped" is consistent with all other skipped-step patterns.
desktop/.env.example OMI_AUTH_URL documented with an explanatory comment and the Cloud Run default shown as a commented-out example. Correct placement alongside the existing OMI_API_URL block.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[App launches] --> B{Read env var}
    B -- "value found" --> C[Normalize trailing slash]
    C --> D[Use custom auth URL]
    B -- "not set / empty" --> E[Use default Cloud Run URL]
    D --> F[AuthService.apiBaseURL ready]
    E --> F
    F --> G[signIn called]
    G --> H[POST to auth backend]
    H --> I[Receive OAuth code]
    I --> J[Exchange for Firebase credential]
Loading

Last reviewed commit: "docs: add OMI_AUTH_U..."

Comment on lines +47 to +53
private let apiBaseURL: String = {
if let envURL = getenv("OMI_AUTH_URL") {
let url = String(cString: envURL)
if !url.isEmpty { return url.hasSuffix("/") ? url : url + "/" }
}
return "https://omi-desktop-auth-208440318997.us-central1.run.app/"
}()

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 No URL format validation before use

OMI_AUTH_URL is accepted and used without validating that it is a well-formed URL. If a developer accidentally sets the variable to something like localhost:8080 (missing scheme) or omi-auth (a bare hostname), every auth request will fail with a cryptic networking error rather than an early, actionable message.

Consider adding a basic sanity check at initialization time:

Suggested change
private let apiBaseURL: String = {
if let envURL = getenv("OMI_AUTH_URL") {
let url = String(cString: envURL)
if !url.isEmpty { return url.hasSuffix("/") ? url : url + "/" }
}
return "https://omi-desktop-auth-208440318997.us-central1.run.app/"
}()
private let apiBaseURL: String = {
if let envURL = getenv("OMI_AUTH_URL") {
let raw = String(cString: envURL)
if !raw.isEmpty {
guard raw.hasPrefix("http://") || raw.hasPrefix("https://") else {
fatalError("OMI_AUTH_URL must start with http:// or https://, got: \(raw)")
}
return raw.hasSuffix("/") ? raw : raw + "/"
}
}
return "https://omi-desktop-auth-208440318997.us-central1.run.app/"
}()

Using fatalError here (or at minimum a loud log/assertion) gives developers an immediate, obvious signal during local setup rather than a silent failure deep in an OAuth flow.

beastoin and others added 4 commits March 18, 2026 07:09
Reorder handleOnboardingComplete() so hasCompletedOnboarding is set
BEFORE starting background services. When AgentVMService, ProactiveAssistants,
or GoalGeneration fail (e.g. missing API keys, unauthorized), the UI was
stuck on the Tasks screen because service errors prevented reaching the
state update. Now the UI transitions first and services start after.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Cloud Run OAuth issues tokens for "based-hardware" (prod), but local dev
uses "based-hardware-dev" for Firestore. This adds a separate env var
FIREBASE_AUTH_PROJECT_ID so auth token validation can target prod while
Firestore stays on dev. Falls back to FIREBASE_PROJECT_ID if not set.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Reads auth project from firebase_auth_project_id config, falling back to
firebase_project_id, then "based-hardware". This allows auth to validate
prod tokens while Firestore accesses the dev database.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@beastoin

Copy link
Copy Markdown
Collaborator Author

Closing — all changes are included in the trunk PR #5790 (collab/desktop-friction-exploration).


by AI for @beastoin

@beastoin beastoin closed this Mar 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey @beastoin 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our roadmap and vision

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community! 💜

@undivisible
undivisible deleted the fix/desktop-env-hardcodes branch August 20, 2026 11:34
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