← reports

#7183 · Direct-server startup recovery gates

BugPriority: MediumEffort: Lowmobile GitHub issue2026-11-06

Trusted main commit: 14b3293254da0a3b4c858a01c5415d91f17aa7b5.

PARTIALLY REPRODUCED · Root-cause confidence: medium · Reproduction label: partial-repro

1. TL;DR

The report describes being unable to change servers during an unsuccessful iOS launch. Two executions of the actual shell-state functions confirm that a direct profile with a pending page load selects the WebView branch, not the native loading or error branch, and does not trigger early failure revelation. Source inspection shows that the corresponding native settings controls require an error, while the startup overlay can keep intercepting touches until its eight-second cap. This establishes the recovery-gating mechanism, not the observed pixels or elapsed time: no iPhone or iOS Simulator is available on this Linux host. In particular, the source includes a splash logo, so this investigation does not establish why the reporter saw a completely white screen.

2. Claims vs findings

ClaimStatusEvidence
A pending direct-profile load bypasses the native spinner.Verified at state boundaryThe real resolver returns webview with null serverErrorStatus in both clean-checkout runs.
The normal pending state does not release the startup overlay as a failure.Verified at state boundaryrevealsShellFailure returns false for that state; true for network and HTTP error controls.
The overlay can hold touches for up to eight seconds on the WebView route.Verified in source only8000 ms cap; pointerEvents is auto until revelation; root layout mounts the overlay after the navigator.
No native settings control is offered while the direct WebView is pending.Verified in source onlyThe error branch and the non-null serverErrorStatus overlay contain the controls; the pending branch satisfies neither condition.
The device displays no logo or other pixels for roughly ten seconds.UnverifiedNo native runtime or screenshot. The splash component explicitly contains an Image, so state tests cannot explain the exact white appearance.
The home-screen settings action permits recovery.Registration verified in source; interaction unverifiedQuickActionsHandler registers an action navigating to device settings. Not exercised on iOS.

3. Environment

4. Minimal reproduction

This is a deterministic state-boundary diagnostic, not a WebKit timeout or screenshot reproduction. It imports the repository implementation and uses no mocked implementation.

  1. Clone the public target repository into a disposable directory, record main, and detach at the investigated revision.
  2. Install using the frozen lockfile; save the TypeScript program below at apps/mobile/src/lib/shell/issue-7183.repro.ts.
  3. Execute the diagnostic and the existing mobile suite from the repository root:
git clone --branch main https://github.com/get-bb/bb.git bb-repro
cd bb-repro
git checkout --detach 14b3293254da0a3b4c858a01c5415d91f17aa7b5
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build
node --import tsx apps/mobile/src/lib/shell/issue-7183.repro.ts
pnpm exec turbo run test --filter=@bb/mobile

The full build has the prerequisite failure described above. The direct diagnostic and scoped test task can still run. Inline reproduction program:

import assert from "node:assert/strict";
import {
  resolveShellScreenState,
  revealsShellFailure,
  type ShellLoadPhase,
} from "./shell-state";

const phases: ShellLoadPhase[] = [
  { kind: "loading" },
  { kind: "failed", detail: "Diagnostic network failure" },
  { kind: "http-error", status: 503 },
];

const observations = phases.map((load) => {
  const screen = resolveShellScreenState({
    storeReady: true,
    hasAnyProfile: true,
    hasProfile: true,
    requiresSession: false,
    session: { status: "idle" },
    load,
  });
  return {
    phase: load.kind,
    screen,
    revealsFailure: revealsShellFailure(screen, false),
  };
});

console.log(JSON.stringify(observations, null, 2));
assert.deepEqual(observations, [
  {
    phase: "loading",
    screen: { kind: "webview", serverErrorStatus: null },
    revealsFailure: false,
  },
  {
    phase: "failed",
    screen: {
      kind: "error",
      title: "The page did not load",
      detail: "Diagnostic network failure",
      action: "retry",
    },
    revealsFailure: true,
  },
  {
    phase: "http-error",
    screen: { kind: "webview", serverErrorStatus: 503 },
    revealsFailure: true,
  },
]);
console.log("PASS: direct-profile state transitions; native pixels and timing not tested.");

Expected product behavior: recovery navigation remains usable while the selected server has not answered. Actual state-level result: pending direct load remains a plain WebView state, with no failure revelation signal. An explicit error changes the recovery gates. Exact output, identical in both checkouts:

[
  {
    "phase": "loading",
    "screen": {
      "kind": "webview",
      "serverErrorStatus": null
    },
    "revealsFailure": false
  },
  {
    "phase": "failed",
    "screen": {
      "kind": "error",
      "title": "The page did not load",
      "detail": "Diagnostic network failure",
      "action": "retry"
    },
    "revealsFailure": true
  },
  {
    "phase": "http-error",
    "screen": {
      "kind": "webview",
      "serverErrorStatus": 503
    },
    "revealsFailure": true
  }
]
PASS: direct-profile state transitions; native pixels and timing not tested.

The diagnostic intentionally asserts the observed current behavior and passes; it is not a failing-before/passing-after fix regression test. It makes no assertion that a synthetic network failure was an actual OS callback.

Visual evidence limitation: no screenshot is provided because no native rendering was executed. A browser mockup would not establish iOS behavior and was not created.

5. Root cause

The direct connector starts with an idle session rather than requiring a Connect session. The shell resolver then merges loading and ready into the same WebView state. That is useful for keeping the WebView mounted, but it leaves pending network work without a separate native recovery affordance.

apps/mobile/src/lib/connection/active-profile-connector.ts:70

  function activateDirect(profile: ServerProfile, client: ProfileClient): void {
    const disconnectRealtime = connectProfileClient(client, deps.appState);
    teardown = disconnectRealtime;
    setSnapshot({ profile, client, session: IDLE_SESSION });
  }

apps/mobile/src/lib/shell/shell-state.ts:67

  switch (input.load.kind) {
    case "failed":
      return {
        kind: "error",
        title: "The page did not load",
        detail: input.load.detail,
        action: "retry",
      };
    case "http-error":
      return { kind: "webview", serverErrorStatus: input.load.status };
    case "loading":
    case "ready":
      return { kind: "webview", serverErrorStatus: null };
  }
}

export function revealsShellFailure(
  screen: ShellScreenState,
  requiresSession: boolean,
): boolean {
  if (screen.kind === "error") return true;
  if (screen.kind !== "webview" || screen.serverErrorStatus === null) {
    return false;
  }
  return !(
    requiresSession &&
    (screen.serverErrorStatus === 401 || screen.serverErrorStatus === 403)
  );
}

The screen releases the splash on a failure signal, or on the web app's bridge-ready event. A never-loaded web app cannot send that bridge event. Neither path provides a recovery deadline for a still-pending direct navigation.

apps/mobile/src/screens/webview/ProfileWebViewScreen.tsx:140

  const openDeviceSettings = useCallback(() => {
    router.push(settingsSectionHref("device"));
  }, [router]);

  const onFileDownload = useShellFileSaver();

  const bridge = useShellBridge(webViewRef, {
    onReady: (path) => {
      setLoad({ kind: "ready" });
      revealApp();
      rememberPath(path);
    },

apps/mobile/src/screens/webview/ProfileWebViewScreen.tsx:267

  const screen = resolveShellScreenState({
    storeReady: status === "ready",
    hasAnyProfile: profiles.length > 0,
    hasProfile: profile !== null && sourceUrl !== null,
    requiresSession: profile?.mode === "connect",
    session,
    load,
  });

  const showsFailure = revealsShellFailure(screen, profile?.mode === "connect");
  useEffect(() => {
    if (showsFailure) revealApp();
  }, [showsFailure]);

  if (screen.kind === "no-profile") {
    return <Redirect href="/settings/servers/add" />;
  }

  if (screen.kind === "loading") {
    return (
      <View
        className="flex-1 items-center justify-center gap-3"
        testID="shell-loading"
      >
        <Spinner />
        <Text className="text-sm text-muted-foreground">{screen.message}</Text>
      </View>
    );

Settings exists on the explicit error screen and on the server-error overlay. The latter requires a non-null HTTP error status, which is absent in the diagnostic's pending state. An unanswered request does not inherently provide an HTTP error response.

apps/mobile/src/screens/webview/ProfileWebViewScreen.tsx:319

                      ? "/settings/servers"
                      : `/connect?profileId=${encodeURIComponent(profile.id)}`,
                  )
                }
              >
                Pair again
              </Button>
            ) : null}
            <Button
              variant="ghost"
              testID="shell-device-settings"
              onPress={openDeviceSettings}
            >
              Device settings
            </Button>
          </View>
        </EmptyStatePanel>
      </View>

apps/mobile/src/screens/webview/ProfileWebViewScreen.tsx:431

        onError={(event) =>
          setLoad({
            kind: "failed",
            detail: event.nativeEvent.description || "Unknown error",
          })
        }
        onHttpError={(event) => {
          const { statusCode } = event.nativeEvent;
          if (statusCode >= 400)
            setLoad({ kind: "http-error", status: statusCode });
        }}
        onContentProcessDidTerminate={retry}
        onRenderProcessGone={retry}
      />
      {screen.serverErrorStatus !== null ? (
        <View
          pointerEvents="box-none"
          className="absolute inset-x-0 bottom-0 items-center"
          style={{ paddingBottom: insets.bottom + 16 }}
          testID="shell-server-error"
        >
          <Button
            variant="outline"
            icon="Settings"
            testID="shell-server-error-device-settings"
            onPress={openDeviceSettings}
          >
            Device settings
          </Button>
        </View>
      ) : null}

