Repository navigation
docs(commands): publish caller-visible outcomes, not tuned constants - #4756
Conversation
The back, keyboard, orientation, and fold sections of commands.md, the back/keyboard facet descriptions, and the foldable help topic now state what a caller sees: budgets the caller sets, flags, and published reason codes. Internal tuned constants (read intervals, confirmation windows, the screen-diff grid and thresholds, the dismiss-control band, hinge-read pacing) stay only in apple/runner/RUNNER_PROTOCOL.md under their Swift symbol names, so heuristic retunes stop forcing docs commits.
Size Report
Startup median (7 runs, lower is better):
|
Apex Sentinel · ✅ Approve · review of
|
| Where | Finding |
|---|---|
packages/command-surface/src/system/index.ts:322 |
Keyboard schema now claims a visible keyboard always reports returnKey and its label |
packages/command-surface/src/system/index.ts:322 |
keyboard status description changed "can include returnKey" to "reports returnKey" |
website/docs/docs/commands.md:130 |
Runner diagnostic found=unprovable no longer documented for callers |
website/docs/docs/commands.md:130 |
commands.md drops the found=unprovable runner-log marker without moving it anywhere |
website/docs/docs/commands.md:138 |
Orientation picker-offset mapping caveat removed from user docs with no owning home |
website/docs/docs/commands.md:138 |
orientation docs drop the "new multi-panel model needs its own mapping" limitation |
Reviewed with this repository's own Sentinel configuration (7b6500cd2da2).
💬 Talking to Sentinel
In a finding's thread, reply with:
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
There was a problem hiding this comment.
Apex Sentinel: 6 new findings on b86ad30. The verdict and the full list are in the summary comment.
| 'Open the device app switcher to inspect or change foreground apps. This changes the visible system UI and may move focus away from the current app.'; | ||
| const keyboardCommandDescription = | ||
| 'Read the software keyboard state with status (alias get). A visible keyboard can include returnKey and its localized accessibility label. An unreadable Apple keyboard state reports OBSERVATION_UNAVAILABLE. Enter (alias return) sends Return to the focused input. The app may submit, move focus, or insert a newline. On the native iOS runner, dismiss succeeds as a no-op when the software keyboard is hidden. A visible keyboard returns keyboard_dismiss_unavailable with dispatched: no. Press the visible Hide Keyboard key or an app control that ends editing. If the app supports interactive dismissal, use gesture pan to drag a finger down from inside its scrollable content and verify with status. Android dismiss sends its platform dismissal action.'; | ||
| 'status (alias get) reads the keyboard state; a visible keyboard reports returnKey and its label. Unreadable Apple keyboard state reports OBSERVATION_UNAVAILABLE. Enter (alias return) sends Return to the focused input; it may submit, move focus, or insert a newline, and unconfirmed delivery reports keyboard_return_unavailable with dispatched: unknown (Return may have landed). On the native iOS runner, dismiss is a no-op when the keyboard is hidden; a visible keyboard returns keyboard_dismiss_unavailable with dispatched: no. Press the visible Hide Keyboard key or an app control that ends editing, or gesture pan down from the scrollable content with interactive dismissal, and verify with status. Android dismiss sends platform dismissal.'; |
There was a problem hiding this comment.
🟡 Minor · Keyboard schema now claims a visible keyboard always reports returnKey and its label
keyboard status on a visible keyboard whose Return key exposes only an accessibility label returns returnKey: unknown and omits the label, yet the new schema text states flatly that "a visible keyboard reports returnKey and its label" — an agent reading those fields unconditionally gets a contract violation. RUNNER_PROTOCOL.md keeps the exception. The rewrite also drops "localized" from the label, which is the property that makes the value locale-dependent.
| 'status (alias get) reads the keyboard state; a visible keyboard reports returnKey and its label. Unreadable Apple keyboard state reports OBSERVATION_UNAVAILABLE. Enter (alias return) sends Return to the focused input; it may submit, move focus, or insert a newline, and unconfirmed delivery reports keyboard_return_unavailable with dispatched: unknown (Return may have landed). On the native iOS runner, dismiss is a no-op when the keyboard is hidden; a visible keyboard returns keyboard_dismiss_unavailable with dispatched: no. Press the visible Hide Keyboard key or an app control that ends editing, or gesture pan down from the scrollable content with interactive dismissal, and verify with status. Android dismiss sends platform dismissal.'; | |
| 'status (alias get) reads the keyboard state; a visible keyboard reports returnKey and its localized label when the Return key exposes an identifier, and returnKey unknown with no label when it exposes a label only. Unreadable Apple keyboard state reports OBSERVATION_UNAVAILABLE. Enter (alias return) sends Return to the focused input; it may submit, move focus, or insert a newline, and unconfirmed delivery reports keyboard_return_unavailable with dispatched: unknown (Return may have landed). On the native iOS runner, dismiss is a no-op when the keyboard is hidden; a visible keyboard returns keyboard_dismiss_unavailable with dispatched: no. Press the visible Hide Keyboard key or an app control that ends editing, or gesture pan down from the scrollable content with interactive dismissal, and verify with status. Android dismiss sends platform dismissal.'; |
Details
persona: javascript, maintainability
Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.
Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.
| 'Open the device app switcher to inspect or change foreground apps. This changes the visible system UI and may move focus away from the current app.'; | ||
| const keyboardCommandDescription = | ||
| 'Read the software keyboard state with status (alias get). A visible keyboard can include returnKey and its localized accessibility label. An unreadable Apple keyboard state reports OBSERVATION_UNAVAILABLE. Enter (alias return) sends Return to the focused input. The app may submit, move focus, or insert a newline. On the native iOS runner, dismiss succeeds as a no-op when the software keyboard is hidden. A visible keyboard returns keyboard_dismiss_unavailable with dispatched: no. Press the visible Hide Keyboard key or an app control that ends editing. If the app supports interactive dismissal, use gesture pan to drag a finger down from inside its scrollable content and verify with status. Android dismiss sends its platform dismissal action.'; | ||
| 'status (alias get) reads the keyboard state; a visible keyboard reports returnKey and its label. Unreadable Apple keyboard state reports OBSERVATION_UNAVAILABLE. Enter (alias return) sends Return to the focused input; it may submit, move focus, or insert a newline, and unconfirmed delivery reports keyboard_return_unavailable with dispatched: unknown (Return may have landed). On the native iOS runner, dismiss is a no-op when the keyboard is hidden; a visible keyboard returns keyboard_dismiss_unavailable with dispatched: no. Press the visible Hide Keyboard key or an app control that ends editing, or gesture pan down from the scrollable content with interactive dismissal, and verify with status. Android dismiss sends platform dismissal.'; |
There was a problem hiding this comment.
🟡 Minor · keyboard status description changed "can include returnKey" to "reports returnKey"
A caller reading the published schema treats returnKey as always present on a visible keyboard and asserts on it; the runner can answer a visible keyboard without a return key or without an accessibility label, making the documented contract wrong. The compression turned "can include" into "reports", changing an optional field into a required one with no code change, and also dropped the "localized" qualifier that told callers the label is locale-dependent.
| 'status (alias get) reads the keyboard state; a visible keyboard reports returnKey and its label. Unreadable Apple keyboard state reports OBSERVATION_UNAVAILABLE. Enter (alias return) sends Return to the focused input; it may submit, move focus, or insert a newline, and unconfirmed delivery reports keyboard_return_unavailable with dispatched: unknown (Return may have landed). On the native iOS runner, dismiss is a no-op when the keyboard is hidden; a visible keyboard returns keyboard_dismiss_unavailable with dispatched: no. Press the visible Hide Keyboard key or an app control that ends editing, or gesture pan down from the scrollable content with interactive dismissal, and verify with status. Android dismiss sends platform dismissal.'; | |
| 'status (alias get) reads the keyboard state; a visible keyboard can report returnKey and its localized accessibility label. Unreadable Apple keyboard state reports OBSERVATION_UNAVAILABLE. Enter (alias return) sends Return to the focused input; it may submit, move focus, or insert a newline, and unconfirmed delivery reports keyboard_return_unavailable with dispatched: unknown (Return may have landed). On the native iOS runner, dismiss is a no-op when the keyboard is hidden; a visible keyboard returns keyboard_dismiss_unavailable with dispatched: no. Press the visible Hide Keyboard key or an app control that ends editing, or gesture pan down from the scrollable content with interactive dismissal, and verify with status. Android dismiss sends platform dismissal.'; |
Details
persona: senior-developer
Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.
Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.
| - On iOS, `back` first looks for the navigation bar's system back button (a button with the identifier `BackButton` inside a navigation bar, or, when none is, one floating below it, such as on the iPhone Duo). It presses that button only when exactly one live, hittable one is found, the app's accessibility tree is readable (it is not read when XCTest could not query it earlier in the session), and the bar state has held still, so a screen that is still being pushed is not taken for the screen to go back from. It succeeds once one of these changes after the tap: the number of navigation bars, the number of back buttons (for example, the button is gone at the root screen), or a back button's title. A back button with no title of its own, such as the Duo's floating one, is confirmed by its navigation bar's title instead; when no bar has a title, or a title keeps changing, that button is not pressed and `back` swipes. If none changes, it reports `back_swipe_unverified` and does not swipe. For a back button that has its own title, a bar's title never counts, because a title can update itself, such as a countdown timer. A back button that only moves never counts either, because a tap that goes nowhere can still move it, such as when a large title collapses. So a pop that leaves the back button as it was, for example between two screens whose back buttons show the same title (such as an app that titles every back button "Back"), also reports `back_swipe_unverified`. A back button whose own title updates itself, or a navigation bar that retitles itself under a back button with no title, can still be misread as a navigation. When an XCTest query hangs, `back` sends nothing more: before the tap it reports `back_swipe_not_dispatched`, and after the tap `back_swipe_unverified`. Only the system back button counts: a custom bar button titled "Back", or a "Back" button in a toolbar, is never pressed. With no such button, with two or more (such as a sheet over a stack), when the tree cannot be read, when the bar state does not hold still, or when the tap is refused before it is sent, `back` is the left-edge back swipe, with or without `--in-app` or `--system`. When XCTest cannot resolve the app's window, the swipe samples the device's only screen: on a single-screen iPhone, or on an iPad only while the app provably fills its screen; otherwise it refuses with `APP_SCREEN_UNRESOLVED`. The swipe succeeds only when the app's screen changes after it; a small spinner may not count as a change, while a larger animation can. Before it swipes, `back` waits for the screen to stop changing; a screen that repaints on its own never settles, and `back` reports `back_swipe_unverified`. A screen that changes on its own right around the swipe can be misread as a back navigation; verify with `snapshot` when the screen has auto-advancing content. | ||
| - `reason: back_swipe_no_change`: the swipe was sent and the screen did not change. `details.dismissControls` then lists the controls that can leave the screen: the hittable buttons in the top band of the app window whose label or identifier is Back, Close, Cancel, or an `xmark` icon name, in any letter case. Done, Save, and other labels are never listed. Each entry is `{ selector, label, identifier? }`. Press one with its selector, for example `agent-device press 'role=button label="Close"'`; no new snapshot is needed. The selector is `role=button label="…"` when the label is the dismiss word, and `role=button id="…"` when only the identifier is. Only controls in the app window that `back` swiped are listed. A control whose label or identifier another button in any of the app's windows shares (compared without letter case or extra spaces) is not listed, because its selector would match both. `back` cannot return refs, because it expires the snapshot's refs before it swipes. When there is exactly one control, the hint names it. The field is absent when there is no control, when the app's tree cannot be read, or when the read fails or hangs. `back` never presses these controls itself, because Close or Cancel can discard a draft or end a flow. | ||
| - `reason: back_swipe_unverified`: the back button was pressed but the navigation bar's back buttons (or, for a back button with no title, the bar's title) did not change after the tap or an XCTest query hung after it, or the swipe may or may not have navigated, because the screen kept changing before the swipe, the swipe took longer than the screen had been still, or the screen could not be sampled after it. Check with `snapshot`. A real pop on a stack of three or more screens also answers this when the outgoing and incoming back buttons share a label. | ||
| - `reason: back_swipe_not_dispatched`: the swipe was refused before any touch went down, or an XCTest query hung before the back button tap, so nothing reached the device. |
There was a problem hiding this comment.
🟡 Minor · Runner diagnostic found=unprovable no longer documented for callers
A back button with no title under bars with no title means the pop cannot be confirmed and back swipes, emitting found=unprovable in the runner log, but the back section of commands.md no longer explains that field — the user docs no longer give a caller-facing meaning for it. The iOS bullet still describes the swipe behavior without naming the log marker.
Details
persona: senior-developer
Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.
Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.
| - On iOS, `back` first looks for the navigation bar's system back button (a button with the identifier `BackButton` inside a navigation bar, or, when none is, one floating below it, such as on the iPhone Duo). It presses that button only when exactly one live, hittable one is found, the app's accessibility tree is readable (it is not read when XCTest could not query it earlier in the session), and the bar state has held still, so a screen that is still being pushed is not taken for the screen to go back from. It succeeds once one of these changes after the tap: the number of navigation bars, the number of back buttons (for example, the button is gone at the root screen), or a back button's title. A back button with no title of its own, such as the Duo's floating one, is confirmed by its navigation bar's title instead; when no bar has a title, or a title keeps changing, that button is not pressed and `back` swipes. If none changes, it reports `back_swipe_unverified` and does not swipe. For a back button that has its own title, a bar's title never counts, because a title can update itself, such as a countdown timer. A back button that only moves never counts either, because a tap that goes nowhere can still move it, such as when a large title collapses. So a pop that leaves the back button as it was, for example between two screens whose back buttons show the same title (such as an app that titles every back button "Back"), also reports `back_swipe_unverified`. A back button whose own title updates itself, or a navigation bar that retitles itself under a back button with no title, can still be misread as a navigation. When an XCTest query hangs, `back` sends nothing more: before the tap it reports `back_swipe_not_dispatched`, and after the tap `back_swipe_unverified`. Only the system back button counts: a custom bar button titled "Back", or a "Back" button in a toolbar, is never pressed. With no such button, with two or more (such as a sheet over a stack), when the tree cannot be read, when the bar state does not hold still, or when the tap is refused before it is sent, `back` is the left-edge back swipe, with or without `--in-app` or `--system`. When XCTest cannot resolve the app's window, the swipe samples the device's only screen: on a single-screen iPhone, or on an iPad only while the app provably fills its screen; otherwise it refuses with `APP_SCREEN_UNRESOLVED`. The swipe succeeds only when the app's screen changes after it; a small spinner may not count as a change, while a larger animation can. Before it swipes, `back` waits for the screen to stop changing; a screen that repaints on its own never settles, and `back` reports `back_swipe_unverified`. A screen that changes on its own right around the swipe can be misread as a back navigation; verify with `snapshot` when the screen has auto-advancing content. | ||
| - `reason: back_swipe_no_change`: the swipe was sent and the screen did not change. `details.dismissControls` then lists the controls that can leave the screen: the hittable buttons in the top band of the app window whose label or identifier is Back, Close, Cancel, or an `xmark` icon name, in any letter case. Done, Save, and other labels are never listed. Each entry is `{ selector, label, identifier? }`. Press one with its selector, for example `agent-device press 'role=button label="Close"'`; no new snapshot is needed. The selector is `role=button label="…"` when the label is the dismiss word, and `role=button id="…"` when only the identifier is. Only controls in the app window that `back` swiped are listed. A control whose label or identifier another button in any of the app's windows shares (compared without letter case or extra spaces) is not listed, because its selector would match both. `back` cannot return refs, because it expires the snapshot's refs before it swipes. When there is exactly one control, the hint names it. The field is absent when there is no control, when the app's tree cannot be read, or when the read fails or hangs. `back` never presses these controls itself, because Close or Cancel can discard a draft or end a flow. | ||
| - `reason: back_swipe_unverified`: the back button was pressed but the navigation bar's back buttons (or, for a back button with no title, the bar's title) did not change after the tap or an XCTest query hung after it, or the swipe may or may not have navigated, because the screen kept changing before the swipe, the swipe took longer than the screen had been still, or the screen could not be sampled after it. Check with `snapshot`. A real pop on a stack of three or more screens also answers this when the outgoing and incoming back buttons share a label. |
There was a problem hiding this comment.
🟡 Minor · commands.md drops the found=unprovable runner-log marker without moving it anywhere
An agent seeing found=unprovable in a runner log now has no page explaining that it means an untitled back button under an untitled bar, that the button is not pressed, and that back swipes instead. The bullet was deleted wholesale, so the marker is undocumented rather than de-tuned; it is a caller-visible diagnostic, not one of the literals the PR set out to move into RUNNER_PROTOCOL.md. The matching wording in the same file still describes that no-press-then-swipe path, so the docs now cover the behaviour but not the signal that names it.
Suggested change
Keep a found=unprovable bullet (or fold the marker into the back_swipe_unverified bullet) so the runner log line stays documented; move only the timings and grid thresholds to apple/runner/RUNNER_PROTOCOL.md.
Details
persona: maintainability
Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.
Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.
| - An app with a left-edge drawer may open the drawer instead of going back. When a custom back or close control is visible, press it by its ref. | ||
| - `back --system` sends system back input: the Android back keyevent, the same iOS back as the default, or the tvOS Siri Remote Menu button. macOS has no system back, so it refuses before dispatch. | ||
| - `orientation portrait|portrait-upside-down|landscape-left|landscape-right` works on iOS and Android mobile targets only. On ADB-backed Android it turns auto-rotate off, and the lock persists after the session ends until something turns it back on. In both default and scoped simulator sets, an iPhone Duo classified with more than one integrated panel refuses `portrait-upside-down` and rotates through the fold helper. It succeeds only when the lit panel shows the requested orientation; if it never does, or the simulator never reports a single lit panel, the command fails with `orientation-unverified`. Unresolved guest reads are retried inside the settle loop; an unresolved final read reports `orientation-panel-table-unavailable`. The picker offsets were measured on iPhone Duo; a new multi-panel model needs its own mapping. A simulator classified with one panel, or whose first classification read is unresolved, uses the standard runner rotation. | ||
| - `orientation portrait|portrait-upside-down|landscape-left|landscape-right` works on iOS and Android mobile targets only. On ADB-backed Android it turns auto-rotate off, and the lock persists after the session ends until something turns it back on. In both default and scoped simulator sets, an iPhone Duo classified with more than one integrated panel refuses `portrait-upside-down` and rotates through the fold helper. It succeeds only when the lit panel shows the requested orientation; if it never does, or the simulator never reports a single lit panel, the command fails with `orientation-unverified`. An unresolved final guest read reports `orientation-panel-table-unavailable`. A simulator classified with one panel, or whose first classification read is unresolved, uses the standard runner rotation. |
There was a problem hiding this comment.
🟡 Minor · Orientation picker-offset mapping caveat removed from user docs with no owning home
The sentence telling contributors that a newly classified multi-panel model needs its own offset mapping before fold-helper rotation can be trusted was deleted as if it were a tuned constant, but it is a coverage requirement. It survives only in docs/adr/0025-foldable-apple-panels.md:382, which the new review.md rule does not name as the home for such facts.
Suggested change
Restore the picker-offset mapping caveat in the orientation bullet, or widen the new review.md rule so host-side (TypeScript) tuning names docs/adr/0025 as its home.
Details
persona: javascript
Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.
Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.
| - An app with a left-edge drawer may open the drawer instead of going back. When a custom back or close control is visible, press it by its ref. | ||
| - `back --system` sends system back input: the Android back keyevent, the same iOS back as the default, or the tvOS Siri Remote Menu button. macOS has no system back, so it refuses before dispatch. | ||
| - `orientation portrait|portrait-upside-down|landscape-left|landscape-right` works on iOS and Android mobile targets only. On ADB-backed Android it turns auto-rotate off, and the lock persists after the session ends until something turns it back on. In both default and scoped simulator sets, an iPhone Duo classified with more than one integrated panel refuses `portrait-upside-down` and rotates through the fold helper. It succeeds only when the lit panel shows the requested orientation; if it never does, or the simulator never reports a single lit panel, the command fails with `orientation-unverified`. Unresolved guest reads are retried inside the settle loop; an unresolved final read reports `orientation-panel-table-unavailable`. The picker offsets were measured on iPhone Duo; a new multi-panel model needs its own mapping. A simulator classified with one panel, or whose first classification read is unresolved, uses the standard runner rotation. | ||
| - `orientation portrait|portrait-upside-down|landscape-left|landscape-right` works on iOS and Android mobile targets only. On ADB-backed Android it turns auto-rotate off, and the lock persists after the session ends until something turns it back on. In both default and scoped simulator sets, an iPhone Duo classified with more than one integrated panel refuses `portrait-upside-down` and rotates through the fold helper. It succeeds only when the lit panel shows the requested orientation; if it never does, or the simulator never reports a single lit panel, the command fails with `orientation-unverified`. An unresolved final guest read reports `orientation-panel-table-unavailable`. A simulator classified with one panel, or whose first classification read is unresolved, uses the standard runner rotation. |
There was a problem hiding this comment.
🟡 Minor · orientation docs drop the "new multi-panel model needs its own mapping" limitation
The edited orientation bullet deletes "The picker offsets were measured on iPhone Duo; a new multi-panel model needs its own mapping", leaving no user-facing note that the multi-panel rotation mapping is calibrated per-model. The surviving orientationCommandDescription carries the same per-model behavior without the caveat.
Suggested change
Keep a per-model calibration caveat for the multi-panel orientation path in commands.md (or the owning help topic), phrased as a limitation rather than a constant, e.g. "The multi-panel rotation mapping is calibrated for iPhone Duo; a new multi-panel model needs its own mapping."
Details
persona: senior-developer
Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.
Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.
|
This PR is ready at b86ad30: the help and docs now describe caller-visible outcomes, with no leftover tuned constants. All 20 checks pass. The diff is docs and help text, plus one test string that tracks the help text. No conflicts. Nothing blocks merge. Not blocking, and you can take or leave these: the keyboard text in system/index.ts says a visible keyboard reports Of the open inline threads, the two on the keyboard label still apply (one, two). These four do not apply and can be resolved: r4630314421 ( |
Summary
User-facing docs no longer publish internal tuned constants. The back, keyboard, orientation, and fold sections of
website/docs/docs/commands.md, theback/keyboardfacet descriptions (CLI help + MCP schemas), and the foldable help topic now state caller-visible outcomes only: caller-set budgets, flags, and published reason codes. Removed literals (read spacing, confirmation windows, screen-diff grid and thresholds, dismiss-band percentages, repaint probe, hinge pacing) stay only inapple/runner/RUNNER_PROTOCOL.mdby Swift symbol name. The rule is added todocs/agents/review.md. Touched files: 6.backdescription 1,708 chars; MCP always-loaded 22,400/22,528 B; bench dry-run prompt bytes 479,434.Validation
Tested SHA: b86ad30.
check:affected --run --head b86ad30188: 300 s session cap on this contended host; format, lint, typecheck, layering, fallow, build, vitest-related passed (run yRg3RZ) before the cap stopped it inunit; remaining checks pass individually at this head. CI serialized gate validates the pushed head.