Repository navigation
fix(cloudxr): show OOB setup progress to embedded operators #1266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AndreusNvidius
wants to merge
2
commits into
main
Choose a base branch
from
anwilson/oob-progress-embedded-20261013
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Sparse operator progress derived from OOB lifecycle snapshots.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import logging | ||
| import time | ||
| from collections.abc import Callable | ||
| from dataclasses import dataclass | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class OobProgressEvent: | ||
| level: int | ||
| message: str | ||
|
|
||
|
|
||
| class OobProgressReporter: | ||
| """Describe setup transitions for foreground and embedded service owners.""" | ||
|
|
||
| def __init__(self, clock: Callable[[], float] = time.monotonic) -> None: | ||
| self._clock = clock | ||
| self._adb_ready = False | ||
| self._ever_adb_ready = False | ||
| self._last_stage: tuple | None = None | ||
| self._last_health: str | None = None | ||
| self._last_wait: tuple | None = None | ||
| self._last_delay_at: dict[str, float] = {} | ||
|
|
||
| def observe(self, snapshot: dict) -> list[OobProgressEvent]: | ||
| """Return leveled progress on meaningful state changes.""" | ||
| if snapshot.get("health") == "starting": | ||
| return [] | ||
|
|
||
| state = snapshot.get("state") | ||
| health = snapshot.get("health") | ||
| reason = snapshot.get("reason") or "unknown reason" | ||
| serial = snapshot.get("selectedSerial") | ||
| ready = bool(snapshot.get("adbReady")) | ||
| stage = ( | ||
| state, | ||
| reason, | ||
| snapshot.get("episodeStartedAt"), | ||
| snapshot.get("generation"), | ||
| ) | ||
| entered = stage != self._last_stage | ||
| state_changed = self._last_stage is None or state != self._last_stage[0] | ||
| now = self._clock() | ||
| messages: list[OobProgressEvent] = [] | ||
|
|
||
| def emit(level: int, message: str) -> None: | ||
| messages.append(OobProgressEvent(level, message)) | ||
|
|
||
| if ready and not self._adb_ready: | ||
| verb = "reconnected" if self._ever_adb_ready else "detected" | ||
| emit( | ||
| logging.INFO, | ||
| f"USB-attached HMD {verb} (serial {serial}); continuing OOB setup.", | ||
| ) | ||
| self._ever_adb_ready = True | ||
| self._adb_ready = ready | ||
|
|
||
| if state == "WAITING_FOR_ADB" and not ready: | ||
| diagnostic = snapshot.get("adbDiagnostic") | ||
| lower_reason = reason.lower() | ||
| # ADB authorization needs operator action even when raw diagnostics exist. | ||
| if "unauthorized" in lower_reason: | ||
| wait = ("unauthorized", serial) | ||
| level = logging.WARNING | ||
| message = ( | ||
| "ADB authorization required: unlock the headset and accept " | ||
| "the USB debugging prompt." | ||
| ) | ||
| elif "offline" in lower_reason: | ||
| wait = ("offline", serial) | ||
| level = logging.INFO | ||
| message = f"Waiting for USB-attached HMD: {reason}" | ||
| elif "multiple" in lower_reason: | ||
| wait = ("multiple", serial) | ||
| level = logging.WARNING | ||
| message = f"Waiting for USB-attached HMD: {reason}" | ||
| elif diagnostic: | ||
| wait = ("adb_diagnostic", diagnostic) | ||
| level = logging.WARNING | ||
| message = f"ADB diagnostic: {diagnostic}" | ||
| elif serial is None: | ||
| wait = ("no_headset",) | ||
| level = logging.INFO | ||
| message = "No USB-attached HMD detected; connect a headset to continue." | ||
| else: | ||
| wait = ("selected_missing", serial) | ||
| level = logging.INFO | ||
| message = f"Waiting for USB-attached HMD: {reason}" | ||
| if wait != self._last_wait: | ||
| emit(level, message) | ||
| self._last_wait = wait | ||
| else: | ||
| self._last_wait = None | ||
|
|
||
| if entered: | ||
| if state == "PREPARING_DEVICE": | ||
| emit( | ||
| logging.DEBUG, | ||
| f"Waiting for headset transport: {reason}" | ||
| if snapshot.get("networkPresent") is False | ||
| else f"Preparing headset {serial} for OOB setup.", | ||
| ) | ||
| elif state == "REBUILDING_USB": | ||
| emit(logging.DEBUG, "Configuring USB reverse rules and TURN.") | ||
| elif state == "AUTOMATING_BROWSER": | ||
| emit( | ||
| logging.DEBUG, | ||
| "USB reverse rules and TURN verified; opening headset browser." | ||
| if reason == "TURN and reverse rules verified" | ||
| else "Opening headset browser and connecting OOB client.", | ||
| ) | ||
| elif state == "VERIFYING_EXISTING_BROWSER": | ||
| emit( | ||
| logging.DEBUG, "USB transport restored; checking existing browser." | ||
| ) | ||
| elif state == "VERIFYING_BROWSER": | ||
| emit(logging.DEBUG, "Waiting for headset browser health report.") | ||
| elif state == "WAITING_FOR_AWAKE" and state_changed: | ||
| emit(logging.INFO, f"Waiting for selected headset to wake: {reason}") | ||
| elif state == "WAITING_FOR_NETWORK" and state_changed: | ||
| emit( | ||
| logging.WARNING, | ||
| "Headset network unavailable; connect it to Wi-Fi to continue.", | ||
| ) | ||
| elif state == "USB_HEALTH_BLOCKED" and state_changed: | ||
| emit( | ||
| logging.WARNING, | ||
| f"USB health policy blocked browser launch: {reason}", | ||
| ) | ||
| elif state == "DEGRADED" or "Recovery episode expired" in reason: | ||
| if now - self._last_delay_at.get(reason, float("-inf")) >= 30: | ||
| emit(logging.WARNING, f"OOB recovery delayed: {reason}") | ||
| self._last_delay_at[reason] = now | ||
|
|
||
| if health == "browser_ready" and health != self._last_health: | ||
| emit( | ||
| logging.INFO, | ||
| "OOB browser ready; waiting for fresh stream metrics." | ||
| if snapshot.get("streaming") | ||
| else "OOB browser ready; waiting for OpenXR stream.", | ||
| ) | ||
| self._last_stage = stage | ||
| self._last_health = health | ||
| return messages | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: NVIDIA/IsaacCapture
Length of output: 4957
Allow recovery-delay reminders without a stage change.
If the service repeats the same
DEGRADEDsnapshot,enteredis false. The 30-second reminder check does not run, so recovery-delay reminders stop after the first message. Check the delay timer for every degraded snapshot, while keeping the stage-change check for transition messages.🤖 Prompt for AI Agents