Skip to content

iOS QR scanner can crash when pairing prompt appears during scanner dismissal #99571

Description

@PollyBot13

Summary

The iOS app can crash after scanning a gateway pairing QR code during onboarding or from Gateway Settings. The crash happens when the scanner result immediately triggers gateway connection/trust UI while VisionKit is still dismissing/stopping the camera session.

Reproduction

Observed on Polly's iPhone, iPhone XR, iOS 18.7.9, test bundle ai.openclawfoundation.app.test.pollybot-5y97h9j837.

  1. Reset onboarding / start from no active gateway pairing.
  2. Open OpenClaw.
  3. Open the QR scanner from onboarding or Gateway Settings.
  4. Scan a fresh OpenClaw gateway pairing QR code.
  5. The app sometimes briefly shows a trust/local-network style popup and aborts.

Crash evidence

Fresh current-main rebuild reproduced the same crash before the local fix:

  • App version/build: 2026.6.11 / 488
  • Crash: OpenClaw-2026-07-03-160229.ips
  • Exception: EXC_CRASH / SIGABRT
  • Last exception backtrace includes:
    • +[UIAlertController _alertControllerContainedInViewController:]
    • -[_UIAlertControllerAnimatedTransitioning _alertControllerForContext:]
    • UIKit presentation transition frames
  • Concurrent thread shows VisionKit still tearing down capture:
    • queue: com.apple.visionkit.avcapturequeue
    • -[AVCaptureSession stopRunning]
    • -[VKAVCapture stopRunning]

That points to UIKit alert/prompt presentation racing the QR scanner sheet dismissal/camera teardown.

Expected behavior

Scanning a valid pairing QR should close the scanner, then continue connection/trust/pairing UI without crashing.

Notes

This was found while collecting real-device proof for #99247, but it is a separate onboarding/scanner bug. A local mitigation that queues the scanned result until after scanner dismissal allowed a fresh QR scan to connect successfully on the same device.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions