The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
task(mobile): mark only sent requests; document phone tracking
tonyaf4c2fa88221
diff --git a/docs/product-measurement.md b/docs/product-measurement.mdindex eb99d677d..d3717ae83 100644--- a/docs/product-measurement.md+++ b/docs/product-measurement.md@@ -10,7 +10,7 @@ automatically proven improvement. Changes still need review, tests and a deliber| --- | --- | --- || Does first measured use lead to work? | First-launch installation cohorts; work and first text response within 24 hours | Same participating installation, not signup conversion, same-task success or unique people. Existing users enter when updated; mature only after the full follow-up day ends. || Where does a launch stall or fail? | Pending install/model/native waits; observed launch created/failed/cancelled/unconfirmed; fixed failure categories and duration buckets | Polls are not attempts. Missing outcomes, daemon restarts and the 15-minute observation bound reduce coverage. Inspect unknowns alongside failures. |-| Which actions break? | Create, resume, restart, model-change, history, fork, close, delete, search, history paging, Store list/install/update/remove, model list/download/start/stop and browser-open requests, fixed outcomes/errors and latency buckets | Request acceptance is not task success. Pending/unknown requests are separate from completed replies. |+| Which actions break? | Create, resume, restart, model-change, history, fork, close, delete, search, history paging, Store list/install/update/remove, model list/download/start/stop and browser-open requests, fixed outcomes/errors and latency buckets | Request acceptance is not task success. Pending/unknown requests are separate from completed replies. Requests are also counted by source: `app`, `tool`, `automatic` (fixed polls, whichever app makes them), `unknown` and `phone` — the phone marks the requests the daemon measures (`usageSurface: 'phone'`, inside the E2EE payload); older phones still count as `app`. || Does work get a response promptly? | First text response buckets; over-one-minute waits; error events; matched ends without text; interruptions | Includes automation. Tool-only turns, interruptions and missing lifecycle events can explain missing text. No message is inspected. || Do installations return to work? | D1/D7/D28 working-day cohorts, consecutive complete-week and calendar-month returns, return after a seven-day gap | Any working day can be a cohort; not new-signup retention. Local date flags produce unlinked totals. Opt-outs, reinstallations, resets and missing uploads affect results. || Was the task useful? | Optional Completed / Partly completed / Not completed plus five fixed reason choices from clients that offer feedback; current Desktop Settings no longer exposes feedback controls | Voluntary and self-selected; not representative success or satisfaction. There is no free-text input. |@@ -18,7 +18,9 @@ automatically proven improvement. Changes still need review, tests and a deliber| Which features get tried and used again? | First measured installations and daily first/repeat feature reach | Locally deduplicated installation-days, not unique accounts. Reads the apps make on their own (history, history paging, Store list, model list; `PRODUCT_USAGE_AUTOMATIC_ACTIONS`) count reliability only. The Store and model lists get reach only from the request an app marks `userAction` when a person opens them (`<action>_user_*`, `PRODUCT_USAGE_USER_OPENED_ACTIONS`); history has none. || Where do app flows break? | Setup, Harness/tmux/clipboard steps, sign-in, workspace/remote connections, computer linking, viewer-pane opening and manual update checking/staging | Fixed started/ok/failed/cancelled/unknown counts and coarse duration buckets. Opening a viewer pane is not rendering its content; staging an update is not a successful relaunch. |-| Where does the phone's onboarding stall? | After sign-in: waiting for the first computer, opening its session, the first message, the notification prompt. A sign-in that went through, by button, counted again under the account's sharing. Waits past a minute split into 1–5 min, 5–15 min, 15 min–1 h and over 1 h for the computer and the first message. Once per step per sign-in: `resumed` (reopened in a run that did not sign in), "Not you? Sign out", the address sent from the share sheet, a joining computer that wants its password or is offline | Stage totals per day, not a linked funnel. Subtract `resumed` from starts for fresh starts; an unmatched start is a closed app or a step still waiting. A resumed step's duration starts at the reopening. Signed-in sign-in counts are successes only; failures and cancels before an account remain the signed-out opt-in's, but a success is marked `retried` (a failed or cancelled try came first in that app run) or `switched` (another button was tried first). Phone reports carry release and iOS/Android, so every phone count also splits by those two margins (above 20 collector days); debug builds are not kept. A chosen sign-out sends what is queued first (up to 2 s), so "Not you? Sign out" reaches the totals. |+| Where does the phone's onboarding stall? | After sign-in: waiting for the first computer, opening its session, the first message, the notification prompt. A sign-in that went through, by button, counted again under the account's sharing. Waits past a minute split into 1–5 min, 5–15 min, 15 min–1 h and over 1 h for the computer and the first message. Once per step per sign-in: `resumed` (reopened in a run that did not sign in), "Not you? Sign out", the address sent from the share sheet, a joining computer that wants its password or is offline | Stage totals per day, not a linked funnel. Subtract `resumed` from starts for fresh starts; an unmatched start is a closed app or a step still waiting. A resumed step's duration starts at the reopening. Signed-in sign-in counts are successes only; failures and cancels before an account remain the signed-out counts', but a success is marked `retried` (a failed or cancelled try came first in that app run) or `switched` (another button was tried first). Phone reports carry release and iOS/Android, so every phone count also splits by those two margins (above 20 collector days); debug builds are not kept. A chosen sign-out sends what is queued first (up to 2 s), so "Not you? Sign out" reaches the totals. |+| How fast does the phone get back to work? | A launch that came back signed in, to its first computer answering (`app_start`); a dial the person asked for ("Try again", `connect_user`) apart from the app's own (`connect_auto`), beside the unchanged `remote_connect`; a stopped harness resumed from the phone, to its first live turn (`resume_recovery`) | A launch that signs in is the onboarding's and is not counted; one that leaves the screen before a computer answers is `unknown`, one whose computers never answer stays started. An asked-for dial fails at 12 s, as Desktop Connect does. A phone dial is `failed` only when the phone knows why (locked or offline), `unknown` otherwise; the reasons (`connect_error_*`) are Desktop health counters. |+| Are the phone's side pages used? | Find and Computers opens, by a sideways swipe on the terminal or by a button (Computers' row in Settings, its link on a long wait at home) | Which page and which way, nothing more. Find's key and screen-reader actions are not counted; a swipe that lets Find go back opened nothing. || Is measurement losing coverage? | Updated collector installation-days, pruned queues, full observation maps, unmatched app starts | Loss signals warrant caution. No signal does not prove complete collection. || How many people use Harness, and do they come back? | People active / working / new per day and per app, and D1/D2/D3/D7 returns (backend rollup of 10-day pseudonymous marks) | Sharing accounts only, staff excluded; an app open across midnight counts on both days, so prefer working returns. Not available before `PRODUCT_USAGE_SUBJECT_KEY` is set. |@@ -32,8 +34,11 @@ over after sign-in and is remembered for the next signed-out launch. An explicitbefore sign-in is applied to the account before Desktop sharing can resume; failures keep it pendingand reporting off. An account's default-on response cannot erase that pending choice. Turning sharing off discardsqueued counts and open observations. It does not retract a request already sent.-The phone retains its separate, off-by-default **Share setup and sign-in counts** choice for each-app session. Neither native setup transport sends credentials/cookies or replays earlier actions.+The phone's **Share setup and sign-in counts** line, under its signed-out screens, is on by default too+and follows the same rules: unticking it is kept on the phone as a pending opt-out, applied to the+account at the next sign-in before phone sharing resumes; an unreadable choice is off; the confirmed+account preference is remembered for the next signed-out launch. With nowhere to keep the opt-out+(tests, the sample) it starts off. Neither native setup transport sends credentials/cookies or replays earlier actions.Setup state already visible when sharing becomes enabled can start an observation; duration thenbegins at that observation, not necessarily at installation start. Web pre-sign-in collection staysdisabled because that transport cannot guarantee omitted cookies. These untrusted setup counts are@@ -144,8 +149,8 @@ their own. A backend that predates `tui` refuses only those, and the daemon thenuntil the next UTC day or its own restart, without counting a failed delivery.The signed-out endpoint permits only setup counters. Older native clients send `consent: true`;-default-on Desktop sends `sharing: "default"`, accepted only for Desktop counters and never recorded-as an explicit opt-in. The two request forms are mutually exclusive. The endpoint rejects auth/cookie+default-on Desktop and phone send `sharing: "default"`, accepted only when every counter is one+surface's (Desktop or phone) and never recorded as an explicit opt-in. The two request forms are mutually exclusive. The endpoint rejects auth/cookieheaders, limits bodies to 4 KiB and values to 1,000, and admits at most 120 writes/minute and fourconcurrent writes per server process. No IP-based analytics or new rate-limit identity is stored.Exhaustion drops measurement rather than affecting sign-in. Public counts remain susceptible to@@ -221,7 +226,9 @@ is one source of evidence; a missing response does not identify why a person stoDeploy backend schema and the singleton worker first, including unique indexes and TTL indexes.Use synthetic data to verify duplicate receipts, transaction rollback/retry, off/on revision fencing-and expiry. Then release CLI, desktop and phone together. Check that the switch saves and that reports+and expiry. Then release CLI, desktop and phone together. An older backend refuses a whole report+carrying a counter it does not know (a phone page opening, a `request_phone_*` count, a phone+`sharing: "default"` setup report), so the backend always goes first. Check that the switch saves and that reportsstop when it is off. Old clients stop contributing individual daily histories when the backend changes;the historical reporting command will no longer be a current-usage source.diff --git a/docs/research/2026-10-14-mobile-app-tracking/index.html b/docs/research/2026-10-14-mobile-app-tracking/index.htmlindex 6b44323d9..fa7534cbf 100644--- a/docs/research/2026-10-14-mobile-app-tracking/index.html+++ b/docs/research/2026-10-14-mobile-app-tracking/index.html@@ -271,9 +271,9 @@<tr><td>counters</td><td><code>{"ui_phone_computer_wait_started":1, "ui_phone_computer_wait_ok":1, "ui_phone_computer_wait_over_1m":1}</code></td></tr></table></div><p>The backend accepts only names on its list (any other name rejects the whole report) and adds them into daily totals. Who sent a report is used to check their- switch, and is not stored with the totals. Signed out there is no account, so nothing is sent unless the person ticked <b>Share setup and sign-in counts</b>.- That box starts off on every launch. Its reports go without credentials or cookies to <code>POST /api/product-usage/setup</code>, with- <code>"consent": true</code> instead of a revision. That is the only way sign-in is counted, because a sign-in happens before there is an account. A Google sign-in that worked:</p>+ switch, and is not stored with the totals. Signed out there is no account, so the phone goes by its own <b>Share setup and sign-in counts</b> line,+ on by default as on Desktop and kept across launches; turning it off also turns the account's sharing off at the next sign-in. Its reports go without+ credentials or cookies to <code>POST /api/product-usage/setup</code>, with <code>"sharing": "default"</code> instead of a revision. That is the only way sign-in is counted, because a sign-in happens before there is an account. A Google sign-in that worked:</p><div class="scroll"><table><tr><th>Field</th><th>Value</th></tr><tr><td>counters</td><td><code>{"setup_phone_sign_in_started":1, "setup_phone_sign_in_ok":1, "setup_phone_sign_in_1s_to_10s":1, "setup_phone_sign_in_google_started":1, "setup_phone_sign_in_google_ok":1, "setup_phone_sign_in_google_1s_to_10s":1}</code></td></tr>@@ -334,7 +334,7 @@<tr><td>sign_in_switched</td><td>A sign-in that went through on another button than the first one tried</td></tr></table></div><p>Google and Apple were not counted at all before this change, so <code>sign_in</code> totals rise when it ships. A scan that fails and falls back to the emailed code counts as a failed scan; the code typed after it is its own email attempt.</p>- <div class="note">Every outcome, failures and cancels included, exists only for phones that ticked <b>Share setup and sign-in counts</b> (<code>setup_phone_*</code>), the one quiet line with ⓘ at the foot of every signed-out screen; it starts off on every launch.+ <div class="note">Every outcome, failures and cancels included, exists only for phones whose <b>Share setup and sign-in counts</b> line is on (<code>setup_phone_*</code>), the one quiet line with ⓘ at the foot of every signed-out screen; it is on by default and remembered across launches.A sign-in that <b>went through</b> is counted again under the account's own sharing (<code>ui_phone_sign_in_*_ok</code>, the large population), with <code>retried</code> and <code>switched</code> saying how hard it was. People who never get in stay invisible: take installs and first opens from App Store Connect and Play Console as the denominator.</div></figcaption></figure><figure class="phone-pair"><div class="shots"><img src="img/03-code.jpg" alt="Check your email: the 4-digit code"></div><figcaption><div class="row"><span class="num">1b</span><span class="ttl2">What a failure carries</span></div>@@ -421,13 +421,26 @@</ul></div></div>+ <h2>Added on 2026-10-16</h2>+ <p class="sub">The flows the desktop already counted, the phone's two side pages, and who sent a request.</p>+ <div class="card"><div class="card-body">+ <ul class="plain">+ <li><b>app_start</b>: a launch that came back signed in, to its first computer answering. <code>unknown</code> when the app left the screen first; a launch that signs in is the onboarding's and is not counted.</li>+ <li><b>connect_user</b> / <b>connect_auto</b>: "Try again" on a computer apart from the app's own dials (launch, a dropped socket coming back), beside the unchanged <code>remote_connect</code>. A Try again fails at 12 s, as Desktop Connect does.</li>+ <li><b>resume_recovery</b>: a stopped harness resumed from the phone, to its first live turn; <code>failed</code> when the computer refused it.</li>+ <li><b>ui_phone_screen_find_swipe|button</b>, <b>ui_phone_screen_computers_swipe|button</b>: Find and Computers opened, by a swipe on the terminal or by a button (Computers in Settings, its link on a long wait at home). Find's key and screen-reader actions are not counted.</li>+ <li><b>request_phone_*</b>: the computer's daemon counts the phone's requests (create, resume, close, search…) as the phone's, not as any app's. The phone says so inside the encrypted request (<code>usageSurface</code>); older phones still count as <code>app</code>.</li>+ <li><b>Signed out, on by default</b>, as on Desktop: see sign-in above.</li>+ </ul>+ </div></div>+<h2>Reading the numbers</h2><div class="card"><div class="card-body"><p><code>cd backend && npm run usage:daily -- 14</code> (read-only <code>DATABASE_URL</code>) prints JSON; its <code>review.flows</code> lists every flow per channel and surface with its starts,the four outcomes, <code>unmatchedStarts</code> and the duration buckets. The new flows appear there with no change, because the review reads the same vocabulary. Days are UTC; today is partial.</p><ul class="plain"><li>Conversion between steps compares totals, not people: <code>session_open_started</code> ÷ <code>computer_wait_ok</code> is close to "joined, then went on", but nothing links the two counts.</li>- <li>Sign-in failure rates describe only phones that ticked the box: a self-selected group. Successes, <code>retried</code> and <code>switched</code> cover every sharing account.</li>+ <li>Sign-in failure rates describe the phones that left the line on (the default); those that turned it off are missing. Successes, <code>retried</code> and <code>switched</code> cover every sharing account.</li><li><code>resumed</code> marks a step started in an app run that did not sign in (the app reopened mid-step). Subtract it from starts for fresh starts.</li><li>Every phone report carries its release and iOS/Android, so <code>usage:daily</code>'s <code>health.breakdowns</code> splits each <code>ui_phone_*</code> count by release and by platform: compare the release before and after a UI change. A margin appears above 20 collector days. Debug builds report as <code>development</code> and are not kept, but TestFlight builds are release builds and do count.</li><li>The web build of the same app counts under <code>ui_web_*</code>. Signed out, web sends nothing.</li>@@ -441,8 +454,8 @@<li>The email typed or shown ("Use [email protected]"), the Google or Apple account, the account id.</li><li>The computer's name ("MacBook Pro"), its id, the session or agent, the starter task and every message.</li><li>Error text, the QR's contents, the one-time codes.</li>- <li>Any device or install id, app version, OS version, locale, time of day.</li>- <li>Taps, screens, scrolling, or anything from the offline sample.</li>+ <li>Any device or install id, OS version, locale, time of day. (The app's release and iOS or Android are sent, as margins.)</li>+ <li>Taps, scrolling, or anything from the offline sample. Of the screens, only that Find or Computers opened, and by swipe or button.</li></ul></div></div>@@ -454,7 +467,7 @@<li>The phone's Privacy ▸ See what's shared now lists the sign-in buttons and the four setup steps. Desktop's copy of that text does not mention them yet.</li><li>The signed-out choice is now drawn differently on each app (the phone's is one line with ⓘ), so the backend test compares its wording on both apps instead of the whole file.</li></ul>- <p class="q">Should signed-out sign-in counts stay opt-in only (small numbers), or is the sign-in split good enough from phones that tick the box?</p>+ <p class="q">Decided 2026-10-16: signed-out counts are on by default on the phone too, as on Desktop.</p></div></div></main><dialog id="zoom"><img alt=""></dialog>diff --git a/mobile/lib/ws/ws_conn.dart b/mobile/lib/ws/ws_conn.dartindex 56ff75082..7262bd7cd 100644--- a/mobile/lib/ws/ws_conn.dart+++ b/mobile/lib/ws/ws_conn.dart@@ -888,11 +888,13 @@ class WsConn {@visibleForTestingstatic bool worthLogging(String type) => !_unlogged.contains(type);- /// The requests a machine's daemon counts by who sent them — `actions` and `message` in- /// cli/src/lib/productUsageSignals.ts. Over the relay the phone is a remote app client like the- /// browser, so these carry `usageSurface: 'phone'` (as a model list a person opened carries- /// `userAction`) and are counted as the phone's. Nothing else gets the word: not the E2EE handshake,- /// not the relay's own frames. A daemon from before it reads past it.+ /// The requests this phone sends that a machine's daemon counts by who sent them — of `actions` and+ /// `message` in cli/src/lib/productUsageSignals.ts, the ones it sends (never a type it does not:+ /// every machine request named in `lib/` must be sealed, `encrypted_down_types_test.dart`). Over the+ /// relay the phone is a remote app client like the browser, so these carry `usageSurface: 'phone'`+ /// (as a model list a person opened carries `userAction`) and are counted as the phone's. Nothing+ /// else gets the word: not the E2EE handshake, not the relay's own frames. A daemon from before it+ /// reads past it.@visibleForTestingstatic const usageMeasuredRequests = {'agent_create',@@ -901,7 +903,6 @@ class WsConn {'agent_retarget','agent_recent','agent_fork',- 'agent_close','agent_delete','session_search','session_tail',@@ -911,9 +912,6 @@ class WsConn {'dsh_remove','models_list','grid_models_list',- 'grid_fleet_model_download',- 'grid_fleet_model_start',- 'grid_fleet_model_stop','browser_open','message',};diff --git a/mobile/test/ws/ws_conn_relay_test.dart b/mobile/test/ws/ws_conn_relay_test.dartindex 773cf1bdf..8045da2ad 100644--- a/mobile/test/ws/ws_conn_relay_test.dart+++ b/mobile/test/ws/ws_conn_relay_test.dart@@ -422,7 +422,7 @@ void main() {expect(jsonEncode(hello), isNot(contains('usageSurface')));});- test('the phone marks exactly the requests the daemon counts', () {+ test('the phone marks every request it sends that the daemon counts, and no other', () {final signals = File('../cli/src/lib/productUsageSignals.ts').readAsStringSync();final actions = RegExp(r'const actions = \{([^}]*)\}')@@ -434,7 +434,23 @@ void main() {// Counted by its own name there, not through the table.'message',};- expect(WsConn.usageMeasuredRequests, counted);+ // Sent: named anywhere in the app outside the list itself.+ final sent = <String>{};+ for (final file in Directory('lib').listSync(recursive: true)) {+ if (file is! File || !file.path.endsWith('.dart')) continue;+ if (file.path.endsWith('ws/ws_conn.dart')) continue;+ final source = file.readAsStringSync();+ for (final type in counted) {+ if (source.contains("'$type'")) sent.add(type);+ }+ }+ expect(WsConn.usageMeasuredRequests.difference(counted), isEmpty);+ expect(sent.difference(WsConn.usageMeasuredRequests), isEmpty);+ expect(+ WsConn.usageMeasuredRequests.difference(sent),+ isEmpty,+ reason: 'a type the phone never sends is not named in lib/',+ );});test('sendRaw goes out as it is when its type is not sealed', () async {