Skip to content

fix: recover camera and microphone input toggles - #33

Merged
kixelated merged 14 commits into
mainfrom
quest/m0/media-toggles
Nov 26, 2026
Merged

kixelated merged 14 commits into
mainfrom
quest/m0/media-toggles

Conversation

@kixelated

@kixelated kixelated commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Camera off/on can wait forever behind a browser codec probe or final black-frame flush. The controls also obscured pending or denied capture. The required Check subsequently failed because terminal styling in the relay startup record broke the browser runner's address parser.

Approach

Use main's moq pin, 28d8eb84, which already contains the merged moq-dev/moq#8179 (merge commit 3ce26d1e). That fix and its maintainer decision keep the compatibility black frame while muted, cancel its wait when the track closes or is replaced, and release ordering before cosmetic flushing. This PR no longer changes the moq gitlink, flake.lock, or the moq and quest flake inputs.

The controls show requested, pending, live, failed and unavailable capture state with a persistent accessible status. Retry turns enabled off and on, waiting for the source to clear its error once it has processed the disable. Cleanup, changed settings or newer enabled intent cancel that handshake. Device selection can cancel pending capture. When the device list is known to be empty, the control shows unavailable rather than failed, since getUserMedia rejects with NotFoundError there. Device-row spinners show only while capture is pending. The code uses the per-device Local API (core.camera.enabled, core.microphone.enabled).

The real controls-to-remote-decode browser regression stays in just check (app/test/media.browser.ts). Its runner needs Playwright's Nix-provided browsers, so this PR adds PLAYWRIGHT_BROWSERS_PATH to the dev shell. Terminal styling is stripped only when parsing relay readiness, raw diagnostics are kept, and the test covers the actual ANSI-styled field format. The harness follows moq 28d8eb84: timestamps are Clock.Duration (compared via asMillis(), the old Milli units). The relay's allow-all rule is the empty --auth-public= prefix, since ** is now refused. Microphone constraints live on the capture source. The removed normalizeSource/isSampleSource helpers are inlined.

This finishes and removes the media-toggles quest, including its links from quest/m0/README.md and quest/m0/room-media.md.

Impact

No Hang public API or wire change. No new upstream retry API: the application uses the existing enabled signals. The dev shell gains PLAYWRIGHT_BROWSERS_PATH.

Alternatives

Unconditional cancellation was used, with no product timeout or automatic retry loop. The existing capture recovery policy is kept. The browser test selects the supported 2D viewer backend, since this host lacks WebGL2.

Decisions

Caused by

No single Hang PR caused it: the hang was in upstream capture codec work, fixed by moq-dev/moq#8179.

Validation

At 765f95cb7abb64167d8e9c38918b9eb180a1f0b7 (merged with main 203de18272a63fe8393204b6b26900010a6dcad3):

  • Full pinned FORCE_COLOR=1 quest gate just check passes: 5 API tests, 8 app tests, and 2 browser tests with 56 assertions (12–21 seconds for the browser file under varying host load). Before the harness migration, the merged head failed tsc on the harness (6 errors) and the relay refused --auth-public **.

  • The no-device case now rejects capture with NotFoundError, as a real missing input does. The test waits for a known-empty device list and the source error, then asserts unavailable with no Retry button. Against the previous control logic, it fails with Expected "unavailable", Received "failed".

  • The browser test drives real relay connections, encoding, separate remote decoding and nonzero audio PCM. It covers:

    • repeated camera/microphone toggles
    • held native support/probe/final-flush promises
    • pending capture cancellation and late stream cleanup
    • denial → Retry
    • device selection and device loss
    • pending teardown
    • unavailable devices without a busy indicator
    • current-microphone selection while pending

    Recovery happens before the superseded promises are released.

  • Focused handshake unit tests (app/src/capture.test.ts) cover acknowledgement, cleanup, changed device/constraints, newer enabled intent and stale Retry actions.

  • Pinned quest gate just build, quest check --base origin/main and git diff --check pass. The dev shell's Playwright bundle is now Chromium-only (the check launches channel: "chromium"), dropping Firefox, WebKit and the headless shell from the closure.

The fixture uses Chromium fake devices, getUserMedia/native VideoEncoder promise interception and synthetic ended events. Physical hardware loss, real permission dialogs, other browsers and the spatial WebGL scene remain unmeasured. The browser run logs publish error … remote error: 0 warnings from moq's lite publisher when a subscriber resets with code 0. This is upstream log noise, and the test still passes.

Models

Size: M
Implementer: Claude Code, claude-opus-5-5, high

Review

Rewritten by quest review after each round.

  • Head: 765f95c

  • Base: origin/main at 203de18

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

  • Reviewer: Codex, gpt-6.2-sol, high effort

  • Session: 01a215dd-9a78-7ee3-b4cf-fb5b7b060b5c, round 3

  • Score: 10/10, The missing-device fixture now rejects every retry, and the browser test waits for both the empty device list and the capture error before checking the controls.

  • Rounds: 3; first round 1 (medium 1); findings 1 (medium 1): fixed 1, refuted 0, open 0

  • Findings: none

