fix(onboarding): raise snapshot timeout + staged still-working UI (#2156)
Summary
- Add per-call
timeoutMsoverride tocallCoreRpcso slow-but-alive RPCs can opt into a longer-but-still-bounded budget without changing the 30s default for fast calls. - Raise the first-launch
openhuman.app_state_snapshotandlearning_save_profiletimeouts to 90s — they legitimately run 30–40s on M-series Macs while memory tree init + Composio warmup compete for the snapshot critical path. - Stage the onboarding profile-build UI: after 30s of pending pipeline the copy swaps to a calmer "Still working on your profile…" message with a
core.pingalive indicator that distinguishes slow-but-alive from truly-unreachable cores. - Continue to chat stays available throughout — no UX regression on the existing escape hatch.
Problem
On slow first-launches (reported on M-series Mac Mini, macOS 26.1), openhuman.app_state_snapshot completes successfully but takes 32–37s while heavy boot work (memory tree init, Composio registry warmup, mascot rasterization, scheduler gate at 97% CPU) competes for the snapshot path. The global 30s RPC timeout kills the call mid-flight and parks users on the post-login profile-build fallback even though the backend would have answered moments later. Users read the fallback as broken login.
The existing build-profile UI also gives no signal during a long wait, so a slow-but-alive 35–40s snapshot looks identical to a hang.
Solution
callCoreRpclearns an optionaltimeoutMsparameter, clamped to the same[1s, 10min]window as the global default. Default behaviour is unchanged for the ~hundred existing call sites.fetchCoreAppSnapshotandsaveProfilepass90_000so the first-launch slow-success completes inline. Real failures still abort within 90s.ContextGatheringStepadds a 30s threshold timer that flips the title/description to a calmer "still working" variant and starts a 5score.pingprobe loop. The probe's result drives a small dot indicator (alive / probing / unreachable) so users can tell whether they should wait or take action.
Submission Checklist
- [x] Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
- [x] Diff coverage ≥ 80% — CI is expected to validate this; locally Vitest covers all three new code paths (per-call timeout override, snapshot timeout threading, staged UI with alive/unreachable probe).
- [x] Coverage matrix updated — N/A: behaviour-only change on the existing onboarding context-gathering flow; no new feature row added/removed/renamed.
- [x] All affected feature IDs from the matrix are listed in the PR description under
## Related— N/A: no coverage-matrix feature ID changed. - [x] No new external network dependencies introduced (mock backend used per Testing Strategy)
- [x] Manual smoke checklist updated if this touches release-cut surfaces (
docs/RELEASE-MANUAL-SMOKE.md) — N/A: narrow onboarding fallback behaviour change. - [x] Linked issue closed via
Closes #NNNin the## Relatedsection
Impact
- Desktop onboarding UI + frontend RPC client. No persistence, security, migration, or backend changes.
- The 90s budget is still bounded; nothing can hang forever.
- Fast-path RPCs continue to honour the 30s global default — no behaviour change for the existing ~100 call sites that do not opt into a longer timeout.
- 12 locales updated with the 5 new
onboarding.contextGathering.*keys (stillWorkingTitle,stillWorkingDesc,coreAlive,coreAliveProbing,coreUnreachable).
Related
- Closes #2156
- Follow-up PR(s)/TODOs: N/A
AI Authored PR Metadata (required for Codex/Linear PRs)
Keep this section for AI-authored PRs. For human-only PRs, mark each field
N/A.
Linear Issue
- Key: N/A
- URL: N/A
Commit & Branch
- Branch:
fix/2156-snapshot-timeout-staged-fallback - Commit SHA:
c6b910b7f7a1a12969d271226dadc9946acf6690
Validation Run
- [x]
pnpm --filter openhuman-app format:check— pre-push hook ran prettier; format-only fixes amended in. - [x]
pnpm typecheck— clean. - [x] Focused tests:
pnpm debug unit ContextGatheringStep14/14,pnpm debug unit coreRpcClient72/72,pnpm debug unit coreStateApi13/13. - [x] Rust fmt/check (if changed): N/A — no Rust changes.
- [x] Tauri fmt/check (if changed): N/A — no Tauri changes.
Validation Blocked
command:N/Aerror:N/Aimpact:N/A
Behavior Changes
- Intended behavior change: first-launch profile build no longer treats a slow-but-alive 35–40s snapshot as a failure; a calmer staged UI with an alive-indicator replaces the silent wait between 30s and ~90s.
- User-visible effect: post-login "Almost there!" fallback fires far less often; when the wait genuinely is long, users see honest progress copy plus a core-status dot, with continue-to-chat still available throughout.
Parity Contract
- Legacy behavior preserved: pre-30s happy path renders identical copy ("Building your profile…"). Continue-to-chat button still appears throughout. Existing error fallback unchanged.
- Guard/fallback/dispatch parity checks:
callCoreRpccallers that do not passtimeoutMscontinue to use the 30s global default. The 90s budget is still bounded; nothing can hang forever.
Summary by CodeRabbit
- New Features
- "Still working" onboarding messaging appears after ~30s for slow first-launches and shows core reachability status.
- Longer, per-operation RPC timeouts for more reliable first-run profile building.
- Translations added for the new onboarding messages in multiple languages.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 13886009-1bc8-4ddd-b62f-a25284a885e3
📥 Commits
Reviewing files that changed from the base of the PR and between 080c04c70e05e3bd4daff25e2e5dd13cbecfa2ad and 0dbe9df338c0636fc8dfa58bbdb71d6b3b1fc347.
📒 Files selected for processing (16)
app/src/lib/i18n/chunks/ar-4.tsapp/src/lib/i18n/chunks/bn-4.tsapp/src/lib/i18n/chunks/en-4.tsapp/src/lib/i18n/chunks/es-4.tsapp/src/lib/i18n/chunks/fr-4.tsapp/src/lib/i18n/chunks/hi-4.tsapp/src/lib/i18n/chunks/id-4.tsapp/src/lib/i18n/chunks/it-4.tsapp/src/lib/i18n/chunks/pt-4.tsapp/src/lib/i18n/chunks/ru-4.tsapp/src/lib/i18n/chunks/zh-CN-4.tsapp/src/lib/i18n/en.tsapp/src/pages/onboarding/steps/ContextGatheringStep.tsxapp/src/pages/onboarding/steps/__tests__/ContextGatheringStep.test.tsxapp/src/services/__tests__/coreRpcClient.test.tsapp/src/services/coreRpcClient.ts
✅ Files skipped from review due to trivial changes (8)
- app/src/lib/i18n/chunks/en-4.ts
- app/src/lib/i18n/chunks/ar-4.ts
- app/src/lib/i18n/chunks/bn-4.ts
- app/src/lib/i18n/chunks/zh-CN-4.ts
- app/src/lib/i18n/en.ts
- app/src/lib/i18n/chunks/ru-4.ts
- app/src/lib/i18n/chunks/pt-4.ts
- app/src/lib/i18n/chunks/it-4.ts
📝 Walkthrough
Walkthrough
This PR adds a staged "still working" onboarding UI with periodic core probes, per-call RPC timeout overrides (clamped), a 90s snapshot timeout, tests for timeout/probing behavior, and i18n updates across locale bundles.
Changes
Onboarding Staged Loading & Core Reachability
| Layer / File(s) | Summary |
|---|---|
Multi-language translations for staged loading UI app/src/lib/i18n/chunks/*-4.ts, app/src/lib/i18n/en.ts |
Translation keys added/updated for onboarding.contextGathering: coreAlive, coreAliveProbing, coreUnreachable, stillWorkingDesc, stillWorkingTitle, and updated errorDesc. |
Per-call RPC timeout override infrastructure & tests app/src/services/coreRpcClient.ts, app/src/services/__tests__/coreRpcClient.test.ts |
callCoreRpc accepts optional timeoutMs validated/clamped to bounds; fetch abort uses effective timeout and surfaces it in errors. testCoreRpcConnection accepts an AbortSignal. Tests cover override, clamp, and fallback. |
Snapshot RPC timeout extension to 90 seconds app/src/services/coreStateApi.ts, app/src/services/coreStateApi.test.ts |
Added exported SNAPSHOT_TIMEOUT_MS = 90_000 and pass it as timeoutMs to openhuman.app_state_snapshot; tests assert the timeout is passed and within bounds. |
ContextGatheringStep staged loading & core probing implementation app/src/pages/onboarding/steps/ContextGatheringStep.tsx |
Component flips to a "still working" UI after ~30s while pipeline pending, periodically probes core reachability with abort-bounded probes and single-flight guarding, displays alive/unreachable indicator, and calls learning_save_profile with extended timeout. |
Test setup and staged loading UI test suite app/src/pages/onboarding/steps/__tests__/ContextGatheringStep.test.tsx |
Expanded coreRpcClient mock (getCoreRpcUrl, testCoreRpcConnection) and added staged tests validating the 90s timeout override, UI transition after ~30s, core probe outcomes, and probe abort behavior. |
Sequence Diagram(s)
sequenceDiagram
participant UI as ContextGatheringStep
participant Pipeline as OnboardingPipeline
participant CoreRpcClient as coreRpcClient
participant Core as CoreRPC
UI->>Pipeline: start profile build
Pipeline->>CoreRpcClient: openhuman.learning_save_profile(timeoutMs=90s)
UI->>CoreRpcClient: getCoreRpcUrl() / testCoreRpcConnection() (periodic while pending)
CoreRpcClient->>Core: probe testCoreRpcConnection (with AbortSignal)
Core-->>CoreRpcClient: respond (200/401 or error)
CoreRpcClient-->>UI: alive/unreachable status
Pipeline-->>UI: completes -> normal UI
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related PRs
- tinyhumansai/openhuman#2196: Overlaps on
coreRpcClienttimeout/abort behavior changes. - tinyhumansai/openhuman#2057: Edits the same
onboarding.contextGathering.errorDesci18n key across locales. - tinyhumansai/openhuman#2042: Related edits to
zh-CNonboardingcontextGatheringcopy.
Suggested labels
feature
Suggested reviewers
- graycyrus
Poem
🐰 I tweak the waits and hush the fright,
"Still working..." glows through patient night,
I ping the core with gentle taps,
Abort the stalled and skip the traps,
Slow builds finish — huzzah, delight!
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately summarizes the main changes: raising snapshot timeout and adding staged still-working UI for onboarding. |
| Linked Issues check | ✅ Passed | All acceptance criteria from issue #2156 are met: false fallback reduced via 90s timeout override, progress UI added with 30s threshold, backend alive detection via core.ping probes, failure remains bounded at 10min max, and tests cover slow-success/timeout/failure paths. |
| Out of Scope Changes check | ✅ Passed | All changes are within scope: i18n updates for onboarding strings, RPC client timeout override feature, coreStateApi/ContextGatheringStep modifications, and comprehensive test coverage all directly support issue #2156 requirements. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
🔧 ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add
eslintto devDependencies.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Thanks — addressed in 4318b84a:
- Overlapping probes: added
inFlightsingle-flight guard so consecutive 5s ticks can't stack pendingcore.pingpromises. - Slow-path UI after finish: gated the title/desc/alive-indicator on
showStillWorking = stillWorking && !finished && !hasError, so the 800ms auto-advance window no longer shows the "still working…" copy. - Test hardening: added pre-boundary
settled === falseassertions on the timeoutMs-override and clamp tests so an early-abort regression can't slip through.
All 14 ContextGatheringStep + 72 coreRpcClient + 13 coreStateApi tests green locally.