You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
orientation: a foldable in a scoped simulator set is refused, and the fold helper's rotate lands one command late #4343
orientation <portrait|landscape-left|landscape-right> on a foldable iOS simulator in a scoped simulator set (the set simlock leases into) is refused before anything is sent:
Error (UNSUPPORTED_OPERATION): <device> cannot rotate in a scoped simulator set
Hint: CoreDevice resolves only simulators in the default device set, so the rotation of a foldable simulator in a scoped set cannot be verified. Rotate it in the default device set.
So an agent driving a leased iPhone Duo can fold and unfold it, but cannot see the unfolded screen upright (portrait). fold closed|half-open|open works in the same set.
Environment
agent-device 0.21.35 (also present in 0.21.31), driven through simlock 0.4.0
The refusal is the simulatorSetPath guard at the top of the foldable rotation path (the function that calls the fold helper's rotate and then polls devicectl device orientation get). Only the verification needs CoreDevice. The dispatch goes through the fold helper (simctl spawn <udid> <helper> rotate <orientation>), which already honours the scoped set; that is why fold works there.
A local patch that, in a scoped set, sends the rotation through the fold helper and confirms it from the fold helper's panel table (currentOrientation: rot0/rot90/rot180/rot270) instead of CoreDevice does rotate the device: after unfolding, the screen went from 951 x 669 (landscape) to 669 x 951 (portrait).
But the rotation lands one command late: after the first orientation portrait the screen stayed landscape and the panel table still read landscape-right; the next orientation landscape-left produced the portrait screen, and the panel table then read portrait. A second orientation landscape-left again reported the previous value. It looks like the orientation HID event is only applied when the next event arrives. A workaround we are testing is to dispatch the same rotation twice, about 400 ms apart.
Expected
In a scoped set, a foldable rotates on the first command, and the command confirms the new orientation from a source that works in that set (the fold helper's panel table), or says plainly that it was sent but could not be confirmed.
Suggested fix
Replace the up-front refusal for simulatorSetPath with: dispatch through the fold helper, then confirm from the panel table (it already reports currentOrientation).
Find out why the orientation event is applied one event late (flush after the rotate, or follow it with a no-op event), so one command is enough.
Update after testing the workaround: dispatching the same rotation twice (about 400 ms apart) does not fix the lag. The second dispatch sometimes fails with Unable to send the simulator orientation (reason orientation-hid-dispatch-failed), and the screen still shows the orientation from the previous command. A tap after the rotate did not apply it either in one try (standalone web app in front). The panel table's currentOrientation also tracks one step behind, and once read portrait-upside-down while the screen was upright portrait (669 x 951), so the rotN mapping for the Duo's inner panel may differ from the outer one. We reverted to a single dispatch.
Root cause found and fixed locally (agent-device 0.21.35, iPhone Duo, iOS 27.3, Xcode 27.3):
The orientation picker value is relative, not absolute. Each orientation-picker-control event rotates the lit display by (new value - previous value). On the Duo's inner panel the screen orientation equals the picker value plus 90 degrees. Measured over 7 transitions including 180-degree flips. That is why a rotation appeared to land one command late and why repeating the same value did nothing.
The upside-down picker value is spelled pud on the wire.portrait-upside-down is ignored. (The same token appears in serve-sim's Duo HID code.)
Local fix: the fold helper maps portrait-upside-down to pud. The scoped-set rotation path reads the panel table's currentOrientation, dispatches the picker value that produces the needed delta, and re-reads until it matches, so CoreDevice is not needed. Verified on a fresh scoped-set lease: after fold open, orientation portrait gives 669 x 951 on the first command (exit 0), landscape-left and landscape-right give 951 x 669 (panel rot270 / rot90), and a repeated portrait is a no-op success.
Ruled out on the device: devicectl (cannot see a scoped set), Purple GSEvent orientation from guest and host (sent, no effect on the Duo), guest accelerometer HID, and hinge nudges.
Triage: bug; actionable without more input from you. Confirmed on main: the simulatorSetPath guard in packages/platform-apple/src/foldable/orientation.ts refuses before dispatch, although the fold helper already works in a scoped set. Thanks for the measurements: a relative orientation-picker-control value and the pud spelling explain the one-command lag. An agent can pick this up, and a PR with your local fix would also work. It needs the delta dispatch, confirmation from the panel table, and a re-read until the orientation matches.
We started on this and stopped where your measurements end. The picker value is relative, and you measured the inner panel's offset (screen = picker + 90°), but we don't have the outer panel's offset, or what happens to the relationship when the active panel changes. Guessing those could rotate to the wrong orientation. Since you already have a local fix verified on a scoped-set lease, a PR with it would be the fastest path. If that's not possible, please post the outer-panel offset and one transition across a fold/unfold, measured the same way, and we'll implement from that.
Activity
sittingmongoose commentedon Nov 8, 2026
Update after testing the workaround: dispatching the same rotation twice (about 400 ms apart) does not fix the lag. The second dispatch sometimes fails with
Unable to send the simulator orientation(reasonorientation-hid-dispatch-failed), and the screen still shows the orientation from the previous command. A tap after the rotate did not apply it either in one try (standalone web app in front). The panel table'scurrentOrientationalso tracks one step behind, and once readportrait-upside-downwhile the screen was upright portrait (669 x 951), so therotNmapping for the Duo's inner panel may differ from the outer one. We reverted to a single dispatch.sittingmongoose commentedon Nov 8, 2026
Root cause found and fixed locally (agent-device 0.21.35, iPhone Duo, iOS 27.3, Xcode 27.3):
orientation-picker-controlevent rotates the lit display by (new value - previous value). On the Duo's inner panel the screen orientation equals the picker value plus 90 degrees. Measured over 7 transitions including 180-degree flips. That is why a rotation appeared to land one command late and why repeating the same value did nothing.pudon the wire.portrait-upside-downis ignored. (The same token appears in serve-sim's Duo HID code.)Local fix: the fold helper maps
portrait-upside-downtopud. The scoped-set rotation path reads the panel table'scurrentOrientation, dispatches the picker value that produces the needed delta, and re-reads until it matches, so CoreDevice is not needed. Verified on a fresh scoped-set lease: afterfold open,orientation portraitgives 669 x 951 on the first command (exit 0),landscape-leftandlandscape-rightgive 951 x 669 (panel rot270 / rot90), and a repeatedportraitis a no-op success.Ruled out on the device: devicectl (cannot see a scoped set), Purple GSEvent orientation from guest and host (sent, no effect on the Duo), guest accelerometer HID, and hinge nudges.
thymikee commentedon Nov 9, 2026
Triage: bug; actionable without more input from you. Confirmed on main: the
simulatorSetPathguard inpackages/platform-apple/src/foldable/orientation.tsrefuses before dispatch, although the fold helper already works in a scoped set. Thanks for the measurements: a relativeorientation-picker-controlvalue and thepudspelling explain the one-command lag. An agent can pick this up, and a PR with your local fix would also work. It needs the delta dispatch, confirmation from the panel table, and a re-read until the orientation matches.thymikee commentedon Nov 11, 2026
We started on this and stopped where your measurements end. The picker value is relative, and you measured the inner panel's offset (screen = picker + 90°), but we don't have the outer panel's offset, or what happens to the relationship when the active panel changes. Guessing those could rotate to the wrong orientation. Since you already have a local fix verified on a scoped-set lease, a PR with it would be the fastest path. If that's not possible, please post the outer-panel offset and one transition across a fold/unfold, measured the same way, and we'll implement from that.
fix(ios): confirm foldable rotation from the lit panel in either simu…
Merge remote-tracking branch 'origin/main' into fix/settle-diff-view-…