Skip to content

let your agent control your phone

fix(cloud): say "start/use" not "rent" where the wording covers an iPhone (#168)

shawn panaaf859213de5d
diff --git a/SKILL.md b/SKILL.md
index 952bae8..edfaa94 100644
--- a/SKILL.md
+++ b/SKILL.md
@@ -186,7 +186,7 @@ PY
There are two things. A **phone** is a row in the account catalog (`GET /me`
-> `available`): a label, a platform, an id, and whether it is a temporary
-phone. The service keeps no default phone; a preference is the chooser's. A **session** is one of those phones rented right now.
+phone. The service keeps no default phone; a preference is the chooser's. A **session** is one of those phones running right now.
`cloud ls` prints one row per catalog phone and writes any live session on
that row (`*` is the session this process targets). A session lines up with
the row that has the same device_id or profile_id; a session with neither
@@ -252,8 +252,8 @@ phone-harness cloud open # the dashboard: the user takes the
attach with `--session SID`. Do that; do not start a second one. `409`
`device_unavailable` means the phone is granted but not on its host.
`409` `session_limit` names how many sessions are in use. `503`
- `phones_busy` includes `Retry-After`. `403` `account_blocked` means rentals
- are blocked; a `403` about credit or balance means add credit. A `400` that
+ `phones_busy` includes `Retry-After`. `403` `account_blocked` means the account
+ is blocked from starting phones; a `403` about credit or balance means add credit. A `400` that
names no such phone reprints the catalog.
- **`Not signed in`** means the user runs `phone-harness cloud login` and
approves it in a browser. Relay that; you cannot do it for them.
@@ -268,7 +268,7 @@ phone-harness cloud open # the dashboard: the user takes the
session this command is using expires, the error says `session <sid> expired`.
If the service loses it, the error says the cloud phone failed and is
unreachable. That command stops. It does not drive another phone, and the
- CLI does not rent a replacement. The saved note of that dead session is
+ CLI does not start a replacement. The saved note of that dead session is
removed once the error has been reported, or once `phone-harness cloud` has
shown it once, so later status output does not repeat it. A command that
hits the dead session while that note is still there fails with the same
diff --git a/src/phone_harness/cloud.py b/src/phone_harness/cloud.py
index 11e7757..8493520 100644
--- a/src/phone_harness/cloud.py
+++ b/src/phone_harness/cloud.py
@@ -1,4 +1,4 @@
-"""Phone Harness Cloud: rent a phone, then drive it like any other.
+"""Phone Harness Cloud: start a phone, then drive it like any other.
This module decides which phone exists and who pays for it. It never drives
one. `cloud start` picks an entry from the account catalog (`GET /me` →
@@ -248,7 +248,7 @@ def _explain(e):
if e.status == 401:
return "This machine is signed out. Run: phone-harness cloud login"
if e.status == 403 and e.code == "account_blocked":
- return f"Rentals are blocked on this account ({e})."
+ return f"This account is blocked from starting phones ({e})."
if e.status in (402, 403) and (
e.code in ("insufficient_balance", "balance") or "balance_cents" in e.body
or "credit" in str(e).lower() or "balance" in str(e).lower()):
@@ -399,7 +399,7 @@ def ended_message(rec):
Expiry is named `expired`. Anything else (the service lost the session,
the state file says it is gone) is named `failed` and `unreachable`.
- The CLI does not rent a replacement itself.
+ The CLI does not start a replacement itself.
"""
rec = rec or {}
cause = "expired" if rec.get("cause") == "expired" or _expired(rec) else "unreachable"
@@ -413,7 +413,7 @@ def ended_message(rec):
f"Start the same phone again for longer and continue the task: `{cmd}`. "
"Replace <longer> with a duration longer than the session that just ended "
"(`90s`, `15m`, or a number of minutes). "
- "The CLI does not rent a phone by itself.")
+ "The CLI does not start a phone by itself.")
# Sids whose ended-session message this process has already shown. The copy
@@ -971,7 +971,11 @@ def _logout(args):
def _credit(me):
rate = me.get("price_cents_per_minute") or 0
- minutes = f" (about {me.get('balance_cents', 0) // rate} min)" if rate else ""
+ # A non-metered account (an iPhone subscription) does not spend credit by
+ # the minute, so the balance does not convert to minutes; the MCP skips the
+ # note the same way.
+ metered = me.get("billing_mode") != "disabled"
+ minutes = f" (about {me.get('balance_cents', 0) // rate} min)" if rate and metered else ""
return f"{_money(me.get('balance_cents'))}{minutes}"
@@ -979,7 +983,7 @@ def _print_account(me):
print(f" credit {_credit(me)}")
print(f" phone {_describe_profile(me.get('profile') or {})}")
if not me.get("can_rent", True):
- print(f" access not enabled yet: {me.get('rent_blocked_reason') or 'rentals are closed'}")
+ print(f" access not enabled yet: {me.get('rent_blocked_reason') or 'phones are not available on this account'}")
def _describe_profile(profile):
diff --git a/src/phone_harness/config.py b/src/phone_harness/config.py
index 5333088..293a36d 100644
--- a/src/phone_harness/config.py
+++ b/src/phone_harness/config.py
@@ -82,7 +82,7 @@ DEFAULTS = {
"mirror": True, # open scrcpy during `android awake` if installed
},
"cloud": {
- "minutes": 15, # how long `cloud start` rents a phone for
+ "minutes": 15, # how long `cloud start` keeps a phone for
"max_minutes": 30, # the most one `cloud start` may ask for
"watch": True, # `cloud start` opens the phone's live view in the browser
"phone": "", # what a bare `cloud start` names: a catalog id or label; empty = the service's unnamed start
diff --git a/src/phone_harness/run.py b/src/phone_harness/run.py
index b0d00a4..116841e 100644
--- a/src/phone_harness/run.py
+++ b/src/phone_harness/run.py
@@ -23,11 +23,11 @@ Commands:
phone-harness doctor [ios|android] same diagnosis as --doctor
phone-harness skill print the phone-harness skill text
phone-harness android ... pair/connect/choose an Android phone
- phone-harness cloud ... rent a catalog phone: `cloud login`, `cloud ls`, `cloud start [PHONE]`
+ phone-harness cloud ... start a catalog phone: `cloud login`, `cloud ls`, `cloud start [PHONE]`
phone-harness config ... settings: `config set platform android`
phone-harness update update this install: uv tool upgrade, git pull, or the pip command
---session SID (or PHONE_HARNESS_SESSION) selects one rented phone. With neither,
+--session SID (or PHONE_HARNESS_SESSION) selects one cloud phone. With neither,
a script follows the attached session.
"""
@@ -356,7 +356,7 @@ def _build_parser():
sub.add_parser(
"cloud",
- help="rent a catalog phone",
+ help="start a catalog phone",
add_help=False,
).add_argument("rest", nargs=argparse.REMAINDER, help=argparse.SUPPRESS)
diff --git a/tests/test_cloud.py b/tests/test_cloud.py
index db724a3..97fe253 100644
--- a/tests/test_cloud.py
+++ b/tests/test_cloud.py
@@ -907,7 +907,7 @@ class CloudCli(unittest.TestCase):
self.assertIn("Try again in 12s", busy.stderr)
FakeCloud.fail = (403, {"error": "blocked", "code": "account_blocked"}, None)
blocked = self.run_cli("cloud", "start", "--no-watch")
- self.assertIn("Rentals are blocked", blocked.stderr)
+ self.assertIn("blocked from starting phones", blocked.stderr)
self.assertNotIn("isn't enabled", blocked.stderr)
FakeCloud.fail = (403, {"error": "not enough credit", "balance_cents": 0}, None)
broke = self.run_cli("cloud", "start", "--no-watch")
@@ -1195,6 +1195,23 @@ class CloudCli(unittest.TestCase):
self.assertEqual(FakeCloud.posts[-1]["timeout_seconds"], 360)
self.assertIn("expires in 6 min", r.stdout)
+ def test_credit_shows_minutes_only_for_a_metered_account(self):
+ # The balance converts to Android minutes only when the account bills by
+ # the minute. A non-metered account (an iPhone subscription) shows the
+ # money alone, the way the MCP does. `price_cents_per_minute` can still
+ # be present when billing is disabled, so the rate alone is not enough.
+ from phone_harness.cloud import _credit
+ metered = {"balance_cents": 425, "price_cents_per_minute": 5, "billing_mode": "metered"}
+ self.assertEqual(_credit(metered), "$4.25 (about 85 min)")
+ disabled = dict(metered, billing_mode="disabled")
+ self.assertEqual(_credit(disabled), "$4.25")
+ # A missing billing_mode is treated as metered (older service responses).
+ no_mode = {"balance_cents": 425, "price_cents_per_minute": 5}
+ self.assertEqual(_credit(no_mode), "$4.25 (about 85 min)")
+ # No per-minute price: the money alone, whatever the billing flag says.
+ no_rate = {"balance_cents": 425, "billing_mode": "metered"}
+ self.assertEqual(_credit(no_rate), "$4.25")
+
def test_a_control_error_prints_its_type_once(self):
from phone_harness.remote import _plain_error
self.assertEqual(