Skip to content

Commit db3fb11

Browse files
committed
Never keep the loading skeleton over a page that finished without the bridge, and test it with the probe site
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012xYtaUjbkB1hwLtK4TEzhq
1 parent 2916bfd commit db3fb11

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎ios-shell/OpenBotShell/ShellController.swift‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,12 @@ final class ShellController: NSObject, WebControllerDelegate {
639639
refreshChrome()
640640
if let url = controller.webView.url, config.isOwnOrigin(url) {
641641
checkPageDrawn()
642+
// Never trap a person behind the skeleton: a page that finished but says nothing (a
643+
// Cloudflare check, an intermediary's error page, a web app without the bridge) shows
644+
// itself 1.5 s after it finished.
645+
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { [weak self] in
646+
self?.endPageLoad("finished-without-ready")
647+
}
642648
} else if model.signIn == .webFallback {
643649
// The identity provider's page: no skeleton over another site.
644650
endPageLoad("other-site")

‎ios-shell/OpenBotShellUITests/ShellFlowUITests.swift‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,21 @@ final class ShellFlowUITests: ShellTestCase {
484484
}
485485
}
486486

487+
// A page that never says ready (the probe site stands in for a challenge page or an older web
488+
// app): the skeleton goes by itself, and the lock screen does not come.
489+
func testSkeletonNeverTrapsAPageWithoutTheBridge() throws {
490+
let app = launch(base: "http://127.0.0.1:8765", moment: "no-bridge",
491+
extra: ["OPENBOT_SHELL_TEST_PLAIN_SESSION_COOKIE": "probe"])
492+
XCTAssertTrue(tab(app, .home).waitForExistence(timeout: 15), "no tabs")
493+
let skeleton = app.descendants(matching: .any)["loading-skeleton"]
494+
XCTAssertTrue(skeleton.waitForNonExistence(timeout: 15), "the skeleton stayed over a page without the bridge")
495+
XCTAssertTrue(firstExisting([app.webViews.staticTexts.firstMatch], timeout: 10) != nil, "the page is not shown")
496+
sleep(25)
497+
XCTAssertFalse(lockScreen(app).exists, "the load watchdog locked a page that had loaded")
498+
screenshot("page-without-bridge")
499+
note("no bridge: \(debugState(app))")
500+
}
501+
487502
// MARK: - Helpers
488503

489504
private func accountButton(_ app: XCUIApplication) -> XCUIElement {

‎ios-shell/PRODUCTION-PARITY.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ simulator, iOS 26.5) and a signed App Store build on a real iPhone talking to ht
1414
| http vs https, App Transport Security | Real backend | The Release suite talks only to https://my.open.bot with no ATS exception. `NSAllowsLocalNetworking` is added to Debug builds only (`project.yml` build phase), for the http mock and the probe. Run 46092731869 also ran the hand-off flow on a Release build over https through a TLS proxy with a throwaway CA (ATS accepted it with no exception); that proxy was then dropped by decision, so it is no longer re-run. |
1515
| Session cookie name and attributes | Real backend (partly), simulated | Production's cookie is `__Secure-better-auth.session_token`; the app looks for both names and deletes only those two. In run 46092731869 the https mock set the production cookie through the hand-off's `/enter` 303 inside WKWebView: stored as Secure, HttpOnly, SameSite=Lax, persistent, not visible to `document.cookie`, `isSecureContext` true, survived a relaunch of a Release build. On my.open.bot the session-cookie journey (Debug hook) shows the real cookie accepted. The mock suite uses the plain-name cookie over http. |
1616
| Sending a message and the Bot's streamed reply | Real backend | The session-cookie journey (Debug build only because of the cookie hook) sent one real message from Home through the software keyboard; the conversation opened and the Bot's whole reply was on screen within the first 3 s sample, so the increments of the stream were too fast to observe at that rate. |
17-
| Cloudflare in front of production | Real backend, from one kind of client | my.open.bot is behind Cloudflare: a `cf_clearance` cookie for `.open.bot` appears in the web view's store, and no challenge page was ever shown to the runner. That is a GitHub-hosted macOS runner's IP. A phone on a carrier, a corporate network or a VPN is a different client and may get a challenge page inside the web view. Test with TestFlight on cellular and on a corporate network. |
17+
| Cloudflare in front of production | Real backend, from one kind of client | my.open.bot is behind Cloudflare: a `cf_clearance` cookie for `.open.bot` appears in the web view's store, and no challenge page was ever shown to the runner. That is a GitHub-hosted macOS runner's IP. A phone on a carrier, a corporate network or a VPN is a different client and may get Cloudflare's "Performing security verification" page inside the web view (the Android shell's first real-backend run got one; iOS never has in CI). The app shows such a page as it is: the loading skeleton fades 1.5 s after any page finishes even without the bridge's `ready` (`testSkeletonNeverTrapsAPageWithoutTheBridge`), and the load watchdog never locks a page that has committed. One production run (46102422558) also got a 503 from my.open.bot for a moment. Test with TestFlight on cellular and on a corporate network. |
1818
| The hosted sign-in's real redirects | Real backend | In the web view: `my.open.bot/sign` → `/api/auth/hosted/sign-in` → `dashboard.operations.copilotkit.ai/intelligence/handoff` (the identity provider page: GitHub, Google, Microsoft, email and password) → `accounts.google.com/o/oauth2/auth` → `accounts.google.com/v3/signin/identifier`. Google did **not** refuse the embedded web view: the email and password steps went through in the web view and in the system sheet alike. Both then stopped at Google's 2-Step Verification phone prompt (the account's default second step), so a full Google sign-in was not proven end to end in either. |
1919
| The sign-in hand-off endpoint | Simulated | Not deployed: the probe gets 404 on my.open.bot (every production run), and the app falls back to the web sign-in, as designed. The hand-off itself (sheet, ticket, PKCE verifier, `/enter`, cookie in the web view) is tested against `app/workbench/mock-server.ts` (suite 2). |
2020
| Shell mode and /conversations | Simulated | Not deployed (web draft PR 2360). On production the web app draws its own sidebar toggle inside the tabs, sends no bridge messages, and the Conversations tab shows Home (there is no /conversations page). The shell copes: it notices signing in and signing out from the web view's URL. Suite 2 tests the real thing on this branch's web build. |

0 commit comments

Comments
 (0)