Skip to content

fix(agent-device): accept the leased device's own model as --device - #1807

Open
bheemreddy-samsara wants to merge 1 commit into
callstackincubator:mainfrom
bheemreddy-samsara:bheemreddy-samsara/accept-leased-model-selector
Open

bheemreddy-samsara wants to merge 1 commit into
callstackincubator:mainfrom
bheemreddy-samsara:bheemreddy-samsara/accept-leased-model-selector

Conversation

@bheemreddy-samsara

@bheemreddy-samsara bheemreddy-samsara commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

agent-device open --physical --device <model> leases an enrolled phone, then the next command on that lease is refused with refused: simlock picks the device. ruleDevice accepts --device only when it matches the leased device's name or address, or a catalog model or alias of it. An enrolled phone's model comes from the phone, so the virtual catalog often lacks it.

v0.8.0 gateway, one enrolled Android phone
open --physical --device <model>  -> lease granted, then refused: simlock picks the device
open --physical (no --device)     -> opens, launches an app, returns to the pool

Change

  • namesLeasedModel accepts the leased device's own model, ignoring case, before the catalog lookup. The selector is rewritten to the leased address, so it cannot reach another device. Other models are still refused.
  • agent-device.mdx: the selector bullet and the troubleshooting row say what --device accepts, and that test --device takes names and ids only.

Verification

  • New test in edge-request-rules.test.ts: a phone enrolled as SM-S911U, absent from the catalog, gets snapshot --device sm-s911u as serial with no device; SM-S918U is refused. It fails on main.
  • Agent checks from toolchain.md, the pre-commit jobs and the website build pass.
  • Not rerun on hardware since the fix.

Workflow: not applicable; one selector check on the existing path.

Review

Spec review: skipped. Code review: 2 blocking, 2 fixed, 0 notes. Claims review: skipped.
Rounds: 3. Tokens: n/a.

One independent model review of the full diff, outside this repo's reviewer pipeline. Round 1: the website guide did not describe the accepted selector (fixed). Round 2: the guide implied test --device takes a model (fixed). Round 3: approved.

Written by an agent.

An enrolled phone's model is whatever the phone reports, and it need not
appear in the worker's virtual-device catalog. The front checks a
`--device` selector on a leased session against the leased device's name
or address, then against that catalog, so a client that opens a physical
lease by its model was granted the lease and then refused the very next
command with `refused: simlock picks the device`.

The selector now also matches the leased device's own model, ignoring
case, before the catalog lookup. The lease already fixes which device the
session uses, so naming its own model cannot move the session to another
device; any other model is still refused.
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The request rule now accepts a requested name that matches the leased device’s model, without regard to letter case, before querying the platform catalog. Phone test setup accepts an optional model name, defaulting to “Pixel 8.” Added tests cover forwarding a catalog-absent leased model by serial and refusing a different model. The documentation describes accepted --device identifiers after open and for test.

Suggested reviewers: v3ron

Merge Risk: Minimal · up to d1c03

This change lets a client use a leased phone's own model as --device after open, instead of being refused. Other models are still refused. No concrete merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the leased device's own model is now accepted as --device. It matches the code change in namesLeasedModel and the new test. It is specific enough for a teammate scanni…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states the problem (an enrolled phone's model absent from the catalog causes a refusal after lease), the code change in namesLeasedModel, the docs update, and the verification steps. I…
Full details: Title check

Explanation

The title names the main change: the leased device's own model is now accepted as --device. It matches the code change in namesLeasedModel and the new test. It is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description states the problem (an enrolled phone's model absent from the catalog causes a refusal after lease), the code change in namesLeasedModel, the docs update, and the verification steps. It is clearly related to the changeset, so the check passes.

Finishing Touches

Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: b047a191-f777-4580-b94c-a77f9cbc0ddc
Commits

Reviewing files that changed from the base of the PR and between 215147f and d1c0360.

Files selected for processing: 4

  • src/agent-device/edge-request-rules.test.ts
  • src/agent-device/front/request-rules.ts
  • src/agent-device/test-edge.ts
  • website/src/content/docs/docs/using-devices/agent-device.mdx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@bheemreddy-samsara
bheemreddy-samsara marked this pull request as ready for review November 22, 2026 17:41

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant