Skip to content

fix(room): make Remote Control stop others from moving you - #51

Merged
kixelated merged 9 commits into
mainfrom
quest/m1/remote-control
Nov 26, 2026
Merged

kixelated merged 9 commits into
mainfrom
quest/m1/remote-control

Conversation

@kixelated

@kixelated kixelated commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Closes the quest/m1/remote-control.md quest.

Problem

Settings → "Remote Control" ("Allow others to drag/resize your camera") was wired backwards. It only controlled whether you could send moves to others. Peers could always move your tile, and always saw it as draggable, because window.handle was always published.

Separately, a move was settled only once the peer published the same x/y/s. So a move that undid one still in flight, landing where the peer already was, could stay queued and replay later, snapping the tile back once.

Approach

  • LocationFields.window.movable (fed by Settings.draggable in local.ts) replaces the misused peers.enabled and the unused window.enabled.
  • serveExtras publishes window.handle only while movable, so peers' existing Broadcast.locked() shows the tile as locked and they can't address moves to it. Each unlock issues a fresh handle, so a move asked before a lock can't land after it.
  • index.ts follows a peer's requests only while movable, through a per-peer, per-window Peers.Inbox.
  • A lock mid-gesture ends the viewer's drag or pinch on that tile. A lock mid-gesture, or one that rejects a move still pending, puts the tile back where it sat before our moves, overlaid with whatever placement the peer published. Lifting a finger after a lock ended a pinch no longer starts a drag on another tile, and the canceled pinch's baseline is cleared.
  • Space.#publishPosition sends every move through one local broadcast, the earliest added (the camera), whatever your own setting. Picking by stacking order let a chat or drag move requests to the screen share's track, where an older one could arrive last and snap the tile back.
  • Confirmation IDs (maintainer decision, 2026-11-25): each request carries a random id. The moved peer applies each ID once and echoes it in window.applied while the request stands, even when its position doesn't change. The requester drops a request only once its ID is echoed. Requests without an ID (older senders) are applied on every publish, as before. Peers that publish no applied list (older receivers) are still settled by matching x/y/s, keeping the old skip for moves they already made.

Public API and wire impact

No public package API. hang/location.json gains optional fields only, so mixed versions keep working:

  • peers.positions[handle].id?: string: the move's confirmation ID.
  • window.applied?: string[]: the IDs of requests applied and still standing. Its presence, even empty, tells requesters to wait for the echo instead of matching positions.
  • window.handle is now omitted while Remote Control is off. Older peers already treat a missing handle as locked.

Older peers strip the unknown fields (zod object strips them; checked), and new peers fall back to position matching for them. Rolling back just removes the new fields.

Decisions

Choices I made without asking, for review:

  • Lock by omitting handle rather than adding a locked flag. It reuses the existing optional field, so older peers see the lock too.
  • applied is a flat list across requesters, so IDs are random (about 60 bits) rather than per-requester counters. Each peer's list is bounded by its current requesters times its local windows.
  • Also gave the Remote Control and Debug checkboxes accessible names (aria-label). They had none, which I hit while driving the UI.
  • Drag that turns into a pinch on the same tile (maintainer, 2026-11-26): ✅ (a) re-grab only when the pinch targets a different tile, so a lock mid-pinch restores the pre-gesture spot (rejected: (b) accept it, (c) drop the PR). When the pinch does switch tiles, the dragged tile's position is published first, as the touch-handoff path already does.

Alternatives

  • Settle on position or echo for new peers: rejected. A matching position can't confirm a move to where the peer already is, which is the replay bug.
  • Key echoes by requester path: rejected. It's fragile (path forms differ) and IDs alone suffice.

Caused by

No single PR. The setting has gated sending moves since before history was cleaned up (b06df4f), and moq-dev/hang.live#28 carried it over unchanged. The position-only settling came from moq-dev/hang.live#46, which knowingly left this replay case. It wasn't a mistake there; this PR adds the wire change it needed.

Follow-ups

None.

Validation

  • quest gate just check passes: quest check, tsc, biome, and API, app (55), and media (2) tests. media.browser.ts didn't flake.
  • New unit tests in peers.test.ts (ID settling, superseded echoes, staying in place, legacy fallback, Inbox apply-once/echo/close) and metadata.test.ts (serve→consume round trip; handle/applied hidden when not movable; peers.positions unaffected).
  • Real surface: just dev with two tabs in @rctest as different guests (Y, Z), driven by agent-browser. I logged each tab's published hang/location.json by hooking the live @moq/json snapshot producer (no code change):
    1. Both on: Z drags Y. Z sends {…, id}, Y applies the position and echoes applied:[id], Z drops the request, Y clears the echo.
    2. Y turns Remote Control off in Settings. Y publishes no handle/applied. In Z, Y's tile doesn't move under a drag and no request is sent.
    3. Y (still off) drags Z. The request is sent, applied, echoed and dropped.
    4. Y asks Z to stay where it is (drag out and back). Z echoes without changing position and Y drops the request (previously skipped or left pending).
    5. Y turns it back on, and a fresh handle appears (h145p42meje → off → jnbe4raklda).
    6. Q is mid-drag on P's tile when P locks. Q keeps moving and releases: no request is sent, and P's tile goes back to P's published placement, or to its pre-gesture spot for a never-moved P. The cursor resets.
  • The drag→pinch fix (space.ts:324) is covered by just check (tsc, biome, tests) only: it's a touch-only path and wasn't driven in a browser.
  • Round-2 fixes, same setup in @rciter (Y, Z):
    7. Rejected pending move: Y's Inbox.receive stubbed so it never applies. Z drags Y's tile and releases; Z publishes the request on its camera track. Y turns Remote Control off: Z drops the request and Y's tile returns to its pre-drag spot (Y never published a placement).
    8. One carrier: Z starts a (canvas-backed) screen share, then drags its camera (z 7) and Y (z 8) above the share. The request still goes out on the camera's location.json (huxv3zodmoi); before, the lowest-z broadcast (the share) carried it.
    • The pinch-lock handoff fix (space.ts:444) is touch-only and covered by just check only. Space has no unit harness (it needs WebGL, audio, and MoQ watch sources), so the new unit test covers Peers.drop reporting a pending move.

Models

  • Size: M
  • Implementer: Claude Code, claude-opus-5-5, high
  • Implementer: Claude Code, claude-opus-5-5, unknown (iterate, M)
  • Implementer: Claude Code, claude-opus-5-5, unknown (iterate, M)

🤖 Generated with Claude Code

(Written by Claude Opus 5.5 with high)

Review

Rewritten by quest review after each round.

  • Head: d096efc

  • Base: origin/main at d2b6c61

  • 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: 01a21689-00f2-76e0-9054-851f8236fe02, round 3

  • Score: 10/10, Both earlier findings are fixed, and the follow-up introduces no new findings.

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

  • Findings: none

  • The last round's findings, at 8502ae7:

    • Fixed: medium, app/src/room/space.ts:587: Restore every edited field when locking rejects a pending move; At app/src/room/space.ts:589, rollback overlays the advertised fields on the saved placement, so an omitted scale returns to its pre-move value.
    • Fixed: medium, app/src/room/space.ts:445: Clear pinch state when a lock cancels the gesture; At app/src/room/space.ts:579, lock cleanup clears the active drag and resets both pinch baseline values, so the next gesture cannot reuse them.

kixelated and others added 3 commits November 25, 2026 21:31
Quest-Claim: 33852c086e31fe30
Turning off Remote Control now hides your window handle, so peers see
your tile as locked, and ignores the moves peers ask of you. Dragging
others no longer depends on your own setting.

Each peer move carries an ID the moved peer echoes in `window.applied`,
so a move that lands where the peer already is still settles instead of
replaying later. Both fields are optional: older peers ignore them and
are still settled by matching position.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Make the Remote Control setting stop others from moving you fix(room): make Remote Control stop others from moving you Nov 26, 2026
kixelated and others added 2 commits November 25, 2026 21:51
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…id-gesture lock

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

Copy link
Copy Markdown
Collaborator Author

Maintainer decision (via /quest-run): fix the remaining pinch-lock finding as the reviewer recommends, by re-saving the drag's starting spot at app/src/room/space.ts:324 only when the target tile changes. Then run a fresh review round and mark the PR ready.

(Written by Claude Opus 5.5 with high)

Re-grab only when the pinch targets a different tile, so a lock during
a drag-then-pinch restores the tile's original spot instead of the drag
preview. A drag on another tile is published before the pinch takes over,
matching the touch-handoff path.

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

Copy link
Copy Markdown
Collaborator Author

Applied the decision in 1f07e63: the pinch start at app/src/room/space.ts:324 re-grabs only when the target tile changes, so a lock mid-pinch restores the pre-gesture spot. When the pinch moves to a different tile, the dragged tile's position is published first, matching the touch-handoff path.

(Written by Claude Opus 5.5)

@kixelated
kixelated marked this pull request as ready for review November 26, 2026 06:19
@coderabbitai

coderabbitai Bot commented Nov 26, 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 23 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: dc92e8ce-de79-43f6-bc8e-416b5a981e0c
Commits

Reviewing files that changed from the base of the PR and between d2b6c61 and d096efc.

Files selected for processing: 9

  • app/src/room/index.ts
  • app/src/room/local.ts
  • app/src/room/metadata.test.ts
  • app/src/room/metadata.ts
  • app/src/room/peers.test.ts
  • app/src/room/peers.ts
  • app/src/room/space.ts
  • app/src/settings.tsx
  • quest/m1/remote-control.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

Resolve an import conflict with #49 in app/src/room/index.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated and others added 2 commits November 25, 2026 22:33
…pinch on lock

- A lock that drops a still-pending move puts the tile back at the peer's
  published placement, or where it sat before our moves.
- All peer moves go through the earliest-added local broadcast (the camera),
  so a z-order change can't split them across tracks and replay an older one.
- Lifting a finger after a lock ended the pinch no longer starts a drag on
  another tile.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated merged commit 6a3af10 into main Nov 26, 2026
3 checks passed
@kixelated
kixelated deleted the quest/m1/remote-control branch November 26, 2026 06:45
kixelated added a commit that referenced this pull request Nov 26, 2026
…t it

Space's drag, wheel, touch, pinch, and lock handling moves into
room/gesture.ts, which Space feeds canvas-relative points. The suite
covers the #51 cases: a drag turning into a pinch keeps its home, a lock
ends the gesture and drops its pinch baseline, a rejected move restores
the home under the peer's placement, and a re-grab with a move pending
keeps the older home.

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