Skip to content

fix(onboarding): surface continue-to-chat failures#2394

Closed
aqilaziz wants to merge 2 commits into
tinyhumansai:mainfrom
aqilaziz:codex/2081-onboarding-continue-feedback
Closed

fix(onboarding): surface continue-to-chat failures#2394
aqilaziz wants to merge 2 commits into
tinyhumansai:mainfrom
aqilaziz:codex/2081-onboarding-continue-feedback

Conversation

@aqilaziz
Copy link
Copy Markdown
Contributor

@aqilaziz aqilaziz commented May 21, 2026

Summary

  • return the ContextPage completeAndExit promise to the context step instead of swallowing it at the page boundary
  • put the manual Continue to chat button into loading state while completion RPCs are in flight
  • show the existing friendly error card and capture Sentry when manual completion rejects

Refs #2081

Checks

  • prettier --check focused onboarding files
  • pnpm test:unit src/pages/onboarding/pages/tests/ContextPage.test.tsx src/pages/onboarding/steps/tests/ContextGatheringStep.test.tsx
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Loading state now displays during context step completion in onboarding, indicating active processing.
  • Bug Fixes

    • Enhanced error handling when context step completion encounters issues, with improved error state display to users.
  • Tests

    • Updated onboarding tests to validate completion error scenarios and loading state behavior.

Review Change Stack

@aqilaziz aqilaziz requested a review from a team May 21, 2026 01:06
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

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: cb937498-6f67-4283-a103-e8819750f3f1

📥 Commits

Reviewing files that changed from the base of the PR and between 369a392 and a37b529.

📒 Files selected for processing (4)
  • app/src/pages/onboarding/pages/ContextPage.tsx
  • app/src/pages/onboarding/pages/__tests__/ContextPage.test.tsx
  • app/src/pages/onboarding/steps/ContextGatheringStep.tsx
  • app/src/pages/onboarding/steps/__tests__/ContextGatheringStep.test.tsx

📝 Walkthrough

Walkthrough

The onboarding context completion flow shifts error-handling responsibility from ContextPage to ContextGatheringStep. ContextPage now returns the completeAndExit promise directly without local error catching or Sentry forwarding. ContextGatheringStep wraps the completion with isCompleting loading state, error logging, Sentry capture, and error UI feedback. Tests are updated to verify the new error propagation path and loading behavior.

Changes

Onboarding context completion error handling refactor

Layer / File(s) Summary
ContextPage contract simplification
app/src/pages/onboarding/pages/ContextPage.tsx
Removes the @sentry/react import and the explicit .catch error handler around completeAndExit(). The onNext handler now fires the trackEvent call and returns the promise directly, delegating error handling downstream.
ContextGatheringStep error handling and loading UI
app/src/pages/onboarding/steps/ContextGatheringStep.tsx
Adds isCompleting state to track ongoing completion work. The continueToChat handler wraps onNext() with loading state changes and error handling that logs, captures the error with Sentry context tags (flow: onboarding-complete, step: continue-to-chat), sets error state, and marks the step finished. Both OnboardingNextButton instances receive loading and loadingLabel props driven by isCompleting.
Test coverage for new error flow
app/src/pages/onboarding/pages/__tests__/ContextPage.test.tsx, app/src/pages/onboarding/steps/__tests__/ContextGatheringStep.test.tsx
ContextPage test setup refactors to capture onNext() return value for assertion instead of mocking Sentry; prior Sentry-focused tests are replaced with a test that asserts trackEvent call and onNext rejection. ContextGatheringStep test suite adds a new case verifying that onNext rejection triggers Sentry capture with tags, sets error UI, and avoids async leaks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • tinyhumansai/openhuman#1771: Adjusts OnboardingLayout.completeAndExit to swallow task-persistence failures so the completion flow continues, complementing this PR's error-handling refactor at the onboarding completion boundary.
  • tinyhumansai/openhuman#2173: Reworks the context-gathering "continue to chat" fallback UI and copy to "your chat is ready," affecting the same error-state flow updated in this PR.
  • tinyhumansai/openhuman#2327: Adds Sentry capture and tests for completeAndExit failures at the same error-handling points where this PR removes ContextPage's explicit Sentry .catch and shifts responsibility to ContextGatheringStep.

Suggested labels

working

Suggested reviewers

  • graycyrus

Poem

A rabbit's tale of error flows reshuffled,
Where ContextPage steps back, unruffled,
And ContextGatheringStep stands tall with care,
Catching errors, loading states to share,
To chat completion, graceful and true. 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(onboarding): surface continue-to-chat failures' directly and clearly summarizes the main change: making user-visible the failures that occur when the continue-to-chat button is clicked during onboarding, which is the core objective of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 eslint to 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added the working A PR that is being worked on by the team. label May 21, 2026
Copy link
Copy Markdown
Contributor

@graycyrus graycyrus left a comment

Choose a reason for hiding this comment

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

Nice fix. Moving the error handling from ContextPage down into ContextGatheringStep is the right call — that's where the UI state lives, so that's where the loading spinner and error card belong.

The Promise.resolve(onNext()) wrapper handles the void | Promise<void> return type cleanly, the double-click guard via isCompleting is solid, and the Sentry capture + tags are preserved from the old page-level catch.

Tests cover the failure path well. No issues found — this is ready for approval.

@graycyrus
Copy link
Copy Markdown
Contributor

Hey @aqilaziz — thanks for tackling #2081, the loading state on the button is a nice touch and the Sentry capture cleanup is solid work.

After reviewing this more closely though, we're going to pass on showing the error card for this flow. Here's the thinking:

The context-gathering pipeline is an optional background process — the user's chat is fully ready regardless of whether it succeeds or fails. Showing an error card ("Your chat is ready...") for something the user didn't explicitly ask for and doesn't need to care about adds unnecessary friction right at the moment we want onboarding to feel smooth and frictionless.

The previous behavior (Sentry capture + silent continuation) was actually closer to the right UX here — if the completion RPCs fail, the best thing to do is silently move on to chat and let the team track it via Sentry. The user shouldn't be interrupted with a "something went wrong" card for a process they don't even know is running.

If you'd like to iterate on this, the part worth keeping would be:

  • The loading spinner on the "Continue to chat" button (good click feedback)
  • The double-click guard (if (isCompleting) return)
  • If the RPC fails, just navigate to chat anyway instead of showing the error card

But as-is, the error card display is a UX regression for onboarding flow, so closing this one out. Appreciate the effort and the clean test coverage — hope this context helps for future contributions!

@graycyrus graycyrus closed this May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

working A PR that is being worked on by the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants