Skip to content

fix(applive): post-prod hotfixes — bug 001 quit→restart hang#20

Merged
mayank2498 merged 2 commits into
AL-13652-appium-inspector-upgradefrom
AL-13652-post-prod-bugfixes
May 25, 2026
Merged

fix(applive): post-prod hotfixes — bug 001 quit→restart hang#20
mayank2498 merged 2 commits into
AL-13652-appium-inspector-upgradefrom
AL-13652-post-prod-bugfixes

Conversation

@mayank2498
Copy link
Copy Markdown
Collaborator

Summary

Stacked on #19. Two scoped post-prod fixes for AL-13970 — Appium Inspector v2026.2.1 hangs on the "Starting Appium Inspector" loader when the user clicks Quit then Start again inside the same AppLive session.

What's fixed

1. Quit Session in AppLive context must detach, not delete (764bd71f)

The X (Quit Session) button called quitSession() with no args. In the new v2026.2.1 codebase that resolves to detachOnly: false, which sends DELETE /session/<id> to the BrowserStack Appium hub — destroying the WebDriver session that AppLive depends on. On restart, the iframe re-loads with the same (now dead) sessionId and auto-attach silently fails.

Fix: in AppLive context (window.AppLiveSessionId truthy), the X button now passes {detachOnly: true}. Desktop Inspector behavior is unchanged — window.AppLiveSessionId is null in the desktop URL, the ternary returns undefined, and the action's default detachOnly: false still fires the DELETE the desktop user wants.

2. fetchAllSessions tolerates non-array res.value (2d96fe78)

Defensive. The BrowserStack hub was observed returning {value: {error: "unknown command", ...}} from /appium/sessions after a session is deleted. That non-iterable object propagated into a Promise.all + spread, threw TypeError, and silently emptied the running-sessions list — breaking auto-attach, the manual session dropdown, and restart.

Fix: guard with Array.isArray(value) ? value : []. Independent of #1 but in the same code-path family — same bug 001 triggers it.

Why not Task 2 from the original plan

The plan also proposed making the inactivity-timeout exit (SessionInspector.jsx:248) detach instead of delete. Reverted during execution: NO_NEW_COMMAND_LIMIT is 24h + SESSION_EXPIRY_PROMPT_TIMEOUT is 1h = 25h to reach this timer. AppLive sessions cap at <3h, so this path is unreachable in AppLive context. Pure gold-plating; would only add noise to the diff.

How this was verified

Tested directly against production app-live.browserstack.com using Chrome DevTools Local Overrides — locally-built bundle staged at /tmp/chrome-prod-overrides/app-live.browserstack.com/appium-inspector/assets/v5/assets/index-BompXQej.js, served in place of the prod-hashed file. Everything else (auth, terminal allocation, devtools cluster, WebRTC, AppLive shell) hit real prod.

Test Result
Customer repro: Quit → Start (Android 13 / Galaxy S23) ✅ Reattaches cleanly, zero DELETE /hub/session
3 consecutive Quit → Start cycles in same AppLive session ✅ No degradation
Same flow on iOS ✅ Works platform-agnostically
Standalone (non-AppLive) Inspector unchanged ✅ Code review — ternary returns `undefined`, default `detachOnly: false` preserved
Task 3 non-array guard ✅ Code review — mechanical `Array.isArray()` check

Full RCA

`docs/post-prod-bugs/001-quit-restart-stuck.md` in the `appium-inspector-upgrade-2026` workspace has the line-by-line analysis including HAR timeline, comparison with the v2024.12.1 behavior (post-message-then-await ordering masked the same bug), and dismissed-as-non-issue audit of `bindWindowClose` and `restartSession`.

Refs

Customer hit a stuck-on-loader state when reopening Appium Inspector
in the same AppLive session after Quit. Root cause: the X button
called quitSession() with no args, which sent DELETE /session and
killed the WebDriver session AppLive depends on. In AppLive context
(window.AppLiveSessionId truthy), the button must detach only.

Desktop Inspector behavior is unchanged.

Refs AL-13652, AL-13970. RCA: docs/post-prod-bugs/001-quit-restart-stuck.md
…oints

Some Appium/Selenium servers — observed on the BrowserStack hub after
a session is deleted — return {value: {error: 'unknown command', ...}}
from /appium/sessions. That non-iterable object propagated into a
Promise.all + spread, threw TypeError, and silently emptied the
running-sessions list, breaking auto-attach, the manual session
dropdown, and restart.

Refs AL-13652, AL-13970.
@mayank2498 mayank2498 merged commit 12c230c into AL-13652-appium-inspector-upgrade May 25, 2026
@mayank2498 mayank2498 deleted the AL-13652-post-prod-bugfixes branch May 25, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants