Skip to content

iOS driver treats DeviceHub clipboard sync as off when its preference write did not persist #1822

Done

Description

@V3RON

DeviceHubPreferences.disablePasteboardSync (src/drivers/ios/devicehub.ts:76) counts the write as done when defaults import exits 0 (devicehub.ts:67-69). It never reads the value back. On a host where the daemon cannot reach DeviceHub's sandbox container, the import exits 0 and changes nothing. Simlock then boots and grants the simulator with DeviceHub clipboard sync still on, and logs nothing.

Seen on the second Mac (Xcode 27.2) in the slow-lane run from #1580 (lane log /var/folders/rx/c2x4bbm14t30jjs_k9trl_h80000gn/T//simlock-slow-e2e-20261124-152835.log), started over ssh. Read-only checks there, over ssh:

$ defaults export com.apple.dt.Devices -
<dict/>
$ ls ~/Library/Containers/com.apple.dt.Devices/Data/Library/Preferences/
ls: ...: Operation not permitted

On this Mac, from a GUI terminal, the same export shows DevicePreferences and lastSelectedDeviceIdentifier.

The daemon log of that run shows the write was lost. Seed throwaway F5CA288D-… got disablePasteboardSync (seeds.ts:392), and the seed make went on, so the call returned. When the throwaway was deleted, removePasteboardPreference logged could not remove DeviceHub preference for F5CA288D-…: preference deletion failed. The same happened for the leased simulator E2C24057-… at nuke, and for three devices in the warm test. The entry was never there to delete.

The e2e test shows it only as a side effect: DeviceHub selected simulator times out (e2e/slow-ios-window.test.ts:148), because the empty domain has no lastSelectedDeviceIdentifier.

Open question for triage: should disablePasteboardSync read the value back and fail the boot (DriverCrashError) when it is missing? doctor could also check access to the domain.

Found while triaging #1580.

Written by an agent.

Activity

  1. added
    bug:new
    on Nov 24, 2026
  2. self-assigned this
    on Nov 24, 2026
  3. V3RON commented on Nov 24, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Confirmed. bug/1822-repro, src/drivers/ios/clipboard.test.ts: "refuses to boot a simulator, for preparation and recovery alike, when DeviceHub's preferences do not keep the pasteboard sync off". The fake domain's containerBlocked mode exports {} and has the import exit 0 without writing anything. The fake answers PlistBuddy Print the way the real tool does (checked here: false with exit 0, and exit 1 for a missing key).

    pnpm exec vitest run --project unit src/drivers/ios/clipboard.test.ts
    
    × refuses to boot a simulator, for preparation and recovery alike, ...
    AssertionError: promise resolved "{ …(4) }" instead of rejecting
    

    Root cause

    Defect. The docs say "A lease is refused if Simlock cannot turn the sync off" (concepts/ios-device-sets.mdx:40). But #editDeviceHubPreferences (src/drivers/ios/devicehub.ts:67-69) counts the edit as done once defaults import exits 0, and never reads the domain back. When the container cannot be reached, the export is empty, the Add calls succeed on it, and the import writes nothing. So makeReady (index.ts:390) and the seed throwaway (seeds.ts:392) boot with sync on.

    Simplest fix

    Add an optional read-back to #editDeviceHubPreferences. For disablePasteboardSync, after the import it exports again, runs PlistBuddy -c "Print :DevicePreferences:<udid>:pasteboardSyncEnabled", and counts the edit done only when stdout is false. The existing DriverCrashError is unchanged. The helpers that list the exact calls need the two extra calls: clipboard.test.ts, test-slim.ts deviceHubEdit and its callers, and boot-deadline.test.ts.

    Tried: reproduction passes
    pnpm exec vitest run --project unit src/drivers/ios/
    Test Files  34 passed (34)   Tests  769 passed | 1 skipped (770)
    

    Alternatives rejected

    • Warn and boot anyway: this grants a lease the docs say is refused.
    • Read the container plist directly: reading it is the access that fails, and cfprefsd owns the file.
    • A doctor check only: the daemon would still grant leases. It can be added later.

    Risk

    • On a daemon started over ssh (the second Mac), every iOS lease under default is now refused. The maintainer must accept this.
    • Only the fake proves the fix. The one sign that a re-export would show the lost write there is the later failed delete.
    • Each boot runs two more bounded commands.

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: no — iOS leases on an ssh-started daemon go from granted to refused
    • No ADR or rule changed: yes
    • One fix: no — warn-and-boot would change what a user sees

    Written by an agent.

  4. removed their assignment
    on Nov 24, 2026
  5. V3RON commented on Nov 24, 2026

    @V3RON
    ContributorAuthor

    Maintainer decision on the triage report (2026-11-24):

    Approved as proposed: read pasteboardSyncEnabled back after the import and refuse the boot with the existing DriverCrashError unless it reads false. Accepted: on a daemon that cannot reach DeviceHub's preferences (for example one started over ssh), iOS leases under deviceSet: "default" are now refused, as the docs already say.

    Written by an agent.

  6. added
    bug:ready
    and removed
    bug:new
    on Nov 24, 2026
  7. self-assigned this
    on Nov 24, 2026
  8. V3RON commented on Nov 24, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1829 (#1822)
    Parked: none
    Waiting: none

    Written by an agent.

  9. added a commit that references this issue on Nov 25, 2026
    200afe5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions