Skip to content

feat(revyl): set device settings and keep idle sessions alive - #4725

Merged
thymikee merged 3 commits into
callstack:mainfrom
KayaanT:revyl-device-settings
Nov 19, 2026
Merged

thymikee merged 3 commits into
callstack:mainfrom
KayaanT:revyl-device-settings

Conversation

@KayaanT

@KayaanT KayaanT commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Three changes to the Revyl plugin, one commit each:

  • Device settings and orientation (db1110c). settings now drives Revyl's worker actions instead of refusing:
    • appearance light / dark / toggle (toggle reads the current appearance first)
    • location set <lat> <lon>
    • permissions through /set_permissions, using Maestro's names (media-library is sent as medialibrary). location-always, contacts-limited and --mode are refused, because the worker has no equivalent.
    • clear app state, and reset keychain on iOS.
    • Orientation takes all four sides on workers that report supports_precise_orientation (Android). On iOS it takes portrait and landscape-left only; landscape-left maps to the worker's landscape.
    • Location on / off and the other sides on iOS fail with UNSUPPORTED_OPERATION instead of reporting success. The capability matrix and website/docs/docs/revyl.md are updated to match.
  • Session keep-alive (1aed016). A connected session reads the worker's appearance once a minute, which marks the worker active, so a pause between commands no longer ends the session. Sessions now ask for a 5-minute idle timeout instead of 30, so a device left behind by a process that exits without disconnecting is released sooner. The timer is unrefed, skips a beat while a read is in flight, and is cleared before /stop.
  • Server errors on status reads (d98560f). A single 500 from Revyl on the worker-connection read ended a device start, and one on install_status ended an install the worker was still running. Neither read changes anything:
    • the readiness loop treats a 5xx on worker-connection as "not ready yet" and keeps polling within its deadline;
    • install_status replays a 500, as hierarchy already does.
    • Other statuses, such as a 403, still fail at once.

Validation

  • Live, on Revyl's production Android emulators and iOS simulators, through the JS client:
    • appearance, all four Android orientations, iOS landscape-left (screenshot confirmed), location set, permissions, clear-app-state and reset-keychain;
    • the refusals named above.
  • Live through e2e's mobile engine with this build linked in, both passing:
    • Pixel 7: location permission, dark/light, all four orientations, setLocation;
    • iPhone 16: photos permission, dark/light, landscape-left, setLocation, clearKeychain.
  • Keep-alive: an Android session held with no commands for 7 minutes, past the 5-minute idle timeout, still answered a screenshot, then released.
  • Server errors: the two 500s were seen on live runs. New tests (runtime-transient-reads.test.ts, revyl-client.test.ts) fail without the fix.
  • pnpm check:quick, pnpm check:capabilities-matrix, pnpm check:doc-prose, and the provider-revyl unit project pass.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff

KayaanT and others added 3 commits November 18, 2026 22:59
The Revyl worker has device actions for orientation, appearance, location, permissions, app state, and the iOS keychain. The plugin now admits them instead of refusing the whole orientation and settings families:

- orientation: every side on a worker that reports supports_precise_orientation (Android); portrait and landscape-left on one that does not (iOS). Unlock still refuses.
- settings appearance light|dark|toggle, location set <lat> <lon>, permission (Maestro names), clear-app-state, and reset-keychain on iOS. location on|off, airplane, wifi, and the other settings still refuse.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
A connected Revyl session now reads the worker appearance once a minute, which marks the worker active, so a pause between commands no longer ends it. Sessions ask for a 5 minute idle timeout instead of 30, so a device left behind by a process that exits without disconnecting is released sooner.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
A 500 from Revyl on the worker-connection read ended a device start, and one on install_status ended an install the worker was still carrying out. Both reads change nothing, so the start keeps polling within its deadline and the install status read is replayed, the way the hierarchy read already is.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@thymikee

Copy link
Copy Markdown
Member

Thanks, this is ready: I found no problems in d98560f. The one failing check is the SIGTERM test in scripts/check-affected/command-execution.test.ts, which reads its own execution JSON before the child finishes writing it. That looks like a timing race in the validation-lock tooling and not in this diff, so that job has been re-run. There are no conflicts.

Not blocking, and you can take or leave these: the 403 case in runtime-transient-reads.test.ts could assert the AppError code and details.providerStatus === 403, so a fixture or deadline failure does not pass it; orientation support in interactor.ts is keyed on the worker's supports_precise_orientation flag, while the docs and refusal text describe it per platform, so an Android worker that omits the flag would get the iOS map; the keep-alive in revyl-session.ts could stop its interval when isRevylSessionGone matches; and one test that calls setSetting through bindRevylRuntime would cover the admitted binding. The live validation of settings, orientation and the 7-minute keep-alive comes from the PR body. Could you confirm the daemon lease also outlives a long idle pause? That backs the "a pause between commands does not end it" sentence in revyl.md.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 19, 2026
@thymikee
thymikee merged commit c3a3316 into callstack:main Nov 19, 2026
17 of 18 checks passed
KayaanT added a commit to KayaanT/agent-device that referenced this pull request Nov 19, 2026
…ntation docs to the worker

From the callstack#4725 review: a test now calls setSetting through the live binding, so the admitted settings operation is covered end to end, and the docs describe four-sided orientation as following the worker's precise-orientation report, as the code does, rather than the platform.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@KayaanT

KayaanT commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @thymikee. I took all four notes in #4772:

  • The 403 test now asserts UNAUTHORIZED with providerStatus 403.
  • The keep-alive clears its timer once Revyl reports the session gone.
  • A test now calls setSetting through the live binding.
  • revyl.md now ties four-sided orientation to the worker's precise-orientation report, as the code does.

On the idle pause: I held a live Android session with no commands for 7 minutes, past the 5-minute idle timeout, with a 600 s lease TTL. A screenshot still worked afterwards. That run checked the Revyl side. On the daemon side, a lease lasts as long as its TTL or its holder's renewals; e2e renews every 20 s. A CLI user who leaves a session idle past the lease's own TTL still loses the lease, so the revyl.md sentence is about Revyl's idle timeout, not the daemon lease. I can make that distinction explicit in the doc if you'd like.

thymikee pushed a commit that referenced this pull request Nov 20, 2026
* feat(revyl): export the session id a lease runs under

A test runner that calls Revyl's API beside the plugin, such as e2e recording a session's video, has to name the session the plugin started. The id is derived from the lease id; exporting revylSessionIdForLease from the package lets that runner use the same derivation instead of copying it.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* feat(revyl): answer settings location on, since Revyl devices keep it on

Revyl starts every device with location services on (Settings > Location shows "Use location" on for a fresh Android emulator) and has no action that switches them off, so location on is already true. It now succeeds without a request instead of refusing, which lets a caller that switches location on before a fix, as e2e does on Android, set the fix. location off still refuses.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(revyl): stop the keep-alive once Revyl reports the session gone

A keep-alive read answered with Revyl's no-such-session kept beating for the rest of the process. It now clears its timer. The 403 worker-connection test also asserts the typed error, so a fixture or deadline failure no longer passes it.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test(revyl): cover settings through the runtime binding, and key orientation docs to the worker

From the #4725 review: a test now calls setSetting through the live binding, so the admitted settings operation is covered end to end, and the docs describe four-sided orientation as following the worker's precise-orientation report, as the code does, rather than the platform.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(revyl): answer location on only on Android

On iOS, location on|off is the session app's location grant, which the plugin does not set, so it refuses there again instead of reporting success. Android keeps answering on without a request, now returning nothing as the local Android toggle does. The docs scope the sentence to Android and point iOS to settings permission grant location.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(revyl): keep the session id in device.ts so the entry evaluates no new module

Exporting revylSessionIdForLease from the package entry pulled
session-identity.ts into its eager closure, which the closure budget gate
refuses. The derivation now lives in device.ts, which the entry already
evaluates, with its tests in device.test.ts.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants