Skip to content

agent-device front answers orientation for an iPhone Duo with an input-helper rotate the Duo ignores #1539

Closed

Description

@sittingmongoose

What happened

On a leased iPhone Duo simulator (iOS 27.3), agent-device orientation landscape-left through the
gateway's agent-device front returns Rotation requested: landscape-left (unconfirmed) with exit 0.
Neither panel turns: agent-device screenshot stays 669x951 (inner panel) or 466x678 (outer panel).

What you expected

The command should reach agent-device. Its fold helper rotates the Duo's lit panel and confirms it from
the panel's orientation. That is what happened before the front began answering orientation (#1109).

How to reproduce

  1. Lease an iPhone Duo simulator (iOS 27.3) through the gateway.
  2. Using the lease's agent-device command, run open com.apple.mobilesafari, then
    orientation landscape-left.
  3. The command exits 0 with "unconfirmed", and screenshot is still portrait. It happens every time.

Environment

simlock 0.7.0 (worker and gateway), agent-device 0.21.36, macOS 27.3 arm64, Xcode 27.3, iOS 27.3
runtime. main at ee19e97 has the same code.

Logs and evidence

  • src/daemon/rotation-refusal.ts: rotationRefusal allows every simulator model that
    isRotatableModel accepts, and "iPhone Duo" is in the iPhone family.
  • src/agent-device/front/orientation.ts: the front then dispatches device.rotate (the input
    helper's orientation event) and replies "unconfirmed".
  • The Duo's guest ignores that event: no panel turns, and the display table's currentOrientation does
    not change.

The local workaround we run refuses rotation for the Duo, so the front forwards the command:

const FOLDABLE_IOS_MODELS = new Set(["iPhone Duo"]);
export function rotationRefusal(leaseId, spec) {
    if (!spec.physical && spec.platform === "ios" && FOLDABLE_IOS_MODELS.has(spec.model)) {
        return new DispatchError("ROTATION_UNSUPPORTED",
            `Lease ${leaseId} is on a foldable ${spec.model} simulator; agent-device rotates it through its fold helper`,
            { class: "phone", leaseId, physical: false, platform: spec.platform });
    }
    // ... unchanged

Results with the workaround:

  • The iPhone Duo gets ROTATION_UNSUPPORTED; the iPhone 17 Pro is unchanged.
  • 3 fresh Duo leases: portrait, landscape-left and landscape-right on the inner panel, portrait on the
    outer panel, and portrait after fold and unfold all exit 0, with matching screenshots (669x951,
    951x669, 466x678).

A device capability such as foldable or multi-display would hold up better than a model list, if
simlock can see one.

Activity

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

    @V3RON
    Contributor

    Reproduction

    Confirmed: this is a Decision, not a defect. The code does what ADR 0053 §4 says ("an iPhone or iPad", by name prefix). That rule is wrong for the Duo, whose guest ignores the input helper's rotation (reporter's evidence).

    src/agent-device/front/orientation.test.ts on bug/1539-repro, "forwards orientation <name> on an iPhone Duo simulator lease to agent-device, through a gateway and on a worker, and device.rotate refuses that lease ROTATION_UNSUPPORTED". Its device.rotate fake calls the real rotationRefusal.

    pnpm exec vitest run --project unit src/agent-device/front/orientation.test.ts
    
    AssertionError: expected undefined to be 'ROTATION_UNSUPPORTED'
     ❯ src/agent-device/front/orientation.test.ts:290:49
        expect(rotationRefusal(leaseId, duo)?.code).toBe("ROTATION_UNSUPPORTED")
    

    Root cause

    src/contract/orientation.ts:24 isRotatableModel accepts every model in the phone family, and "iPhone Duo" starts with iPhone. Both the daemon's rotationRefusal (src/daemon/rotation-refusal.ts:31) and the front's answerOrientation (src/agent-device/front/orientation.ts:67) read it. So the front sends device.rotate, the helper's GSEvent reaches a foldable that ignores it, and the front answers "unconfirmed" instead of forwarding to agent-device's fold helper.

    Simplest fix

    A short ADR narrowing ADR 0053 §4/§5: a foldable iOS simulator (iPhone Duo) is refused ROTATION_UNSUPPORTED. Then isRotatableModel returns false for a FOLDABLE_MODELS set, and rotationRefusal says Lease <id> is on a iPhone Duo simulator; Simlock cannot rotate a foldable simulator (proposed wording; the test pins only the code). Update src/agent-device/AGENTS.md, watching-the-screen.mdx (rotate section, the 422 row), agent-device.mdx:148 and programmatic-client.mdx:144.

    # applied, then git restore'd
    pnpm exec vitest run --project unit src/agent-device/front/orientation.test.ts src/mcp/server-devices.test.ts \
      src/cli/index-update-status-stats.test.ts src/simlock-client/client-pushes.test.ts   # 36 passed
    pnpm exec vitest run --project unit src/daemon/device-rotate.e2e.test.ts               # 7 passed
    

    Alternatives rejected

    • Refuse in rotationRefusal only (reporter's workaround): the front still round-trips to the worker per Duo orientation.
    • Make the input helper rotate the Duo's lit panel: agent-device already does this; it is a feature-sized helper change.
    • A device capability (foldable, multi-display) instead of a model list: the device record holds only the model, so this needs a new driver fact.

    Risk

    • device.rotate, simlock rotate and MCP rotate_device on a Duo go from 200 (does nothing) to 422: a caller-visible change.
    • The model name must match what the iOS driver lists exactly (iPhone Duo).

    Fast track

    • Defect: no — decision: ADR 0053 §4 names every iPhone
    • Fix tried: yes
    • Nothing public added or broken: no — device.rotate on a Duo turns 200 into 422
    • No ADR or rule changed: no — narrows ADR 0053 §4/§5
    • One fix: no — a helper that rotates the Duo keeps simlock rotate working

    Written by an agent.

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

    @V3RON
    Contributor

    Decision

    Take the triage fix: agent-device rotates the Duo, simlock's own rotate refuses it.

    How agent-device rotates a Duo (packages/platform-apple/src/foldable/orientation.ts, agent-device #3968, in 0.21.34 and later, so in our 0.21.36 pin):

    • A simulator with more than one integrated panel is foldable (panel table, not the model name).
    • It runs its fold helper (apple/fold-helper/Fold.m) in the guest through simctl spawn (--set aware) and sends the private orientation-picker-control HID event. XCTest rotation and simlock's GSEvent rotate do nothing on a Duo.
    • The value depends on the lit panel: the inner panel is offset by +90°.
    • It confirms from the lit panel's currentOrientation, else fails orientation-unverified.
    • portrait-upside-down is refused UNSUPPORTED_OPERATION. Needs Xcode 27.1+.

    Simlock change

    • isRotatableModel returns false for iPhone Duo. The agent-device front then forwards orientation on a Duo lease to agent-device, which rotates and confirms it.
    • device.rotate, simlock rotate and MCP rotate_device on a Duo answer ROTATION_UNSUPPORTED (today 200 that does nothing). The message names the foldable and points to agent-device orientation.
    • ADR 0053 §4/§5 narrowed to say so; docs from the triage list updated (src/agent-device/AGENTS.md, watching-the-screen.mdx, agent-device.mdx, programmatic-client.mdx).

    Out of scope: simlock's own rotate turning a Duo (needs a guest helper, panel-table read and per-panel mapping in the iOS driver). A separate spec if someone needs it.

    Written by an agent.

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

    @V3RON
    Contributor

    Delivery run

    Merged: #1730 (#1539)
    Parked: none
    Waiting: none
    Decided: none

    Written by an agent.

  9. added a commit that references this issue on Nov 19, 2026
    c1130b8
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