Follow-ups

The broader capture-state redesign remains in moq-dev/moq#8145. Hardware and cross-browser runs would broaden coverage.

(Written by Claude Opus 5.5 with high)

Quest-Claim: e7e78dda8827133a
kixelated and others added 2 commits November 7, 2026 10:24
Pin cancellation-safe MoQ, show capture progress and errors, and offer explicit retry after denied capture. Exercise actual Hang input controls through a separate relay-connected Chromium viewer in the check suite.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Use the upstream cancellation fix, distinguish requested and actual capture state, and provide explicit camera and microphone retry controls. Add a Chromium regression through a local relay and separate viewer to the CI check suite.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
@kixelated kixelated changed the title Recover audio and video after repeated input toggles fix: recover camera and microphone input toggles Nov 7, 2026
kixelated and others added 4 commits November 7, 2026 10:30
Inject held support and flush promises around actual native codecs, then verify a separate relay-connected viewer decodes fresh video before releasing the old promise. This reproduces the stuck effect on the previous encoder implementation.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Keep accessible capture status mounted, make the selected-device action follow requested state, and cover absent devices and pending menu cancellation. Bind the browser fixture relay ephemerally and await its listening event while draining one log stream.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Keep the persistent capture live region as the sole camera availability announcement, while retaining the visible no-camera hint.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
@kixelated
kixelated marked this pull request as ready for review November 7, 2026 18:45
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 712eee02-65d1-44a5-bf1a-0204579ede64
Commits

Reviewing files that changed from the base of the PR and between f8d3ebd and 95bb716.

Files ignored due to path filters: 1

  • bun.lock is excluded by !**/*.lock
Files selected for processing: 13

  • app/package.json
  • app/src/capture.test.ts
  • app/src/capture.ts
  • app/src/controls.tsx
  • app/test/media.browser.ts
  • app/test/media.html
  • app/test/media.tsx
  • app/test/tsconfig.json
  • flake.nix
  • justfile
  • quest/m0/README.md
  • quest/m0/media-toggles.md
  • quest/m0/room-media.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

# Conflicts:
#	app/package.json
#	quest/m0/README.md

Copy link
Copy Markdown
Collaborator Author

Design change: follow the current API and cancellation decisions in moq-dev/moq#8179. Hang will pin published head 1ceb7ac7624cf8f05e59f4d2cec97ef9e46a3b0b in both places and implement its existing Retry button through enabled off/on, waiting for the source's cleared-error acknowledgement of the disabled phase. Cleanup, new enabled intent, or a changed device/constraints cancels that handshake. The genuine relay/remote-decoder and held-native-promise regressions remain. The required Check failure is an ANSI-styled relay readiness record; only parser input will be stripped, with a colored-record regression retained in CI. The standing delegation authorizes these recommended choices; no upstream queue changes are needed. A fresh local review will cover this revised approach.

(Written by GPT-6.1 Sol with xhigh)

Wait for the disabled capture acknowledgement before enabling Retry, cancel superseded handshakes, and parse terminal-styled relay startup records in CI.

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
@kixelated
kixelated marked this pull request as draft November 7, 2026 22:52
kixelated and others added 4 commits November 25, 2026 19:15
Keep main's moq (28d8eb84, which includes moq-dev/moq#8179) and quest pins,
and migrate the capture toggles to the per-device Local API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Timestamps are Clock.Duration, the relay's allow-all public prefix is the
empty string, and microphone constraints live on the capture source; the
removed source-normalizing helpers are inlined.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
getUserMedia rejects with NotFoundError when no input exists, which showed
Retry and hid the connect-a-webcam hint. A known-empty device list now wins
over the failure, and device-row spinners show only while capture is
pending. The fixture rejects like a real missing device, and the dev shell
ships only the Chromium the media check launches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ailable

Keep the missing input rejecting on every retry so a late enumeration
cannot let capture start, and assert only once the harness reports both
the empty list and the source error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated enabled auto-merge (squash) November 26, 2026 03:40
@kixelated
kixelated merged commit b98b9aa into main Nov 26, 2026
2 checks passed
@kixelated
kixelated deleted the quest/m0/media-toggles branch November 26, 2026 03:51
kixelated added a commit that referenced this pull request Nov 26, 2026
Keep #44's avatar validation and default-only URL avatars in account.update(),
renumber the random-avatar repair migration to 0005 after #44's 0004, take
#33's camera picker condition, and drop the download.tsx change that #47
makes moot.

Also settle the two CodeRabbit findings on account.ts: a failed delete of the
replaced upload is logged instead of failing a committed save, and
account.delete() deletes the R2 avatar before the rows again so a failed R2
delete stays retryable. The account tests now share #44's harness, which
enforces foreign keys as D1 does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant