Repository navigation
Conversation
Add `agent-device lock-screen status` and
`client.command.lockScreen({ action: 'status' })`. It returns the same
`{ action: 'lock-screen', state, message }` shape as lock and unlock,
and changes nothing on the device. Users who migrate from Appium
(`driver.isLocked()`, `mobile: isLocked`) had no way to ask whether
the device is locked.
The action selects a new `lockScreenStatus` runtime cell. It returns
the state, so it is not a system button, but its fact is built by
`systemButtonRuntimeOperationFacts` beside lockScreen and unlockScreen:
every owner that does not name it refuses it, and Android and the
iPhone and iPad simulator name it where they name the other two.
Android reads `isKeyguardShowing` from `dumpsys window`, the read that
lock and unlock verify against. A dump without it refuses with
`lock-screen-state-unreadable` instead of reporting unlocked.
The iOS runner gets a `lockScreenStatus` command that reads
`com.apple.springboard.lockstate` once and answers `data.locked`. It
is a presented-surface query: read-only, replayable, and it does not
bring the session app forward, which would dismiss the lock screen it
reports on. A dark screen that is not locked is unlocked. An
unreadable state answers OBSERVATION_UNAVAILABLE.
The registry classifies `status` as a read: it keeps the ref frame and
records as an observation, and the session journal summarizes it as
the state it read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Describe what `lock-screen status` reads on each platform, that it changes nothing, and that an unreadable state is an error, in the command reference, the client API page, and the runner protocol. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… status `lock-screen status` inherited `androidBlockingDialogGuard: true` from the generic mutating traits. On a local Android session whose app showed an Application Not Responding dialog, the generic route tapped Close app and relaunched the app before it read the keyguard, so a read changed the device. The descriptor field now also takes a resolver of the request, the way `refFrameEffect` does, and `lock-screen` answers false for `status`. Read commands on the interaction route, such as `get` and `is`, already skip the guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`lock-screen status` keeps the ref frame and lock and unlock expire it, but no test failed when the resolver returned may-invalidate for every action. Pin each action beside keyboard, alert, and settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…able hint A dump without isKeyguardShowing reused the lock-settings hint, which sent the caller to dumpsys lock_settings and the current user. A keyguard read, and so every `lock-screen status`, uses neither. Each unreadable read now names the dump it came from. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The iOS scenario answered every lockScreenStatus with locked: true, so a decoder that read a missing field as unlocked still passed. It now also answers locked: false and an answer with no lock state, which must fail with COMMAND_FAILED. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tatus The previous fix kept the per-command blocking-dialog guard away from `lock-screen status`, but while a screen recording ran, the generic route still called the recording's dialog recovery first. With an app ANR on screen, a status read tapped Close app and relaunched the app. A descriptor can now name the requests that must not change the device (`leavesDeviceUntouched`). The generic route runs neither the guard nor the recording recovery for them, and `lock-screen` names `status`. This replaces the request resolver on `androidBlockingDialogGuard`, which covered only the guard. Other commands, `screenshot` included, keep both recoveries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Swift status tests fed lockScreenStatusResponse the shared LockScreenStateRead, including unlockedScreenOff, which the status read never produces. A change that made status read the blanked-screen state too would have passed every test. lockScreenStatusResponse now takes the one SpringBoard notify read the command makes, com.apple.springboard.lockstate, so the tests drive it with the values that read returns: zero, nonzero, and a failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ames The MCP tool loading metadata refuses a searchHint word that the tool description already contains, and the lock-screen description names the keyguard. Keep only the hint words the description lacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
3 issues found across 60 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/contracts/src/system-button-runtime.test.ts">
<violation number="1" location="packages/contracts/src/system-button-runtime.test.ts:83">
P2: This assertion accepts any exception, so it would pass for an unrelated resolver failure or abort and would not prove the fail-closed runtime-contract behavior. Match `COMMAND_FAILED`, `details.reason: 'runtime-contract-invalid'`, and the `lock-screen status` message as the neighboring binding test does.</violation>
</file>
<file name="apple/runner/RUNNER_PROTOCOL.md">
<violation number="1" location="apple/runner/RUNNER_PROTOCOL.md:338">
P2: This description makes `OBSERVATION_UNAVAILABLE` appear to be the failure for every target, but the runner supports `lockScreenStatus` only on iPhone and iPad simulators and returns `HARDWARE_CONTROL_UNAVAILABLE` elsewhere. State the supported targets and the unsupported-target response so callers do not treat this as a readable observation on physical devices or other Apple targets.</violation>
</file>
<file name="packages/contracts/src/system-button-runtime.ts">
<violation number="1" location="packages/contracts/src/system-button-runtime.ts:23">
P3: This new JSDoc sentence is incomplete: `built with the family's.` leaves the reader to infer what the fact is built with. Say that the fact is built alongside the family’s cells.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| new AbortController().signal, | ||
| async () => ({}) as unknown as Interactor, | ||
| ); | ||
| await expect(missing.lockScreenStatus({})).rejects.toThrow(); |
There was a problem hiding this comment.
P2: This assertion accepts any exception, so it would pass for an unrelated resolver failure or abort and would not prove the fail-closed runtime-contract behavior. Match COMMAND_FAILED, details.reason: 'runtime-contract-invalid', and the lock-screen status message as the neighboring binding test does.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/contracts/src/system-button-runtime.test.ts, line 83:
<comment>This assertion accepts any exception, so it would pass for an unrelated resolver failure or abort and would not prove the fail-closed runtime-contract behavior. Match `COMMAND_FAILED`, `details.reason: 'runtime-contract-invalid'`, and the `lock-screen status` message as the neighboring binding test does.</comment>
<file context>
@@ -46,10 +47,40 @@ test('an omitted button reports the family denial, a named one its own cell', ()
+ new AbortController().signal,
+ async () => ({}) as unknown as Interactor,
+ );
+ await expect(missing.lockScreenStatus({})).rejects.toThrow();
});
</file context>
| await expect(missing.lockScreenStatus({})).rejects.toThrow(); | |
| await expect(missing.lockScreenStatus({})).rejects.toMatchObject({ | |
| code: 'COMMAND_FAILED', | |
| message: 'lock-screen status was admitted but its bound interactor has no implementation.', | |
| details: { reason: 'runtime-contract-invalid' }, | |
| }); |
| `lockScreenStatus` reads `com.apple.springboard.lockstate` once and answers `data.locked`, true | ||
| while the lock screen is up. It changes nothing and brings no app forward. A dark screen that is | ||
| not locked answers `false`. A lock state the runner cannot read answers `OBSERVATION_UNAVAILABLE`. |
There was a problem hiding this comment.
P2: This description makes OBSERVATION_UNAVAILABLE appear to be the failure for every target, but the runner supports lockScreenStatus only on iPhone and iPad simulators and returns HARDWARE_CONTROL_UNAVAILABLE elsewhere. State the supported targets and the unsupported-target response so callers do not treat this as a readable observation on physical devices or other Apple targets.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At apple/runner/RUNNER_PROTOCOL.md, line 338:
<comment>This description makes `OBSERVATION_UNAVAILABLE` appear to be the failure for every target, but the runner supports `lockScreenStatus` only on iPhone and iPad simulators and returns `HARDWARE_CONTROL_UNAVAILABLE` elsewhere. State the supported targets and the unsupported-target response so callers do not treat this as a readable observation on physical devices or other Apple targets.</comment>
<file context>
@@ -335,6 +335,10 @@ prompt, which the runner leaves unanswered. Either can follow a dispatch, so the
`lock-screen-secure`. A runtime without XCUIDevice's lock button answers
`HARDWARE_CONTROL_UNAVAILABLE` before pressing anything.
+`lockScreenStatus` reads `com.apple.springboard.lockstate` once and answers `data.locked`, true
+while the lock screen is up. It changes nothing and brings no app forward. A dark screen that is
+not locked answers `false`. A lock state the runner cannot read answers `OBSERVATION_UNAVAILABLE`.
</file context>
| `lockScreenStatus` reads `com.apple.springboard.lockstate` once and answers `data.locked`, true | |
| while the lock screen is up. It changes nothing and brings no app forward. A dark screen that is | |
| not locked answers `false`. A lock state the runner cannot read answers `OBSERVATION_UNAVAILABLE`. | |
| `lockScreenStatus` is supported only on iPhone and iPad simulators. It reads `com.apple.springboard.lockstate` once and answers `data.locked`, true | |
| while the lock screen is up. It changes nothing and brings no app forward. A dark screen that is not locked answers `false`. Other targets answer | |
| `HARDWARE_CONTROL_UNAVAILABLE`; an unreadable lock state on a supported simulator answers `OBSERVATION_UNAVAILABLE`. |
| * returns only once the device reports the requested lock state, and throws otherwise. What | ||
| * returns only once the device reports the requested lock state, and throws otherwise. The third | ||
| * `lock-screen` cell, `lockScreenStatus`, returns the lock state, so it is not a button: its | ||
| * operation and binder sit below the family, and its fact is built with the family's. What |
There was a problem hiding this comment.
P3: This new JSDoc sentence is incomplete: built with the family's. leaves the reader to infer what the fact is built with. Say that the fact is built alongside the family’s cells.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/contracts/src/system-button-runtime.ts, line 23:
<comment>This new JSDoc sentence is incomplete: `built with the family's.` leaves the reader to infer what the fact is built with. Say that the fact is built alongside the family’s cells.</comment>
<file context>
@@ -14,7 +18,9 @@ import type { SnapshotRuntimeExecution } from './snapshot-runtime.ts';
- * returns only once the device reports the requested lock state, and throws otherwise. What
+ * returns only once the device reports the requested lock state, and throws otherwise. The third
+ * `lock-screen` cell, `lockScreenStatus`, returns the lock state, so it is not a button: its
+ * operation and binder sit below the family, and its fact is built with the family's. What
* varies between them is which
* owners carry the control, and that is the fact table's job, not a per-button module's: a
</file context>
| * operation and binder sit below the family, and its fact is built with the family's. What | |
| * operation and binder sit below the family, and its fact is built alongside the family's cells. What |
|
Thanks for adding a read-only lock state check. The answers to these questions decide whether the change fits the project:
At 0233f17, one defect needs a fix. A direct runner Could the status cell stay while the Two high-priority open threads still apply: missing-member test assertion (test strength only) and protocol error-code wording (wording only, as those targets are refused before the runner through the CLI and client). One lower-priority thread also still applies. This thread does not apply and can be resolved: the reason is typed and documented for callers, the help already says an unreported state is an error, and the earlier help never listed this reason for The required evidence is in place. The live Android 16 emulator and iOS 27.2 simulator runs are author-reported without transcripts, at b526a7c, which differs from the reviewed head only in a help The only checks not passing are the two Body rules runs. Both were cancelled, not failed, and they are likely unrelated because they check PR body and commit metadata, which the diff does not touch on that route. The other 16 checks pass. Before merge, the runner must refuse this request on unsupported platforms without activating the app, and the questions on need and design must be answered. |
|
Thanks for the review. Need. The caller is the mobile engine of e2e (
A screenshot shows the lock screen, but a test then needs a model or a pixel heuristic to get a boolean from it. Runner command. It does not need one. The host can read the same notify key with Android recovery. I will delete Threads. The same push will make the test assertion strict and fix the JSDoc sentence. The protocol wording thread goes away with the runner command. I resolved the reason thread, as you suggested. I will wait for your decision on the need before I push. |
Summary
Add
lock-screen statusandclient.command.lockScreen({ action: 'status' }). It returns the{ action: 'lock-screen', state, message }shape oflockandunlockand changes nothing. Appium users (driver.isLocked(),mobile: isLocked) had no way to ask.isKeyguardShowingfromdumpsys window, the readlockandunlockverify. A dump without it fails withlock-screen-state-unreadable.lockScreenStatusrunner command that readscom.apple.springboard.lockstate, without bringing the session app forward.lockandunlock.statuskeeps the ref frame and records as an observation. On Android it runs neither the blocking-dialog guard nor the screen-recording dialog recovery, so an ANR is not closed first.Before / after
Validation
0233f177b,pnpm check:affected --run --base upstream/mainpassed withexactCommit: true. CI owns coverage, Swift runner builds, and smoke lanes.b526a7c25,status → lock → status → unlock → statusreturned unlocked, locked, unlocked on an Android 16 emulator, matchingisKeyguardShowingeach time, and on an iOS 27.2 simulator. The 29 lock-screen and model runner XCTests passed.lockScreenStatusfact, as withshakeandlock.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.