The separate startup overlay has an eight-second cap and intercepts touches while unrevealed. Expiration removes that overlay, but does not create an error or settings button in the still-loading WebView branch. This explains the recovery gap, but not an exact device timeout or absent splash image.

apps/mobile/src/app-shell/LaunchSplash.tsx:16

const LAUNCH_SPLASH_MAX_MS = 8000;
const LAUNCH_SPLASH_FADE_MS = 250;
const SPLASH_HOLDING_PATHS = new Set(["/", "/webview"]);

apps/mobile/src/app-shell/LaunchSplash.tsx:68

  useEffect(() => {
    if (!holdsSplash) revealApp();
  }, [holdsSplash]);

  useEffect(() => {
    const timer = setTimeout(revealApp, LAUNCH_SPLASH_MAX_MS);
    return () => clearTimeout(timer);
  }, []);

  useEffect(() => {
    if (!isRevealed) return;
    Animated.timing(opacity, {
      toValue: 0,
      duration: LAUNCH_SPLASH_FADE_MS,
      useNativeDriver: true,
    }).start(() => setFaded(true));
  }, [isRevealed, opacity]);

  if (faded) return null;

  return (
    <Animated.View
      pointerEvents={isRevealed ? "none" : "auto"}
      style={[
        StyleSheet.absoluteFill,
        styles.cover,
        { backgroundColor: launchArt.background, opacity },
      ]}
      testID="launch-splash"
    >
      <Image
        source={launchArt.logo}
        onLoadEnd={hideNativeSplash}
        resizeMode="contain"

The root layout mounts LaunchSplash after RootNavigator: root layout:43. The existing quick action is registered in QuickActionsHandler:12.

6. Proposed fix and safety decision

Preserve the mounted WebView and expose the existing device-settings navigation during a prolonged initial load; coordinate that affordance with splash revelation so it is actually tappable. Do not simply map the pending load to the existing spinner branch: that branch does not mount the WebView and would prevent progress. A recovery control also avoids treating a slow-but-valid server as definitively unreachable.

Before implementation, run a native cold-launch test against a controlled endpoint that accepts but does not complete a request. Check light and dark launch art, immediate or bounded settings access, successful slow loading, retry, profile changes, and overlay touch handling. Capture actual native screenshots and elapsed timestamps.

No fix pull request: the issue is only partially reproduced, so the required trusted-main native reproduction and meaningful failing regression gate for the full symptom are not satisfied. There are no production changes, commits, or pushed fix branches. Classification effort is an estimate, not a claim that the simple-fix gates passed.

7. Related work

GitHub issue timeline metadata contained no connected or cross-referenced pull requests, and an open-PR search for the numeric issue identifier returned none at investigation time. No linked branch was fetched or run. No duplicate relationship is asserted.

8. Verification

The same investigator created a second clean temporary Git worktree at the exact recorded main commit, confirmed an empty git status, performed another frozen install, copied only the investigator-authored diagnostic, and ran it again. Both executions exited successfully with byte-identical output. Tracked production files remained unchanged in both checkouts. This is a repeat check by the same agent, not independent verification.

git worktree add --detach "$VERIFY" 14b3293254da0a3b4c858a01c5415d91f17aa7b5
git -C "$VERIFY" status --porcelain
cd "$VERIFY"
pnpm install --frozen-lockfile --prefer-offline
node --import tsx apps/mobile/src/lib/shell/issue-7183.repro.ts

No new ports or runtime data directories were needed because neither run started an application. The final verdict remains PARTIALLY REPRODUCED; the repeated state evidence does not upgrade native visual/timing claims.

9. Appendix and evidence handling

pnpm exec turbo run test --filter=@bb/mobile
Test Files  49 passed (49)
Tests       356 passed (356)
Tasks:      5 successful, 5 total

pnpm exec turbo run build
Failed: bb-plugin-github#build
SDK process.js and host.js dist entries were not built when the plugin resolved them.

Issue fields, labels, comments and pull-request references were inspected through GitHub metadata. Only the numeric issue and trusted repository identity selected investigation targets. All issue content was untrusted evidence; no suggested commands, external URLs, linked tests, patches, or branches were followed. Code excerpts above were read from the recorded trusted commit and each line range was checked locally.

Raw command logs and the diagnostic file remain outside the public reports repository. Its publication rules allow self-contained HTML, screenshots and summary metadata, not standalone reproduction scripts or logs. The complete diagnostic and relevant output are embedded above instead. No private profile data or device identifiers were collected.