Add a local-only escape hatch in onboarding when api.tinyhumans.ai is unreachable
Summary
When api.tinyhumans.ai is unreachable during onboarding (region-blocked, DNS failure, Cloudflare outage, corporate firewall, simply offline), the desktop app is currently a hard wall — the user is stuck on the sign-in screen. This proposal adds a single visible "Continue in local-only mode" escape hatch on the sign-in surface when a reachability probe determines the backend is unavailable, letting the user reach a functional (degraded) experience using on-device inference and storage only.
I'd like to confirm direction with maintainers before writing code — there are a few open product questions in the Maintainer questions section below.
Problem
Several recent issues point to the same gap:
- #1985 — OAuth login returns Cloudflare 504 against
api.tinyhumans.ai. New users cannot get past the sign-in screen at all. @bookernath reports the same. - #1998 — From mainland China:
auth.tinyhumans.aiDNS NXDOMAIN,app.openhuman.aireturns Cloudflare 530, login hangs. - #1917 — macOS first-install "supplement login info" screen — also signals onboarding-blocked-by-auth.
Constraints / context:
- The product is positioned as
Private, local-firstin the README (every edition). Memory Tree / Obsidian Wiki / TokenJuice / Ollama integration /scheduler_gateare complete enough to run a useful agent without the hosted backend. - The infrastructure to enter a signed-out / offline mode partially exists:
src/openhuman/scheduler_gate::set_signed_out/is_signed_outare already exported. - Endpoint configuration is mature:
BACKEND_URL/VITE_BACKEND_URLenvs,config.api_url, staging↔prod selector all work today. The gap is not "endpoint can't be changed" — it's "user has no in-product path forward when the default endpoint is unreachable."
Solution (draft for discussion)
Scope: core (src/) + app (app/).
Core:
- Add a lightweight reachability probe to the existing
doctordomain — short-timeout HEAD against the resolvedeffective_api_url. Exposed via a new RPCopenhuman.doctor_backend_reachable -> { reachable: bool, latency_ms?, error? }. - Add
local_only_modeas a first-class boolean onapp_state(paired withset_signed_outso the LLM router only consults local-AI providers and same-host integrations).
App:
3. In the sign-in / BootCheckGate surface, when not yet authenticated AND the probe returns reachable: false, render a banner:
"We can't reach the OpenHuman backend right now. You can continue in local-only mode — your data stays on this machine and the agent uses your local Ollama/LM Studio model. You can sign in later from Settings."
- "Continue in local-only mode" button → new RPC
openhuman.app_state_enter_local_onlythat flipsset_signed_out(true)+local_only_mode = true, then routes the user to/home. - In local-only mode, disable backend-dependent surfaces (Composio integrations, hosted-LLM routing, billing/rewards). Most already gate on signed-in elsewhere — point them at the new flag.
Out of scope (call out so reviewers can correct):
- Auto-recovery: backend returning ≠ auto re-enter signed-in.
- Endpoint customization UI in onboarding:
BACKEND_URLis already settable; this proposal does not change that surface.
Acceptance criteria
- [ ] Reachability probe —
doctor_backend_reachableRPC exists, short-timeout, single HEAD, no other side effects. - [ ] Local-only RPC —
app_state_enter_local_onlyflipsset_signed_out(true)+ newlocal_only_modeflag, emits an event. - [ ] Sign-in banner + button — appears only when probe is
unreachable, dismissable, keyboard-reachable + ARIA-labelled. - [ ] LLM routing in local-only mode — agent uses local-AI provider only; hosted calls gated with a clear "you're in local-only mode" error.
- [ ] Exit local-only mode — user signs in from Settings; flipping back requires a fresh successful auth handshake.
- [ ] Tests — Vitest covers banner show/hide + button RPC; Rust covers probe + flag mutation; at least one failure-path case (probe timeout → banner renders).
- [ ] Diff coverage ≥ 80% — meets the gate enforced by
.github/workflows/coverage.yml.
Maintainer questions
Before writing any code, I want to confirm direction. Specifically:
- Is "ship a local-only escape hatch in onboarding" the right shape? If you'd rather see "configure your own self-hosted backend URL in onboarding" instead (since
BACKEND_URLalready works but is undocumented in the UI), happy to write that. local_only_modeas a new flag vs. ride onset_signed_out? I'm proposing a separate flag because "signed-out by choice / region-blocked" is a different intent from "signed-out before first login," but you may have a cleaner model.- Probe target.
effective_api_urlHEAD, or a dedicated/health? Does one exist? - Re-auth UX. Where in Settings should the "Sign in" path live?
Happy to break this into smaller PRs (probe alone, banner alone, RPC alone) if that's easier to review.
Related
- Reported pain: #1985, #1998, #1917
- Existing surface:
src/openhuman/scheduler_gate::set_signed_out/is_signed_out - Existing config:
src/api/config.rs,BACKEND_URLenv
I did a quick code-path spike on this. I agree with the product direction, but I would keep the first implementation deliberately narrow because “signed out” currently means two different things in the app.
Current code-path observations:
- The unauthenticated Welcome screen is
app/src/pages/Welcome.tsx. It already has an “Advanced” RPC URL panel and connection test, so this is the lowest-risk surface for a backend-unreachable escape hatch. - Route gating is still session-token based:
app/src/components/DefaultRedirect.tsxsends users with nosnapshot.sessionTokenback to/, andapp/src/App.tsxonly enters/onboardingwhen!!snapshot.sessionToken && !snapshot.onboardingCompleted. - Core already treats missing auth as a real runtime state:
src/core/jsonrpc.rsseedsscheduler_gate::set_signed_out(true)when no session token exists, andsrc/openhuman/scheduler_gate/*pauses background LLM work for signed-out sessions. - Onboarding completion currently best-effort notifies the backend (
userApi.onboardingComplete()), then persists the localonboarding_completedflag viasetOnboardingCompletedFlag(true)inOnboardingLayout.tsx. - Local AI/on-device pieces are mature enough for a degraded path: onboarding has
LocalAIStep.tsx, local model routing/Ollama work has landed in recent PRs (#1975, #1750, #1640, #1569, etc.).
Suggested first slice:
- Add a tiny backend reachability probe used only by Welcome, with a short timeout and no auth requirement. I would start on the frontend side by probing the resolved backend/RPC URL already used by the Welcome advanced panel; if maintainers prefer core-owned diagnostics, expose it as a
doctor.backend_reachabilityRPC later. - When the probe clearly fails, show a secondary “Continue in local-only mode” action on Welcome. Do not auto-enter local-only on transient failures; make it explicit.
- Persist a separate local flag such as
localOnlyMode/offlineMode, instead of minting a fake session token. Then updateDefaultRedirect/AppShellroute gating to treatlocalOnlyModeas allowed to enter onboarding/home while keeping socket/backend-dependent surfaces disabled. - In local-only completion, skip or best-effort the backend
userApi.onboardingComplete()call, persist local onboarding state, and start with local/on-device provider guidance. Keep scheduler-gate behavior explicit: signed-out should continue to pause backend-auth work, while local-only LLM work should be opt-in and gated by local provider readiness.
Open questions I would want maintainer confirmation on before coding:
- Should local-only mode be a durable user choice in core config, or just a local app-state flag until sign-in succeeds?
- Is the intended first destination after local-only onboarding
/home, or a constrained “Local AI setup” screen until a local provider is ready? - Which surfaces should be hidden/disabled in local-only mode: billing/usage, cloud skills, OAuth accounts, socket-backed notifications, referrals?
- Should local-only users be able to later sign in and merge/migrate local state, or is it explicitly “anonymous local profile until reset” for v1?
Test plan for the first PR:
- Unit: Welcome shows no local-only CTA while probe is pending/successful, shows it on timeout/network failure, and does not show it for malformed custom RPC URLs.
- Unit:
DefaultRedirectandAppShellroute local-only users to onboarding/home without requiringsessionToken. - Unit: onboarding completion in local-only mode persists local flags and does not hard-fail when
userApi.onboardingComplete()rejects. - E2E/smoke: launch with backend URL pointed at an unroutable local port, click “Continue in local-only mode”, complete onboarding, reach Home without OAuth or hosted API connectivity.
I would avoid combining this with provider/model installation in the same PR. The useful first PR is the routing/state escape hatch plus disabled-state copy; local model bootstrap can be a follow-up once maintainers choose the local-only persistence model.
Thanks @honor2030 — that's a thorough code-path spike, and I agree with the core design calls.
Strong agreement on the directional points
Welcome.tsxas the host surface — yes. It already has the Advanced RPC URL panel + connection test, so a backend-reachability probe + "Continue in local-only mode" CTA has the lowest blast radius there.- No auto-enter on transient failures — explicit user action only.
- Separate
localOnlyModeflag, not a minted session token — agreed, conflating "signed in (anonymous)" with the existing token semantics breaks invariants downstream. First-class boolean flag is cleaner and keeps the route gates auditable. DefaultRedirect/AppShellshould treatlocalOnlyModeas allowed — minimal change, easy to test.
My take on your four open questions
(In case it helps tee up a maintainer decision.)
-
Durable in core config vs. transient app-state flag? I'd start with a transient app-state flag (clears on logout / fresh launch retry). Durable + migration story is a v2 once we know anyone actually wants to live in local-only mode.
-
First destination after local-only onboarding?
/home— billing/cloud-skill UI is already gated on session token, so the disabled state is well-defined. A dedicated "Local AI setup" screen is a follow-up if user-testing shows people getting lost. -
Surfaces to hide/disable in local-only. My read:
- Hide: billing/usage banners (the PR I just shipped at #2053 already gates these on routing, so this becomes additive), OAuth account list.
- Disable: hosted-LLM router (force-route to local provider), cloud skills, referral rewards.
- Keep available: Settings → Local AI provider config, the sign-in flow (so users can later auth).
- Socket / notifications: already gated on session token — no extra work.
-
Sign-in later → merge state? v1 = "anonymous local profile until reset." A future v2 could opt-in import the local-only Memory Tree into a fresh account. Definitely out of scope for the first PR.
Suggested first-PR scope
Roughly aligns with your bullets:
- Add
localOnlyMode: booleanto app-state slice (transient). - Frontend-side reachability probe used only by
Welcome.tsx— short timeout, no new RPC for v1. If maintainers prefer a core-owneddoctor.backend_reachability, that's a clean follow-up. - "Continue in local-only mode" CTA visible only on probe failure.
DefaultRedirect+AppShellallowlocalOnlyModeusers through.- Best-effort
userApi.onboardingComplete()in local-only completion path; persist local flag. - Vitest: probe pending/success → CTA hidden, timeout/error → CTA visible, malformed URL → CTA hidden.
- Out of scope for PR 1: provider/model installation flow, durable persistence, sign-in-later state migration.
Asking for the maintainer call
@senamakel — would love your call on the four open questions above so one of us (happy to defer to @honor2030 if they want to drive the implementation since they already did the code-path mapping) can start the PR with confidence. I think the scope above intentionally avoids touching scheduler_gate / set_signed_out wiring in core — your existing pattern stays in place.
@senamakel — quick batch status when you have a moment. Not chasing, just flagging since two of the items are bleeding production Sentry events.
Today's wave on top of the already-merged #2031 + #2033:
| PR | What | Status |
|---|---|---|
| #2042 | fix(i18n) zh-CN onboarding errorDesc (closes #1917) |
✅ all CI green, CodeRabbit APPROVED |
| #2045 | fix(security) image_info symlink escape (closes #1927) |
✅ all CI green, CodeRabbit APPROVED |
| #2053 | fix(billing) suppress budget banner when chat is routed away (closes #2040, #2041) |
✅ all CI green, all 3 @graycyrus review points addressed (auth_expired rethrow, kind: 'local' test, naming → isFullyRoutedAway); CodeRabbit re-APPROVED |
| #2080 | fix(router) tier alias fallback to default_model (closes #2079) |
✅ all CI green, CodeRabbit APPROVED |
| #2082 | fix(temperature) Kimi K2 + Moonshot defaults (closes #2076) |
✅ all CI green, CodeRabbit APPROVED |
| #2083 | feat(channels) Lark + DingTalk Settings UI (closes #2048) |
✅ all CI green, all CodeRabbit feedback addressed across ee9f56ec + 456f3888 (port field, optional-field tests, slice/migration both fixed) |
Six PRs, no outstanding action items on my side. The two Sentry-traced regressions are the ones I'd most want a look at when you next have time:
- #2080 —
reasoning-v1→ DeepSeek API,OPENHUMAN-TAURI-NH(39 events/day, every reasoning-tier agent call fails for the affected user). - #2082 —
temperature→ Kimi K2,OPENHUMAN-TAURI-HB(146 events/day, every Kimi turn fails for users in China).
For #2042 + #2082 there's an upstream flaky test on main (composio::action_tool::tests::factory_routes_through_direct_when_mode_is_direct) that bit both PRs in the Coverage Gate job — pnpm test:rust in the parallel job passed on the same commit. I've nudged both with empty CI-retrigger commits and they're green now, but worth tracking that flake as a separate issue if it keeps blocking fork PRs.
For #2037 itself — really appreciated @honor2030's spike. Still happy to draft the first PR once you've had a chance to weigh in on the four open questions (durable vs transient localOnlyMode, first destination after local-only onboarding, surface-disable list, sign-in-later state migration). No rush — wanted to keep the option open before either of us starts on the implementation.
This appears to have been substantially addressed by #2208 — feat(auth): add local offline login (merged 2026-05-24). That PR adds a "Continue locally" option to the Welcome screen for offline/local use when TinyHumans OAuth is unavailable, stores a local session, and skips backend-only auth/team/socket refresh work so backend 401s don't bounce the user back to OAuth.
It doesn't include the explicit reachability probe / banner-on-unreachable UX described here (the button is always present rather than triggered by a probe result), but the core "user has a way forward when the backend is unreachable" outcome is satisfied. Maintainers may want to either close this, or narrow it to just the probe-driven banner piece if that UX is still desired.
Correction to my earlier status note (above).
My previous comment said this was ~50% done with "wire the useBackendReachable hook + gate the CTA + show a banner" as the remaining work. That was based on the hook's docstring — which turns out to be stale. After reading through #2208 commit-by-commit, the picture is different:
- In #2208, @senamakel first did build exactly that — added
useBackendReachable, gated the "Continue locally" CTA on anunreachableprobe, with tests (df85d78f1, "Per #2037 AC, the offline-login button must only appear when the backend is unreachable"). - Four days later, in the same PR,
6ccd170a6("route local users through manual setup") deliberately removed that gating, made the CTA unconditional, and rewrote the Welcome tests to assert the button renders "regardless of runtime mode" / "in cloud mode too".
So the always-on CTA is an intentional maintainer decision, not an unfinished AC — local mode was reframed as an always-available experimental entry path plus manual-setup routing, rather than an error-state fallback shown only when OAuth is down. The issue's underlying goal (a way forward when the backend is unreachable) is functionally satisfied by that shipped design.
The only leftover was the useBackendReachable hook itself — orphaned (zero importers) with a docstring still describing the abandoned probe-gate. PR #3410 removes that dead code + stale docstring.
Whether to close this issue (delivered via #2208 with a different, maintainer-chosen UX than the original probe/banner AC) — or keep it open to revisit the probe/banner approach — is a maintainer call. Flagging rather than auto-closing.