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
fix(mobile): close remaining onboarding gaps
tonyb896acd827fa
diff --git a/mobile/lib/auth/link_errors.dart b/mobile/lib/auth/link_errors.dartindex bea48f57c..d189119dc 100644--- a/mobile/lib/auth/link_errors.dart+++ b/mobile/lib/auth/link_errors.dart@@ -1,5 +1,8 @@/// cli.ts `humanizeLinkError`: a password-link failure code as the sentence to show. Every branch,/// the fallback included, wraps the code in words — a bare code must never reach the screen.+///+/// Worded for a phone, not a terminal: the desktop app is named first, where most people set the+/// password and keep Harness running, and the CLI command after it, for a server.String humanizeLinkError(String code, String machineId, {DateTime? retryAt}) {if (code == 'RATE_LIMITED') {if (retryAt == null) {@@ -17,36 +20,36 @@ String humanizeLinkError(String code, String machineId, {DateTime? retryAt}) {}return switch (code) {'NO_REMOTE_PASSWORD' =>- '$machineId has no phone password yet. On it, run '- '`harness remote-password set`, then try again.',+ '$machineId has no phone password yet. Set one there (in Harness: Machines, then '+ 'Password; on a server: `harness remote-password set`), then try again.','BAD_INTENT' =>'The connection request was malformed — this usually means a version mismatch. '- 'Update harness on both machines and try again.',+ 'Update Harness on the computer and on this phone, then try again.','WRONG_PASSWORD' =>- 'That password is wrong. It is the one set on $machineId with '- '`harness remote-password set`.',+ 'That password is wrong. It is the one set on $machineId (in Harness: Machines, then '+ 'Password; on a server: `harness remote-password set`).','BUSY' =>'Machine $machineId is already handling another link attempt. Wait a moment and try again.','TIMEOUT' =>- "Machine $machineId didn't respond in time. Make sure it's running `harness start` "- 'and reachable, then try again.',+ "$machineId didn't respond in time. Make sure Harness is running there (the app, or "+ '`harness start` on a server) and it is online, then try again.','SEND_FAILED' =>'Could not reach the relay to start linking. Check your network connection and try again.','DERIVE_FAILED' =>'Could not process the password locally. Try again; if it persists, restart the app and retry.','SELECT_FAILED' =>- "Could not find machine $machineId, or it isn't reachable right now. Check that it has "- 'run `harness start`.',+ "Could not find $machineId, or it isn't reachable right now. Check that Harness is "+ 'running there (the app, or `harness start` on a server).','PAIR_FAILED' =>"Linking failed on $machineId's side. Try again; if it persists, check its status there "'with `harness status`.','PROTOCOL_ERROR' =>'Something unexpected happened during the handshake. Try again; if it persists, update '- 'harness on the other machine.',+ 'Harness on the computer.','CONNECTION_ERROR' =>'Could not reach the relay. Check your network connection and try again.',_ =>- 'Linking failed ($code). Try again; if it persists, check the other machine is on the '- 'latest harness version.',+ 'Linking failed ($code). Try again; if it persists, check that Harness on the computer is '+ 'up to date.',};}diff --git a/mobile/lib/notify/system_notices.dart b/mobile/lib/notify/system_notices.dartindex 3525149ef..5872b6565 100644--- a/mobile/lib/notify/system_notices.dart+++ b/mobile/lib/notify/system_notices.dart@@ -66,6 +66,16 @@ class SilentSystemNotices implements SystemNotices {Future<void> showAccountNotice({required String key, required String title, required String body}) async {}}+/// Whether the OS lets this app post notices right now — Settings ▸ Notifications reads it. Null+/// where nothing can say: a stand-in centre (tests, the sample), or a platform call that failed.+///+/// Not on [SystemNotices] itself: every stand-in would have to answer it, and only the real centre+/// knows.+Future<bool?> noticesEnabled(SystemNotices notices) =>+ notices is LocalSystemNotices+ ? notices.enabled()+ : Future<bool?>.value(null);+/// What a device notice's payload starts with; the device's key follows. An agent notice's payload/// is `machine\nagent`, so the two never read as each other.const _devicePayload = 'device:';@@ -163,6 +173,27 @@ class LocalSystemNotices implements SystemNotices {}}+ /// Whether notices are allowed now — see [noticesEnabled]. iOS cannot tell "never asked" from+ /// "refused" here: both read false, and asking ([requestPermission]) is what tells them apart.+ Future<bool?> enabled() async {+ try {+ await _init();+ final ios = _plugin+ .resolvePlatformSpecificImplementation<+ IOSFlutterLocalNotificationsPlugin+ >();+ if (ios != null) return (await ios.checkPermissions())?.isEnabled;+ final android = _plugin+ .resolvePlatformSpecificImplementation<+ AndroidFlutterLocalNotificationsPlugin+ >();+ if (android != null) return await android.areNotificationsEnabled();+ } catch (error) {+ appLog.warn('notify', 'permission check failed', error: error);+ }+ return null;+ }+@overrideFuture<void> show(AgentNoticeMessage message) async {final channel = _channels[message.kind]!;diff --git a/mobile/lib/phone/agent_home.dart b/mobile/lib/phone/agent_home.dartindex aa185f6d1..c3524fdb0 100644--- a/mobile/lib/phone/agent_home.dart+++ b/mobile/lib/phone/agent_home.dart@@ -145,6 +145,18 @@ class _AgentHomeState extends State<AgentHome> {bool _gaveUpWaiting = false;Timer? _loadingDeadline;+ /// The launch's wait is over — the screen has something other than a loading message to show —+ /// so [_loadingTimeout] has nothing left to guard, and must not fire into a screen that has+ /// stopped waiting: it would hold back every loading message after it.+ ///+ /// Called from [build], on each way out of the loading screen; only the first does anything.+ void _endLaunchWait() {+ final deadline = _loadingDeadline;+ if (deadline == null) return;+ _loadingDeadline = null;+ deadline.cancel();+ }+@overridevoid initState() {super.initState();@@ -238,9 +250,9 @@ class _AgentHomeState extends State<AgentHome> {if (tabId != null && widget.notifier.activeDeskTabId == null) {widget.notifier.noteDeskTab(tabId);}- // The deadline has done its job either way once this lands, and a timer left running would fire- // into a screen that is no longer waiting.- _loadingDeadline?.cancel();+ // ⚠️ The deadline is NOT ended here. This read takes milliseconds, and ending it here left the+ // waits it exists for — an agent list that never arrives, after the machine is up — with no end+ // at all. It ends when the screen stops waiting ([_endLaunchWait]).setState(() {_readingLast = false;// ⚠️ Not applied if a pager is already up, which only happens when this read came back AFTER@@ -693,6 +705,7 @@ class _AgentHomeState extends State<AgentHome> {if (widget.notifier.pendingPairing case final pending?) {final machine = widget.notifier.machineStates[pending.machineId];if (machine != null && machine.needsLink) {+ _endLaunchWait();return PairingWithCode(key: ValueKey('pairing-${pending.machineId}'),notifier: widget.notifier,@@ -721,6 +734,7 @@ class _AgentHomeState extends State<AgentHome> {final loading = _loadingMessage() ?? _restoreMessage();_traceLoading(loading);if (loading != null) return _AgentHomeLoading(message: loading);+ _endLaunchWait();// ⚠️ **No machine is open → this is a MACHINE problem, so the machine screen is what the// person gets.** An "Agents" header over "No machines are open yet" named the thing that is// missing rather than the thing to do about it, and the only route to a password form was@@ -761,6 +775,7 @@ class _AgentHomeState extends State<AgentHome> {_openNewAgentAfterLastOneWent();return _AgentHomeEmpty(notifier: widget.notifier);}+ _endLaunchWait();// Nothing remembered, nothing picked: the sessions, each a tap from its terminal.if (_welcome && _neighboursFor == null && _requestedAgent == null) {return PickUpPage(notifier: widget.notifier);diff --git a/mobile/lib/phone/settings_page.dart b/mobile/lib/phone/settings_page.dartindex 54d8cd5e9..cec3a87b0 100644--- a/mobile/lib/phone/settings_page.dart+++ b/mobile/lib/phone/settings_page.dart@@ -4,10 +4,12 @@ import 'package:flutter/material.dart';import 'package:lucide_icons_flutter/lucide_icons.dart';import 'package:package_info_plus/package_info_plus.dart';+import 'package:harness_mobile/core/app_settings.dart';import 'package:harness_mobile/core/app_version.dart';import 'package:harness_mobile/demo/sample_mode.dart'show SampleMode, SampleSession, openSampleMode;import 'package:harness_mobile/core/device_name.dart';+import 'package:harness_mobile/notify/system_notices.dart';import 'package:harness_mobile/shared/widgets/app_dialog.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';import 'package:harness_mobile/shared/theme/appearance_prefs_store.dart';@@ -200,6 +202,9 @@ class _Body extends StatelessWidget {phoneRoute((_) => DevicesPage(notifier: notifier)),),),+ // Under Your devices: a new device on the account is one of the two things a notice says.+ // Not in the sample, whose notices go nowhere.+ if (_sample(context) == null) _NotificationsRow(notifier: notifier),// The name those computers show when this phone takes a harness over — which makes it a// fact about the account's computers, not about how the terminal looks._PhoneNameRow(notifier: notifier),@@ -379,6 +384,94 @@ class _VoiceLanguageRow extends StatelessWidget {);}+/// Whether this phone may notify — a harness asking something while the app is away, a new device+/// on the account — and the way to turn it on.+///+/// ⚠️ **The way back.** The OS asks once by itself, as the first terminal's tips go+/// (`terminal_page.dart`). A "Don't Allow" there had no way back from inside the app, and the device+/// notices went with it — the one warning that a key nobody recognises joined the account.+///+/// Off, a tap asks the OS: the prompt where it still has one to show, and where it does not (iOS+/// asks once; Android stops after a refusal or two) the answer is still no, so the way to the+/// phone's own switch is offered. On, a tap goes straight to that switch. Read again on the way back+/// from Settings. No value at all where the answer cannot be read (a stand-in notice centre).+class _NotificationsRow extends StatefulWidget {+ const _NotificationsRow({required this.notifier});++ final AppNotifier notifier;++ @override+ State<_NotificationsRow> createState() => _NotificationsRowState();+}++class _NotificationsRowState extends State<_NotificationsRow>+ with WidgetsBindingObserver {+ bool? _on;++ SystemNotices get _notices => widget.notifier.agentNotices.system;++ @override+ void initState() {+ super.initState();+ WidgetsBinding.instance.addObserver(this);+ unawaited(_read());+ }++ @override+ void dispose() {+ WidgetsBinding.instance.removeObserver(this);+ super.dispose();+ }++ /// Back from the phone's Settings, where the switch is — or from anywhere else it could change.+ @override+ void didChangeAppLifecycleState(AppLifecycleState state) {+ if (state == AppLifecycleState.resumed) unawaited(_read());+ }++ Future<void> _read() async {+ final on = await noticesEnabled(_notices);+ if (mounted && on != _on) setState(() => _on = on);+ }++ Future<void> _tap() async {+ if (_on == true) {+ await openAppSettings();+ return;+ }+ await _notices.requestPermission();+ await _read();+ if (!mounted || _on != false) return;+ ScaffoldMessenger.maybeOf(context)?.showSnackBar(+ SnackBar(+ content: const Text(+ 'Notifications are off for Harness. Turn them on in the phone’s Settings.',+ ),+ action: SnackBarAction(+ label: 'Open Settings',+ onPressed: () => unawaited(openAppSettings()),+ ),+ ),+ );+ }++ @override+ Widget build(BuildContext context) {+ AppTheme.watch(context);+ return SettingsRow(+ key: const ValueKey('settings-notifications'),+ title: 'Notifications',+ detail: 'When a harness needs you, or a new device joins your account.',+ value: switch (_on) {+ true => 'On',+ false => 'Off',+ null => null,+ },+ onTap: () => unawaited(_tap()),+ );+ }+}+/// What this phone is called on another screen's "took control" banner —/// the name the OS gives it until the person types their own here.class _PhoneNameRow extends StatelessWidget {diff --git a/mobile/lib/phone/welcome/connect_code.dart b/mobile/lib/phone/welcome/connect_code.dartindex 88dc244df..f90ec956c 100644--- a/mobile/lib/phone/welcome/connect_code.dart+++ b/mobile/lib/phone/welcome/connect_code.dart@@ -26,8 +26,9 @@ class ConnectCode {final String? pairCode;/// The one-time code that signs the phone in with no emailed code — minted- /// for this QR by the computer's own sign-in, good for about a minute, and- /// spent by the first phone to redeem it (`AppNotifier.signInWithScan`).+ /// for this QR by the computer's own sign-in, good for 90 seconds (the QR+ /// renews it every minute), and spent by the first phone to redeem it+ /// (`AppNotifier.signInWithScan`).final String? signIn;static const host = 'harness.autonomous.ai';diff --git a/mobile/lib/phone/welcome/connect_computer.dart b/mobile/lib/phone/welcome/connect_computer.dartindex 81fb8e27d..6249e03d9 100644--- a/mobile/lib/phone/welcome/connect_computer.dart+++ b/mobile/lib/phone/welcome/connect_computer.dart@@ -76,8 +76,11 @@ class _ConnectComputerPageState extends State<ConnectComputerPage> {super.initState();if (widget.signedIn) {// Nothing pushes a new machine to the phone: ask again every few seconds while this is up.+ // A request that fails (offline for a moment) is simply asked again on the next tick — and+ // caught here, where it used to reach the zone as an unhandled error every 5 seconds._watch = Timer.periodic(const Duration(seconds: 5), (_) {- if (mounted) unawaited(widget.notifier.refreshMachines());+ if (!mounted) return;+ unawaited(widget.notifier.refreshMachines().catchError((Object _) {}));});}}diff --git a/mobile/lib/phone/welcome/focus_hints.dart b/mobile/lib/phone/welcome/focus_hints.dartindex be492b818..2f5d6a9a3 100644--- a/mobile/lib/phone/welcome/focus_hints.dart+++ b/mobile/lib/phone/welcome/focus_hints.dart@@ -167,21 +167,42 @@ class _FocusHintsState extends State<FocusHints> {right: 16,top: 0,bottom: 0,- child: Row(+ child: Column(+ mainAxisAlignment: MainAxisAlignment.center,children: [- Expanded(- child: hint('→ swipe right', 'all your harnesses'),+ Row(+ children: [+ Expanded(+ child: hint('→ swipe right', 'all your harnesses'),+ ),+ Expanded(+ child: Align(+ alignment: Alignment.centerRight,+ child: hint(+ 'swipe left ←',+ 'start a new one',+ align: TextAlign.right,+ ),+ ),+ ),+ ],),- Expanded(- child: Align(- alignment: Alignment.centerRight,- child: hint(- 'swipe left ←',- 'start a new one',- align: TextAlign.right,+ // ⚠️ What [FocusHints.onDone] asks for next — the notification permission —+ // said before the OS asks it: the prompt used to come out of nowhere, the+ // moment the tips were touched away. Worded as what notices are for, not as+ // a promise of a prompt, which an OS that already has the answer never shows.+ if (widget.onDone != null) ...[+ const SizedBox(height: 28),+ Text(+ 'Notifications tell you when a harness needs you, '+ 'and when a new device joins your account.',+ textAlign: TextAlign.center,+ style: tty.style(+ size: TtySize.meta,+ color: tty.faint,),),- ),+ ],],),),diff --git a/mobile/lib/phone/welcome/how_it_works.dart b/mobile/lib/phone/welcome/how_it_works.dartindex 93f234cc2..44eef3e12 100644--- a/mobile/lib/phone/welcome/how_it_works.dart+++ b/mobile/lib/phone/welcome/how_it_works.dart@@ -26,11 +26,13 @@ class HowItWorksPage extends StatelessWidget {'context. You can run several harnesses with the same agent. ''They keep going when you close the app.',),+ // "Tab", not "Swarm": the naming system's word for a group of harnesses+ // (`docs/naming-system.md`), and the desktop's setting is Tab collaboration now.(- 'Swarm',+ 'Tab','A group of harnesses, shown together in the workspace. Add a harness to '- 'include it. With Swarm collaboration enabled in Experimental settings, '- 'their agents can consult peers in the same swarm.',+ 'include it. With Settings ▸ Experimental ▸ Tab collaboration turned on '+ 'in the desktop app, their agents can consult peers in the same tab.',),('Project',@@ -41,7 +43,8 @@ class HowItWorksPage extends StatelessWidget {'Phone password','For a computer with no Harness app to show a code (a server): unlocks ''it from this phone, once, over an end-to-end encrypted link. It never '- 'leaves your devices. A Mac shows a code to scan instead.',+ 'leaves your devices. A computer with the Harness app shows a code to '+ 'scan instead.',),];diff --git a/mobile/lib/phone/welcome/pairing_with_code.dart b/mobile/lib/phone/welcome/pairing_with_code.dartindex 754a0bca3..a23d72eed 100644--- a/mobile/lib/phone/welcome/pairing_with_code.dart+++ b/mobile/lib/phone/welcome/pairing_with_code.dart@@ -14,7 +14,7 @@ import '../tty_controls.dart';////// ```/// Connecting to MacBook Pro…-/// Keep “Add phone” open on your Mac.+/// Keep “Add Phone” open on MacBook Pro./// ```////// On success the computer unlocks and the home screen moves on by itself. On failure the code is@@ -96,10 +96,15 @@ class _PairingWithCodeState extends State<PairingWithCode> {.copyWith(height: 34 / 28, letterSpacing: -0.6),),const SizedBox(height: 12),- TtyText(- error ?? 'Keep “Add phone” open on your Mac.',- color: error == null ? tty.faint : tty.red,- size: TtySize.row,+ // A Text that wraps, not a one-line TtyText: the error here is a sentence, and+ // cut at the screen's edge it lost the half that says what to do. Named for the+ // computer, not "your Mac" — Add Phone is on Linux too.+ Text(+ error ?? 'Keep “Add Phone” open on $name.',+ style: tty.style(+ size: TtySize.row,+ color: error == null ? tty.faint : tty.red,+ ),),const Spacer(),if (error != null)diff --git a/mobile/lib/phone/welcome/phone_welcome.dart b/mobile/lib/phone/welcome/phone_welcome.dartindex 6a4516005..989ca9347 100644--- a/mobile/lib/phone/welcome/phone_welcome.dart+++ b/mobile/lib/phone/welcome/phone_welcome.dart@@ -100,6 +100,10 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {/// Between a scan and the session it signs in: the scan page says so.bool _signingInWithScan = false;+ /// The code step was reached from a scan that could not sign the phone in by itself+ /// ([_emailCodeFromScan]): the step says why an email is in the way. Kept on the code step only.+ bool _codeFromScan = false;+/// Under the scan page's hint. A desktop app opens signed out (its guest mode), and its Add Phone/// then shows no code, only "Sign in to add your phone." — with no way to sign in from there.static const _signInThereFirst =@@ -153,7 +157,30 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {}if (!mounted) return;}- unawaited(_sendCode());+ unawaited(_emailCodeFromScan());+ }++ /// The scan could not sign the phone in by itself — an older computer's QR has no sign-in code,+ /// and one that has may be spent or expired — so the email in it is sent a code instead.+ ///+ /// Said on the code step ([_codeFromScan]): somebody who pointed the camera at a computer and+ /// landed on "Check your email" was never told why. And when even the email cannot go — the+ /// address in the QR does not pass, the network is down — the email step takes over, with the+ /// reason under its field and the address there to correct. ⚠️ Left on the scan page, as it used+ /// to be, the failure was said nowhere (that page shows no errors) and its camera, which stops+ /// reading after one code, read nothing more: a screen that looked alive and did nothing.+ Future<void> _emailCodeFromScan() async {+ // Gone from the camera while the scan's own sign-in was tried: the person chose another way.+ if (_step != _Step.scan) return;+ _codeFromScan = true;+ // The scan page goes on saying "Signing in…" while the code is sent — it is the same sign-in,+ // and the page's own title back for that second read as the scan having been dropped.+ setState(() => _signingInWithScan = true);+ final sent = await _sendCode();+ if (!mounted) return;+ setState(() => _signingInWithScan = false);+ if (sent) return;+ _go(_Step.email, error: _error);}/// "Continue with Google / Apple": the account's own sign-in page, in the app. Its failure is@@ -169,7 +196,9 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {}}- void _go(_Step step) {+ /// To [step], with nothing said on it unless [error] is: a step's failure belongs to the step+ /// it happened on.+ void _go(_Step step, {String? error}) {// Leaving for another way in takes the account's page with it: whatever it came back with// would sign the phone in behind the step the person chose instead. Any step that is left — two// of them offer the accounts now, the first screen and [_SignInFirst].@@ -182,27 +211,31 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {}setState(() {_step = step;- _error = null;+ _error = error;+ if (step != _Step.code) _codeFromScan = false;});if (step == _Step.email) _emailFocus.requestFocus();if (step == _Step.code) _codeFocus.requestFocus();if (step == _Step.hello) FocusManager.instance.primaryFocus?.unfocus();}- Future<void> _sendCode() async {+ /// Emails a code to the address in the field and moves on to it. False when it did not go, with+ /// the reason in [_error].+ Future<bool> _sendCode() async {final email = _email.text.trim();if (!email.contains('@') || !email.contains('.')) {setState(() => _error = 'That doesn’t look like an email address.');- return;+ return false;}final ok = await _run(() => (widget.sendCode ?? widget.notifier.sendLoginCode)(email),);- if (!ok || !mounted) return;+ if (!ok || !mounted) return false;_sentTo = email;_code.clear();_startResend();_go(_Step.code);+ return true;}Future<void> _signIn() async {@@ -370,7 +403,10 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {onBack: () => _go(_Step.email),title: 'Check your email',lines: [- 'We sent a $_codeLength-digit code to ${_sentTo ?? 'your email'}.',+ _codeFromScan+ ? 'The code you scanned couldn’t sign this phone in by itself, so we sent a '+ '$_codeLength-digit code to ${_sentTo ?? 'your email'}.'+ : 'We sent a $_codeLength-digit code to ${_sentTo ?? 'your email'}.',],field: _CodeField(controller: _code,diff --git a/mobile/lib/phone/welcome/scan_to_connect.dart b/mobile/lib/phone/welcome/scan_to_connect.dartindex e49875024..654ce7ff0 100644--- a/mobile/lib/phone/welcome/scan_to_connect.dart+++ b/mobile/lib/phone/welcome/scan_to_connect.dart@@ -24,7 +24,7 @@ import 'connect_code.dart';/// │ [ camera view ] │/// └──────────────────────┘/// Scan the code on your computer-/// On your Mac: Harness ▸ Add Phone…+/// In Harness on your computer: Add Phone…////// Use email instead/// ```@@ -45,7 +45,9 @@ class ScanToConnectPage extends StatefulWidget {this.onSignInCode,this.acceptConnectCodes = true,this.title = 'Scan the code on your computer',- this.hint = 'On your Mac: Harness ▸ Add Phone…',+ // Not "On your Mac: Harness ▸ Add Phone…": the desktop app runs on Linux too, where Add Phone+ // is in the command palette rather than a Harness menu.+ this.hint = 'In Harness on your computer: Add Phone…',this.note,});diff --git a/mobile/lib/phone/welcome/unlock_computer.dart b/mobile/lib/phone/welcome/unlock_computer.dartindex 52b515352..434d6d20f 100644--- a/mobile/lib/phone/welcome/unlock_computer.dart+++ b/mobile/lib/phone/welcome/unlock_computer.dart@@ -17,17 +17,22 @@ import 'scan_to_connect.dart';////// ```/// Unlock M2-/// On M2, open Harness ▸ Add Phone…, then scan the QR code.+/// In Harness on M2, open Add Phone…, then scan the QR code./// [ Scan its code ]////// or enter its Harness phone password+/// For a server, or a computer without the Harness app open./// [ •••••••• Show ]/// Unlock///-/// Forgot it, or never set one? On M2, run+/// Forgot it, or never set one? In Harness on M2, open Machines (⌘M on a Mac), choose M2, then Password.+/// On a server, run this on M2:/// $ harness remote-password set Copy/// ```///+/// ⚠️ Nothing on a [Machine] says whether a desktop app runs there, so the page does not guess which+/// way comes first: the scan stays the button, and the password says plainly who it is for.+////// What the link is doing while it works is said in words ("Checking the password…"), never as the/// CLI's stage names.class UnlockComputer extends StatefulWidget {@@ -168,10 +173,15 @@ class _UnlockComputerState extends State<UnlockComputer> {return ListView(padding: const EdgeInsets.fromLTRB(Tty.origin, 12, Tty.origin, 24),children: [- TtyText('Unlock $name', size: 24, weight: FontWeight.w600),+ // A Text, not a one-line TtyText: a long computer name wraps instead of being cut off.+ Text(+ 'Unlock $name',+ style: tty.style(size: 24, weight: FontWeight.w600),+ ),const SizedBox(height: 12),Text(- 'On $name, open Harness ▸ Add Phone…, then scan the QR code.',+ // Not "Harness ▸ Add Phone…": that menu is the Mac's; on Linux it is the command palette.+ 'In Harness on $name, open Add Phone…, then scan the QR code.',style: tty.style(size: TtySize.row, color: tty.faint),),const SizedBox(height: 18),@@ -187,6 +197,13 @@ class _UnlockComputerState extends State<UnlockComputer> {'or enter its Harness phone password',style: tty.style(size: TtySize.meta, color: tty.faint),),+ const SizedBox(height: 2),+ // Who the password is for: a server has no Add Phone to scan, and with the scan as the one+ // filled button, somebody unlocking one had no word telling them this was their way.+ Text(+ 'For a server, or a computer without the Harness app open.',+ style: tty.style(size: TtySize.meta, color: tty.faint),+ ),const SizedBox(height: 8),_PasswordField(controller: _password,@@ -214,13 +231,16 @@ class _UnlockComputerState extends State<UnlockComputer> {),),const SizedBox(height: 32),+ // ⚠️ Where the desktop app keeps it now: Open Machines (⌘M) lists the computers, and this+ // one's row has Password. "Machines ▸ … ▸ Set password" named the old Machines panel.Text(- 'Forgot it? In Harness on $name, choose Machines ▸ $name ▸ Set password.',+ 'Forgot it, or never set one? In Harness on $name, open Machines '+ '(⌘M on a Mac), choose $name, then Password.',style: tty.style(size: TtySize.meta, color: tty.faint),),const SizedBox(height: 8),Text(- 'Using the CLI? Run this on $name:',+ 'On a server, run this on $name:',style: tty.style(size: TtySize.meta, color: tty.faint),),const SizedBox(height: 8),diff --git a/mobile/lib/state/app_state.dart b/mobile/lib/state/app_state.dartindex 286b2d3d6..7de82cc00 100644--- a/mobile/lib/state/app_state.dart+++ b/mobile/lib/state/app_state.dart@@ -1584,6 +1584,12 @@ class AppNotifier extends ChangeNotifier {if (status == AppStatus.unauthenticated) {return; // idempotent: several sources can race here}+ // ⚠️ A Sign out by hand is under way ([_leftByHand]): it clears the saved session before it+ // closes the sockets, and one dialling in between finds the session gone and says so. That is+ // the sign-out in progress, not news — answered here, it invalidated the auth work under that+ // sign-out, which then stopped halfway, and put "You were signed out" in front of the person+ // who had just pressed Sign out. The sign-out finishes the job itself.+ if (_leftByHand) return;_invalidateAuthWork();currentUser = null;signingIn = false;@@ -1996,16 +2002,30 @@ class AppNotifier extends ChangeNotifier {/// machines", which an empty list alone cannot say.bool machinesLoading = false;+ /// The sign-in ([_authRevision]) whose machine list has been asked for at least once — answered+ /// or failed. From then on the list is what the account HAS, empty included.+ ///+ /// ⚠️ **"The first fetch", and not "a fetch over an empty list".** An account with no computer+ /// yet has an empty list after every fetch, so every refresh used to raise [machinesLoading] —+ /// and the phone's "Waiting for your computer…" page (`phone/welcome/connect_computer.dart`),+ /// which refreshes every 5 seconds, was swapped for "Looking for your machines…" by the home+ /// screen each time and built again from scratch: a flash every 5 seconds, a scan's result+ /// dropped with the page that started it. Keyed to the sign-in, so the next one starts over.+ int? _machinesFetchedFor;+Future<void> refreshMachines() async {final revision = _authRevision;if (!_authWorkCurrent(revision)) return;- if (machines.isEmpty && !machinesLoading) {+ if (machines.isEmpty &&+ !machinesLoading &&+ _machinesFetchedFor != revision) {machinesLoading = true;notifyListeners();}try {await _refreshMachines(revision);} finally {+ if (_authWorkCurrent(revision)) _machinesFetchedFor = revision;// Said out loud: the list's own notify fires before this, so a flag// dropped silently here would leave the rail on its placeholders.if (_authWorkCurrent(revision) && machinesLoading) {