iOS clipboard sync: one config key read at startup, a rename instead of per-lease restarts
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 52/100
- Type d'issue
- Fonctionnalité
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- ios, typescript
- Domaine
- developer-experience, mobile-dev
Piste de recherche
Start with the leasing flow in src/leasing/create-leasing-label.test.ts and src/leasing/test-create-leasing.ts, then follow the iOS driver tests in src/drivers/ios/index-rename.test.ts, index-device-set.test.ts, boot-deadline.test.ts, and clipboard.test.ts. The issue describes the expected behavior for warm leases, labels, boot handling, and clipboard isolation; the hardware check is in e2e/slow-ios-window.test.ts. Done means those cases pass, including the real-device clipboard check.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Request: #2073
Problem
On a worker that keeps its simulators in Xcode's own device set (drivers.ios.deviceSet: default), Simlock keeps DeviceHub from syncing the Mac clipboard with a lease's simulator. To be sure of that, it restarts simulators that are already running: every warm simulator is shut down and booted again when a lease takes it, and a simulator found already booted at a lease's boot is restarted too.
Those restarts are not needed. DeviceHub, not the simulator, reads the setting, and Simlock already writes it before every simulator's first boot. The restarts make a warm lease as slow as a cold one and tie clipboard isolation to which path booted a simulator.
Who it is for
An operator of a worker under drivers.ios.deviceSet: default, and the agents that lease its simulators.
Outcome
- A lease that takes a warm simulator under Xcode's set gets it without a restart.
- Clipboard isolation holds as before: the setting is on disk before each simulator's first boot.
- A lease with a label still shows the label as the simulator's name, now on a warm simulator in either device set.
How it works for the user
flowchart TD
A[Lease request] --> B{Warm simulator ready?}
B -- no --> C[Write clipboard setting, boot, grant]
B -- yes --> D{Request has except?}
D -- yes --> E[Shut down, boot with the list, grant]
D -- no --> F{Request has a label?}
F -- no --> G[Grant at once]
F -- yes --> H[Rename to the label]
H --> G
H -. rename failed .-> I[Log it, grant anyway]
Before, under deviceSet: default with one warm iPhone 16:
$ simlock lease --platform ios --device "iPhone 16" --label feature-x --detach
(waits for a shutdown and a full boot)
$ simlock events --since 1m | grep lease.granted
... "event":"lease.granted" ... "source":"booted"
After:
$ simlock lease --platform ios --device "iPhone 16" --label feature-x --detach
(returns at once)
$ simlock events --since 1m | grep lease.granted
... "event":"lease.granted" ... "source":"warm"
$ xcrun simctl list devices | grep feature-x
feature-x (<UDID>) (Booted)
Examples
| Lease of a warm iOS simulator | Today | After |
|---|---|---|
| Xcode's set, no label | restart, source: booted |
no restart, source: warm |
Xcode's set, --label feature-x |
restart, named feature-x, source: booted |
renamed feature-x, no restart, source: warm |
simlock set, no label |
no restart, source: warm |
same |
simlock set, --label feature-x |
no restart, name unchanged | renamed feature-x, no restart |
either set, --except <list> |
restart, source: booted |
same |
| rename fails (simulator gone, CoreSimulator hung 5 s) | — | warning in daemon.log, lease granted |
warm Android emulator, --label feature-x |
no restart, name unchanged | same |
What could go wrong
- Clipboards cross for a warm simulator whose setting could not be written before its boot. Today's restart gave that write a second try; now it gets none. Unlikely: the write fails only on Macs that refuse it every time, and
simlock doctoralready warns there. - A warm simulator keeps a label that is not its lease's: the worker stopped, or the grant failed, right after the rename. Rare, and only the displayed name is wrong.
- A future DeviceHub reads the setting at some other moment. The hardware test for a warm lease would fail.
Words used
- Xcode's set: the device set Xcode and DeviceHub show, chosen with
drivers.ios.deviceSet: default. - warm simulator: one the warm pool booted ahead of any lease; its state is
ready. - label: a lease's display name, e.g.
--label feature-x. - claim: a short in-memory hold on one device, so no other request or job acts on it meanwhile.
except: a lease option that keeps named services running on a slim simulator; it needs a boot.
Non-goals
- No config key to leave clipboard sync on.
- No change to how or when the clipboard setting is written, or to what a failed write does.
- No rename used to make DeviceHub read the setting again.
- No change for a lease with
except: it still restarts a warm simulator. - No fix for the hardware test's device-to-Mac check, which passes with sync on; that is its own bug.
Completion conditions
- Under
deviceSet: default, a lease of a warm simulator is granted withsource: warmand no shutdown or boot of that simulator in between. - The same lease is clipboard-isolated from the Mac with DeviceHub running, on real hardware.
- A labelled lease of a warm simulator shows the label in
simctl list, in both device sets. - A simulator already booted when a lease boots it is not shut down.
Open questions
Decisions
- Decided in the session: no config key, because sync always off needs none and nobody asked to keep it on (maintainer).
- Decided in the session: both restarts go and no rename replaces them for the clipboard, because every boot the driver starts is preceded by the setting's write (X8, X9).
- Decided in the session: a labelled lease renames a warm simulator in both device sets (maintainer).
- Decided in the session: a failed rename is logged and the lease is granted, because the name is display only, as at a boot today (X8).
- Decided in the session: the rename runs before the grant under a claim, because nothing but recovery acts on a leased device.
- Decided in the session: a label left on a warm simulator by a stop or a failed grant is not cleaned up, because it is display only; it is a Known gap in the leasing manual.
- Decided in the session: one task, because the change is one path through leasing, core and the iOS driver.
Behaviours
| Id | Behaviour (invoker, action, what it sees) | Seam | Cases | Task |
|---|---|---|---|---|
| B1 | A requester leases a ready virtual device with no except and no label: the driver is not called and lease.granted carries source: warm, whatever the device set. |
createLeasing (src/leasing/create-leasing-label.test.ts:10 builds it; seedReady, src/leasing/test-create-leasing.ts:229, makes the ready device) |
ready iOS device, plain request: no shutdown, makeReady or nameForLease call, source warm; ready slim device, request with except: one shutdown and one makeReady, source booted |
#2079 |
| B2 | A requester leases a ready virtual device with a label: the driver's nameForLease (I1) runs once with the label before the grant, nothing is booted, and lease.granted carries source: warm. |
same as B1, but the "no longer ready" case through the coordinator harness, which swaps the lifecycle (src/leasing/lease-acquisition-coordinator.test.ts:667) |
label, driver has nameForLease: one call with the label, then the grant, source warm; label, driver has none (Android): plain grant, no call; nameForLease rejects: one warning naming a warm device for a waiter failed with step name, lease granted; label with except: the reboot with the label in makeReady, no nameForLease; device no longer ready when the claim is checked: no call, the claim is released and the request plans again |
#2079 |
| B3 | The leasing engine calls the iOS driver's nameForLease: it runs simctl rename <udid> <label> once and resolves. |
IosSimctlDriver: the simlock set cases in src/drivers/ios/index-rename.test.ts:31 (its afterEach, :15-21, requires --set); the Xcode's-set case in src/drivers/ios/index-device-set.test.ts:66 |
simlock set: the command carries --set <root>; Xcode's set: it does not; exit non-zero: resolves, warns could not rename <udid> to <label>: <stderr>; no answer in 5 s: resolves, warns could not rename <udid> to <label>: timed out after 5000ms |
#2079 |
| B4 | The leasing engine prepares an iOS simulator that simctl boot reports already booted: the driver goes on to bootstatus and listapps with no shutdown and no second boot. |
IosSimctlDriver (src/drivers/ios/boot-deadline.test.ts:137, whose runner answers the first boot "already booted") |
Xcode's set, purpose prepare: calls are rename, the setting's write, boot, bootstatus, listapps; purpose recover: the same without rename |
#2079 |
| B5 | The iOS driver under Xcode's set no longer asks for a reboot before a grant. | IosSimctlDriver (src/drivers/ios/index-device-set.test.ts:66 table) |
deviceSet: default and simlock: the driver has no rebootReadyBeforeGrant |
#2079 |
| B6 | Under Xcode's set the clipboard setting is written before every boot the driver starts, as today. | IosSimctlDriver (src/drivers/ios/clipboard.test.ts:119 and its hub fake) |
prepare and recover of a shut-down simulator: the write, then boot, as that test proves today; prepare of one already booted (hub.warm, :227-233): the write, then one boot, no shutdown and no second boot |
#2079 |
| B7 | On real hardware with DeviceHub running, a warm lease under Xcode's set is granted source: warm, is clipboard-isolated, and a labelled one shows its label in simctl list. |
slow lane, e2e/slow-ios-window.test.ts:38 (withDaemon with a warm target, :58) |
warm lease with a label: source is warm, expectClipboardIsolated passes, simctl list devices -j names the simulator by the label; cold lease: as today |
#2079 |
Stored state
| Id | What and where | Created, changed, deleted by | Listed or swept by | A restart mid-step leaves | Schema step | Task | Used by |
|---|---|---|---|---|---|---|---|
| S1 | The simulator's name, kept by CoreSimulator in the device's own record | set at create; changed by a prepare boot (X8) and now by nameForLease (I1); deleted with the simulator at lease end |
simctl list; Simlock reads it nowhere under Xcode's set |
a ready simulator named by a label whose request failed daemon-restarted; nothing cleans it, the next labelled grant or prepare boot renames it |
none | #2079 | #2079 |
Interfaces
| Id | What | Shape and bounds | Errors and limits | Where | Task | Used by |
|---|---|---|---|---|---|---|
| I1 | Driver.nameForLease, optional |
nameForLease?(device: DriverDevice, label: string): Promise<void>; label is the lease label, 1 to 64 characters, no control character, already checked at admission |
never rejects for a failed or hung rename: it warns and resolves; the rename is given up after 5 s, counted from its start (RENAME_TIMEOUT_MS, src/drivers/ios/index.ts:113) |
src/core/driver.ts, implemented in src/drivers/ios/index.ts only. simctl rename takes a Booted simulator in both sets: X15 |
#2079 | #2079 |
| I2 | Plan name-ready |
{ kind: "name-ready"; claim: DeviceOperationClaim; device: VirtualDevice } in AcquisitionPlan; planner input gains nameReady?: boolean; chosen for a ready virtual device when rebootReady is not set and nameReady is; the claim is a grant claim owned by the waiter; GRANT_SOURCE["name-ready"] is warm; its grant carries grantReadyTiming, as grant-ready does (src/leasing/acquisition-workflow.ts:351) |
the plan that picks the device found it unclaimed under the same lock (:126-131), so the claim is free; a claim refused all the same answers as reboot-ready does (:175); not held back by the memory pause, since nothing boots |
src/leasing/acquisition-planner.ts, src/leasing/acquisition-waiter.ts |
#2079 | #2079 |
| I3 | ManagedDeviceLifecycle.nameForLease |
nameForLease(target: VirtualDevice, claim: DeviceOperationClaim, label: string): Promise<{ handoff: ReadyDeviceHandoff; nameError?: unknown } | undefined>; checks the device is still ready and unleased under the grant claim it is given, calls I1, keeps the claim for the handoff; writes nothing to the registry, emits no event and logs nothing (the lifecycle has no logger, :66-72) |
undefined when the device is no longer a ready, unleased one: the claim stays the caller's, and the workflow releases it under the lock and plans again, as continueAfterEviction does (src/leasing/acquisition-workflow.ts:474-484); a rejection from I1 comes back as nameError beside the handoff, and the workflow logs it with outcomes.logFailure (src/leasing/waiter-outcomes.ts:66), message naming a warm device for a waiter failed, step name |
src/core/managed-device-lifecycle.ts, on the lifecycle port in src/leasing/acquisition-ports.ts:80 |
#2079 | #2079 |
Existing code
Commit 4d3c176f.
Searches: rg rebootReadyBeforeGrant src e2e (7 hits), rg refreshBooted src (5 hits), rg 'reboot-ready|rebootsBeforeGrant' src/leasing (8 hits), rg '"boot"' src/drivers/ios and rg bootAndWait src/drivers/ios (3 callers), rg disablePasteboardSync src (4 hits), rg -i 'clipboard|pasteboard' website/src/content/docs (6 hits), rg -i label website/src/content/docs (label lines in 5 pages).
| Id | Code (path:line) | Today | With this feature | Handled by |
|---|---|---|---|---|
| X1 | src/drivers/ios/simulator-boot.ts:55-69 |
on prepare under Xcode's set, a boot answered "already booted" is followed by a shutdown and a second boot (refreshBooted) |
the parameter and the second boot go; "already booted" counts as booted (:38 already accepts it) |
B4 |
| X2 | src/drivers/ios/index.ts:117, :145 |
rebootReadyBeforeGrant is true under Xcode's set |
removed | B5 |
| X3 | src/core/driver.ts:289 |
optional rebootReadyBeforeGrant on Driver |
removed; nameForLease added |
B5, I1 |
| X4 | src/leasing/acquisition-waiter.ts:51-53 |
a ready device reboots before the grant for except or for a driver that asks |
for except only |
B1 |
| X5 | src/leasing/acquisition-planner.ts:170-177 |
a ready device is grant-ready or reboot-ready |
a third outcome, name-ready |
I2, B2 |
| X6 | src/leasing/acquisition-workflow.ts:254-260, :487-519, :397 |
performs reboot-ready through rebootForLease and grants |
also performs name-ready through I3 and grants; passes nameReady when the request has a label and the driver has I1 |
B2 |
| X7 | src/core/managed-device-lifecycle.ts:107-150 |
rebootForLease shuts down and prepares again with the label |
unchanged; serves except only |
B1 |
| X8 | src/drivers/ios/index.ts:402-405, :428-442 |
a prepare boot renames to the label or stored name, logging a failed rename, then writes the clipboard setting before the boot |
unchanged; nameForLease reuses the rename |
B3, B6 |
| X9 | src/drivers/ios/seeds.ts:317, :603 |
a settle copy and a seed's throwaway get the setting before their boot | unchanged | B6 |
| X10 | src/leasing/acquisition-waiter.ts:29-36 |
GRANT_SOURCE maps each granting plan to the event's source |
gains name-ready: warm |
I2 |
| X11 | src/leasing/create-leasing-label.test.ts:22, :42; src/leasing/lease-acquisition-coordinator.test.ts:23; src/drivers/ios/index-device-set.test.ts:163; src/drivers/ios/boot-deadline.test.ts:137; src/drivers/ios/clipboard.test.ts:227-233; the hand-built lifecycle ports at src/leasing/lease-acquisition-coordinator.test.ts:667 and src/leasing/lease-acquisition-coordinator-failed-boots.test.ts:236, :267 |
tests that set or expect the reboot flag and the refresh, or build the lifecycle port by hand | rewritten to the rows' cases; the hand-built ports gain nameForLease |
B1, B2, B4, B5, B6 |
| X12 | e2e/slow-ios-window.test.ts:38-158 |
the warm case leases after a reboot and checks isolation | the warm case leases with a label and no reboot | B7 |
| X13 | src/leasing/AGENTS.md ("A driver requiring a reboot before grant…"), src/drivers/ios/AGENTS.md ("Ready default-set simulators reboot under the claim first.") |
describe the reboot | say what B1 and B2 do; the leasing manual gains the Known gap from S1; docs/internal/flows/device-selection.md:85 drops "or the driver requires a reboot before grant" and gains the rename step |
#2079 |
| X14 | website/src/content/docs/docs/concepts/ios-device-sets.mdx:40, :51; docs/using-devices/keep-a-device.mdx:100; docs/reference/mcp-tools.mdx:69; docs/reference/cli.mdx:144; docs/concepts/leases.mdx:103 |
"booted for the lease takes the label"; "a warm simulator granted without a boot keeps its own name"; "the warning clears after a boot that turns it off" | say a warm simulator takes the label too; the rest stays true | #2079 |
| X15 | simctl rename on a Booted simulator, Xcode 27.2 (27B52), run 2026-12-03 |
xcrun simctl --set <root> rename <udid> feature-x and xcrun simctl rename <udid> feature-x each exit 0, and simctl list devices then prints feature-x (<udid>) (Booted); a deleted UDID exits 148 with Invalid device: <udid> |
what I1 runs | B3, B7 |
| X16 | src/core/fake-driver.ts:50, :147, :805-806 |
FakeDriver has no nameForLease and records only its listed operations in calls |
records a nameForLease operation with its label; a fake built without it stands for a driver that has none (Android) |
B1, B2 |
Tasks
- #2079 iOS: a warm simulator is leased without a restart, and renamed to the lease's label — a warm iOS lease under Xcode's set returns at once, and a labelled warm lease shows its label. Risk: the Mac clipboard reaches a warm lease's simulator, or a labelled warm lease keeps the old name.
Completion conditions, all delivered by #2079: no shutdown or boot before a warm grant (B1); clipboard isolation on real hardware (B7); the label in simctl list in both sets (B2, B3, B7); no shutdown of an already booted simulator (B4).
Open work in the same area:
- #2043 (PR #2058), sandboxed simulators: changes
SimulatorBoot#boot,Driver,FakeDriverandclipboard.test.ts. No Depends on, by the maintainer's decision: whichever lands second resolves the conflict. - #2037 (PR #2054): changes
AcquisitionWorkflow.decideand the planning list indocs/internal/flows/device-selection.md. #2079 depends on it. - #2077 (feature #2070): wraps the same
bootAndWaitcall inIosSimctlDriver.makeReady. #2079 depends on it. - #2038 (PR #2059), warm pool off by default: changes one config line of the warm case in
e2e/slow-ios-window.test.ts, a different place from #2079's change. No Depends on. - #1546 (PR #1547), lifecycle timeouts: touches
src/drivers/ios/index.tsand its manual in other places. No Depends on. - #2065, advisories in the console: reads the advisories this feature leaves as they are. No Depends on.
Written by an agent.
- Langage dominant
- TypeScript
- Étoiles
- 730
- Forks
- 44
- Merge moyen
- 15 h 28 min
- PR mergées (30 j)
- 387
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de callstackincubator/simlock
-
bug:new
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
callstackincubator/simlock#2088 ·
Les mainteneurs répondent en général sous 1 jour
-
bug:new
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
callstackincubator/simlock#2080 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
task:ready
Difficulté 4/5 3-5 jours Accessibilité débutants 52/100
callstackincubator/simlock#2079 ·
Les mainteneurs répondent en général sous 1 jour
-
platform:ios task:ready
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 18/100
callstackincubator/simlock#2078 ·
Les mainteneurs répondent en général sous 1 jour
-
iOS copy: keep the app database at the copy's own UDIDPeut-être pris @V3RON l’a pris aujourd’hui. Ouverteplatform:ios task:ready
callstackincubator/simlock#2077 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de callstackincubator/simlock
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
simstudioai/sim#10710 ·
Les mainteneurs répondent en général sous 1 jour
-
Make the HTTP server's keep-alive and headers timeouts configurablePeut-être pris @mattgodbolt l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
compiler-explorer/compiler-explorer#9902 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 1-3 heures Accessibilité débutants 74/100
juspay/odu#193 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
Les mainteneurs répondent en général sous 1 jour