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
Desktop: hash updates off the UI thread, stop polling shared tabs while off, fsync logs only when it matters (#1391)
Deea3a9b67a4822
diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.mdindex 6112ce66e..5fdac00ad 100644--- a/desktop/CLAUDE.md+++ b/desktop/CLAUDE.md@@ -718,9 +718,13 @@ add a kind there, not at the call site.(`log_stream.dart` + `log_stream_sinks.dart`): a bounded ring of the last 500 entries that`installFileLogs` tees into. Routine DEBUG records use a one-second flush deadline,256 entries or 64 Ki characters. INFO/WARN and admitted ERROR records flush their preceding context;- export, backgrounding, normal quit and updater handoff also flush. An abrupt process kill- can lose the pending DEBUG batch. CLI transcripts remain immediately- flushed. No timer runs with an empty buffer. It is developer+ export, backgrounding, normal quit and updater handoff also flush. Every flush and immediate+ record reaches the kernel at once, but only admitted ERROR records (crashes included), normal+ quit and updater handoff fsync (`flushAppLog(durable: true)`): on Linux ext4 an fsync on the UI+ isolate waits for a journal commit (10–500+ ms under I/O), the best fit for the Linux long+ frames of 2026-10-16. An abrupt process kill can lose the pending DEBUG batch; a power loss can+ also lose written lines not yet synced. CLI transcripts are still written line by line, without+ an fsync. No timer runs with an empty buffer. It is developerfurniture — `kDebugSurfaceEnabled` (`logging/debug_surface.dart`, `kDebugMode` or`--dart-define=HARNESS_DEBUG_SURFACE=true`) gates the rail row, the ⌘D shortcut(`kDebugShortcut`, in `appShortcuts()` rather than `kAppShortcuts`) and the ring itself; the logdiff --git a/desktop/lib/agent_messages/shared_tabs.dart b/desktop/lib/agent_messages/shared_tabs.dartindex d1da7800b..1b0e20a87 100644--- a/desktop/lib/agent_messages/shared_tabs.dart+++ b/desktop/lib/agent_messages/shared_tabs.dart@@ -123,12 +123,60 @@ class SharedTabsController extends ChangeNotifier {required this.request,required this.foreground,this.onActivity,- });+ this.messagesSwitch,+ }) {+ _switchKnown = messagesSwitch?.value;+ messagesSwitch?.addListener(_switchChanged);+ if (_switchKnown == false) _settleOff();+ }final SharedTabsRequest request;final ValueListenable<bool> foreground;final void Function(SharedActivity activity)? onActivity;+ /// The account's Agent Messages switch (Settings ▸ Experimental, off by+ /// default), null until the account's settings are read. While it is off,+ /// [refresh] asks nothing and answers as the daemon would: every daemon+ /// refuses `shares` with MESSAGES_OFF then (cli/src/messages/service.ts+ /// `awakeShares`), and asking anyway was a request and an fsync'd WARN every+ /// 60 s and on each reconnect, for every account that never turned it on.+ /// Not read yet, it asks as before. None given (tests): always asks.+ final ValueListenable<bool?>? messagesSwitch;++ /// The switch's last value other than null: the store passes through null+ /// whenever it is bound again.+ bool? _switchKnown;++ /// Whether [refresh] asks the daemon.+ bool get asking => messagesSwitch?.value != false;++ void _switchChanged() {+ final now = messagesSwitch!.value;+ if (now == null) return;+ final was = _switchKnown;+ _switchKnown = now;+ if (!now) {+ _settleOff();+ } else if (was == false) {+ // Turned on: read now, not at the next poll.+ unawaited(refresh());+ }+ }++ /// What a MESSAGES_OFF answer does, for a switch that is off; a read in+ /// flight is dropped.+ void _settleOff() {+ if (_disposed) return;+ ++_reads;+ if (_state == SharedTabsState.off &&+ identical(_snapshot, SharedTabsSnapshot.empty)) {+ return;+ }+ _state = SharedTabsState.off;+ _snapshot = SharedTabsSnapshot.empty;+ _notify();+ }+/// The last `shared_activity` frame this computer's daemon sent, each a new/// value: Tab Activity reads its tab again on one for it.ValueListenable<SharedActivity?> get heard => _heard;@@ -171,6 +219,10 @@ class SharedTabsController extends ChangeNotifier {/// had started its own (two backend requests each; final review of 1c, I4).Future<void> refresh() {if (_disposed) return Future<void>.value();+ if (!asking) {+ _settleOff();+ return Future<void>.value();+ }final running = _flight;if (running != null && _flightAccount == _account) {_again = true;@@ -195,7 +247,8 @@ class SharedTabsController extends ChangeNotifier {}Future<void> _readShares() async {- if (_disposed) return;+ // Turned off while an earlier read was in flight: no second one.+ if (_disposed || !asking) return;final read = ++_reads, account = _account;Map<String, dynamic> answer;try {@@ -433,13 +486,17 @@ class SharedTabsController extends ChangeNotifier {@overridevoid dispose() {_disposed = true;+ messagesSwitch?.removeListener(_switchChanged);_heard.dispose();super.dispose();}}/// Reads the shares every 60 s while the window is in front, and once as soon-/// as it comes back. A hidden or minimised window asks nothing.+/// as it comes back. A hidden or minimised window asks nothing, and neither+/// does any window while the account's Agent Messages switch is off+/// ([SharedTabsController.asking]); turned on, the controller reads at once+/// and the polls start again from there.class SharedTabsWatch {SharedTabsWatch({required this.controller,@@ -451,28 +508,47 @@ class SharedTabsWatch {final ValueListenable<bool> foreground;final Duration every;Timer? _timer;- bool _started = false, _disposed = false;+ bool _started = false, _disposed = false, _asking = false;void start() {if (_started || _disposed) return;_started = true;+ _asking = controller.asking;foreground.addListener(_foregroundChanged);+ controller.messagesSwitch?.addListener(_switchChanged);_foregroundChanged();}void _foregroundChanged() {_timer?.cancel();_timer = null;- if (foreground.value) unawaited(poll());+ if (foreground.value && controller.asking) unawaited(poll());+ }++ /// The settings store notifies on each of its 30 s reads: only a change+ /// counts.+ void _switchChanged() {+ final asking = controller.asking;+ if (_disposed || asking == _asking) return;+ _asking = asking;+ _timer?.cancel();+ _timer = null;+ if (asking && foreground.value) {+ _timer = Timer(every, () => unawaited(poll()));+ }}@visibleForTestingFuture<void> poll() async {_timer?.cancel();_timer = null;- if (_disposed || !foreground.value) return;+ if (_disposed || !foreground.value || !controller.asking) return;await controller.refresh();- if (!_disposed && _started && foreground.value && _timer == null) {+ if (!_disposed &&+ _started &&+ foreground.value &&+ controller.asking &&+ _timer == null) {_timer = Timer(every, () => unawaited(poll()));}}@@ -481,6 +557,9 @@ class SharedTabsWatch {_disposed = true;_timer?.cancel();_timer = null;- if (_started) foreground.removeListener(_foregroundChanged);+ if (_started) {+ foreground.removeListener(_foregroundChanged);+ controller.messagesSwitch?.removeListener(_switchChanged);+ }}}diff --git a/desktop/lib/agent_messages/shared_tabs_model.dart b/desktop/lib/agent_messages/shared_tabs_model.dartindex 1212c4b41..d534758c2 100644--- a/desktop/lib/agent_messages/shared_tabs_model.dart+++ b/desktop/lib/agent_messages/shared_tabs_model.dart@@ -89,7 +89,8 @@ class SharedTabMember {@immutableclass SharedTab {- const SharedTab({+ // Not const: a const class cannot hold the late [_memberDeskTabId].+ SharedTab({required this.sharedTabId,required this.ownerTabId,required this.name,@@ -126,7 +127,12 @@ class SharedTab {/// ([memberDeskTabId]); the owner's is the tab it shared (null when the/// daemon did not say, so it shows in no desk tab).String? deskTabId(String myAccountId) =>- ownedBy(myAccountId) ? ownerTabId : memberDeskTabId(sharedTabId);+ ownedBy(myAccountId) ? ownerTabId : _memberDeskTabId;++ /// Worked out once per tab: [SharedTabsController.tabForDesk] asks every+ /// shared tab for its desk id, for each desk tab, on every native menu+ /// flush — and each answer was a fresh SHA-256 of the shared tab id.+ late final String _memberDeskTabId = memberDeskTabId(sharedTabId);static SharedTab? fromJson(Object? json) {if (json is! Map) return null;diff --git a/desktop/lib/app_shell.dart b/desktop/lib/app_shell.dartindex fd3511f03..8ac5b9f7e 100644--- a/desktop/lib/app_shell.dart+++ b/desktop/lib/app_shell.dart@@ -254,7 +254,7 @@ class _RootShellState extends ConsumerState<RootShell>onTimeout: () {},);} finally {- flushAppLog();+ flushAppLog(durable: true);}return AppExitResponse.exit;}diff --git a/desktop/lib/logging/app_log.dart b/desktop/lib/logging/app_log.dartindex 9ed3fbedd..4fb14c01f 100644--- a/desktop/lib/logging/app_log.dart+++ b/desktop/lib/logging/app_log.dart@@ -35,12 +35,17 @@ abstract interface class AppLog {/// File-backed sinks expose their pending diagnostics without requiring/// in-memory sinks or test recorders to manage a buffer.abstract interface class FlushableAppLog implements AppLog {- void flush();+ /// Writes what is pending; [durable] also fsyncs what is already written.+ void flush({bool durable = false});}-void flushAppLog() {+/// [durable] is for quit and the updater's handoff, the last chance before+/// the process goes: on the UI isolate an fsync can take hundreds of+/// milliseconds on Linux, so export and backgrounding (every focus change on+/// a desktop) only write.+void flushAppLog({bool durable = false}) {final sink = appLog;- if (sink is FlushableAppLog) sink.flush();+ if (sink is FlushableAppLog) sink.flush(durable: durable);}/// Level-named conveniences over [AppLog.record], kept as extensions so every@@ -70,8 +75,11 @@ extension AppLogX on AppLog {}/// [AppLog] backed by a per-day file under `~/.harness/logs`. Writes are-/// synchronous and flushed except when [bufferDebug] is enabled for routine-/// debug entries. Errors and lifecycle records also commit pending context.+/// synchronous except when [bufferDebug] is enabled for routine debug+/// entries; INFO and WARN also write the pending context. Only an admitted+/// ERROR (a crash included) is fsynced with it, since an fsync on the UI+/// isolate can stall a frame for hundreds of milliseconds on Linux (see+/// `appendLog`); a killed process still loses none of what was written.class FileAppLog implements FlushableAppLog {FileAppLog(this._file, {@@ -85,7 +93,7 @@ class FileAppLog implements FlushableAppLog {final bool bufferDebug;@override- void flush() => _file.flush();+ void flush({bool durable = false}) => _file.flush(durable: durable);/// Injected so the stamp this writes is a thing a test can assert, rather than/// a thing a test has to watch happen. Same reason [ErrorBurstFilter] takes one.@@ -124,23 +132,26 @@ class FileAppLog implements FlushableAppLog {// back into a per-frame fsync. Its context keeps the normal batch deadline.final admitted = _burst.admit(body.toString());if (admitted == null) return;- _file.append('[${logStamp(_clock())}] $admitted');- _appendStack(stackTrace);+ final line = '[${logStamp(_clock())}] $admitted';+ // The line and its stack in one durable write: one fsync, not two.+ _file.append(+ stackTrace == null ? line : '$line\n${_stackBlock(stackTrace)}',+ durable: true,+ );}void _appendStack(StackTrace? stackTrace, {bool buffered = false}) {if (stackTrace == null) return;- _file.append(- stackTrace- .toString()- .trimRight()- .split('\n')- .map((l) => ' $l')- .join('\n'),- buffered: buffered,- );+ _file.append(_stackBlock(stackTrace), buffered: buffered);}+ static String _stackBlock(StackTrace stackTrace) => stackTrace+ .toString()+ .trimRight()+ .split('\n')+ .map((l) => ' $l')+ .join('\n');+/// Five-wide upper-case level so message columns line up.static String _levelTag(AppLogLevel level) => switch (level) {AppLogLevel.debug => 'DEBUG',diff --git a/desktop/lib/logging/log_append_io.dart b/desktop/lib/logging/log_append_io.dartindex d5ddc1dea..4f1e3fba5 100644--- a/desktop/lib/logging/log_append_io.dart+++ b/desktop/lib/logging/log_append_io.dart@@ -3,3 +3,7 @@ import 'dart:io';void appendDurableLog(File file, String contents) {file.writeAsStringSync(contents, mode: FileMode.append, flush: true);}++void appendLog(File file, String contents) {+ file.writeAsStringSync(contents, mode: FileMode.append);+}diff --git a/desktop/lib/logging/log_append_native.dart b/desktop/lib/logging/log_append_native.dartindex 1829b250b..33ed666e9 100644--- a/desktop/lib/logging/log_append_native.dart+++ b/desktop/lib/logging/log_append_native.dart@@ -10,12 +10,28 @@ import 'log_append_io.dart' as fallback;/// O_APPEND. Another window can append between that seek and the write,/// causing the two writers to overwrite each other. Use a kernel append on/// the desktop POSIX hosts; no file lock or polling is needed.-void appendDurableLog(File file, String contents) {+void appendDurableLog(File file, String contents) =>+ _appendLog(file, contents, sync: true);++/// [appendDurableLog] without the fsync. The bytes are the kernel's when it+/// returns, so a crash or kill of this process loses none of them; only a+/// power loss or OS crash before writeback can. Routine records use it+/// because these calls run on the UI isolate, and on Linux ext4 an fsync+/// waits for a journal commit (10–500+ ms under other I/O; macOS's is cheap).+/// That is the best fit for production's long frames: sampled frames over+/// 250 ms went from 6 (Oct 15) to 297 (Oct 16), and ~69 of 72 on Oct 17 came+/// from two Linux computers. Not measured on those machines.+void appendLog(File file, String contents) =>+ _appendLog(file, contents, sync: false);++void _appendLog(File file, String contents, {required bool sync}) {if (!Platform.isMacOS && !Platform.isLinux) {- fallback.appendDurableLog(file, contents);+ sync+ ? fallback.appendDurableLog(file, contents)+ : fallback.appendLog(file, contents);return;}- _posix.append(file.path, contents);+ _posix.append(file.path, contents, sync: sync);}final _posix = _PosixAppend();@@ -41,15 +57,16 @@ class _PosixAppend {Platform.isMacOS ? '__error' : '__errno_location',);- void append(String path, String contents) {+ /// Empty [contents] with [sync] commits what earlier unsynced appends left.+ void append(String path, String contents, {required bool sync}) {if (path.contains('\u0000')) {throw ArgumentError.value(path, 'path', 'Contains a NUL byte');}final bytes = utf8.encode(contents);using((arena) {final name = path.toNativeUtf8(allocator: arena);- final data = arena<Uint8>(bytes.length);- data.asTypedList(bytes.length).setAll(0, bytes);+ final data = bytes.isEmpty ? nullptr : arena<Uint8>(bytes.length);+ if (bytes.isNotEmpty) data.asTypedList(bytes.length).setAll(0, bytes);// O_WRONLY | O_CREAT | O_APPEND | O_CLOEXEC. The descriptor never// escapes a call, even on a partial write, signal or disk failure.final flags = Platform.isMacOS@@ -69,7 +86,7 @@ class _PosixAppend {}offset += written;}- _retry(() => _sync(fd), path);+ if (sync) _retry(() => _sync(fd), path);} finally {// Do not retry close on EINTR: the fd may already have been released// and reused by another thread.diff --git a/desktop/lib/logging/log_file.dart b/desktop/lib/logging/log_file.dartindex 4cb60a1d6..ebc86b0a0 100644--- a/desktop/lib/logging/log_file.dart+++ b/desktop/lib/logging/log_file.dart@@ -17,8 +17,10 @@ import 'log_append.dart';/// files let anything past [retentionDays] be pruned automatically. This caps/// retained age, not a busy day's byte count.///-/// Immediate writes are synchronous and flushed. Routine diagnostics may opt-/// into bounded batches; an immediate write also commits the pending context.+/// Immediate writes are synchronous: the kernel has them when [append]+/// returns. Only a [durable] write or flush also fsyncs (see [appendLog] for+/// why routine records do not). Routine diagnostics may opt into bounded+/// batches; an immediate write also commits the pending context./// Every IO error is swallowed — diagnostics must never break the flow they/// only observe.class DailyLogFile {@@ -30,6 +32,7 @@ class DailyLogFile {this.maxBufferedCharacters = 64 * 1024,this.maxBufferedEntries = 256,this.appendFile = appendDurableLog,+ this.appendFileUnsynced = appendLog,DateTime Function() clock = DateTime.now,// The field is private, so an initialising formal would name the// PARAMETER `_clock` — which no caller outside this library could pass.@@ -66,9 +69,17 @@ class DailyLogFile {final int maxBufferedCharacters;final int maxBufferedEntries;- /// Durable append implementation, injectable for measurements using real IO.+ /// Durable append implementation (write and fsync), injectable for+ /// measurements using real IO. Called with empty contents to commit what+ /// earlier unsynced writes left in the kernel.final void Function(File file, String contents) appendFile;+ /// The append for everything not durable: the same write, no fsync.+ final void Function(File file, String contents) appendFileUnsynced;++ /// The last file written without an fsync since a durable write to it.+ File? _unsynced;+final List<String> _pending = [];int _pendingCharacters = 0;DateTime? _pendingAt;@@ -89,8 +100,9 @@ class DailyLogFile {/// Append [block] followed by a newline to today's file. Creates the directory/// on demand and prunes stale days on the first write after midnight; any- /// failure is swallowed.- void append(String block, {bool buffered = false}) {+ /// failure is swallowed. [durable] also fsyncs, with any pending batch and+ /// whatever unsynced writes this file holds.+ void append(String block, {bool buffered = false, bool durable = false}) {try {final now = _clock();if (_pendingAt case final at? when _ymd(at) != _ymd(now)) {@@ -98,13 +110,13 @@ class DailyLogFile {// today's file. The same rule handles a wall-clock correction.flush();}- if (!buffered || block.length + 1 >= maxBufferedCharacters) {+ if (durable || !buffered || block.length + 1 >= maxBufferedCharacters) {if (_pending.isEmpty) {- _appendNow(block, now);+ _appendNow(block, now, durable: durable);} else {- // The diagnostic and the lines leading to it share one durable write.+ // The diagnostic and the lines leading to it share one write._pending.add(block);- flush();+ flush(durable: durable);}return;}@@ -125,12 +137,25 @@ class DailyLogFile {}}- /// Commit any pending batch and cancel its timer. Empty flushes do no IO.- /// Called on errors, export, backgrounding, normal quit and updater handoff.- void flush() {+ /// Commit any pending batch and cancel its timer. Called on errors, export,+ /// backgrounding, normal quit and updater handoff; [durable] (errors, quit,+ /// handoff) also fsyncs, even with nothing pending when earlier writes were+ /// not. Otherwise an empty flush does no IO.+ void flush({bool durable = false}) {_bufferTimer?.cancel();_bufferTimer = null;- if (_pending.isEmpty) return;+ if (_pending.isEmpty) {+ final unsynced = _unsynced;+ if (durable && unsynced != null) {+ _unsynced = null;+ try {+ appendFile(unsynced, '');+ } catch (e) {+ _debugLog('DailyLogFile.flush failed: $e');+ }+ }+ return;+ }final block = _pending.join('\n');final at = _pendingAt!;// Release the batch even on disk failure, matching append's best-effort@@ -138,10 +163,10 @@ class DailyLogFile {_pending.clear();_pendingCharacters = 0;_pendingAt = null;- _appendNow(block, at);+ _appendNow(block, at, durable: durable);}- void _appendNow(String block, DateTime now) {+ void _appendNow(String block, DateTime now, {bool durable = false}) {try {final day = _ymd(now);final file = _fileFor(now);@@ -150,7 +175,13 @@ class DailyLogFile {_activeDay = day;_pruneOlderThan(now);}- appendFile(file, '$block\n');+ if (durable) {+ appendFile(file, '$block\n');+ if (_unsynced?.path == file.path) _unsynced = null;+ } else {+ appendFileUnsynced(file, '$block\n');+ _unsynced = file;+ }} catch (e) {// Best-effort: never surface an IO failure into the caller's flow._debugLog('DailyLogFile.append failed: $e');diff --git a/desktop/lib/logging/log_stream_sinks.dart b/desktop/lib/logging/log_stream_sinks.dartindex ce455c8d5..0bbad2606 100644--- a/desktop/lib/logging/log_stream_sinks.dart+++ b/desktop/lib/logging/log_stream_sinks.dart@@ -18,9 +18,9 @@ class FanoutAppLog implements FlushableAppLog {final List<AppLog> sinks;@override- void flush() {+ void flush({bool durable = false}) {for (final sink in sinks) {- if (sink is FlushableAppLog) sink.flush();+ if (sink is FlushableAppLog) sink.flush(durable: durable);}}diff --git a/desktop/lib/settings/experimental_features.dart b/desktop/lib/settings/experimental_features.dartindex 04c251632..3e166924b 100644--- a/desktop/lib/settings/experimental_features.dart+++ b/desktop/lib/settings/experimental_features.dart@@ -237,3 +237,23 @@ class ExperimentalFeaturesStore extends ChangeNotifier {super.dispose();}}++/// One experiment's [ExperimentalFeaturesStore.choice] as a listenable: null+/// until the account's settings are read. It notifies whenever the store does+/// — every 30 s read among them — so a listener compares with the value it+/// last saw.+class ExperimentChoice implements ValueListenable<bool?> {+ const ExperimentChoice(this.store, this.feature);++ final ExperimentalFeaturesStore store;+ final ExperimentalFeature feature;++ @override+ bool? get value => store.choice(feature);++ @override+ void addListener(VoidCallback listener) => store.addListener(listener);++ @override+ void removeListener(VoidCallback listener) => store.removeListener(listener);+}diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dartindex d17181dc4..353d41cfa 100644--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@ -1577,6 +1577,11 @@ class AppNotifier extends ChangeNotifier {},foreground: foreground,onActivity: applySharedActivity,+ // Off (the account default), every daemon refuses `shares`: not asked.+ messagesSwitch: ExperimentChoice(+ experimentalFeatures,+ ExperimentalFeature.agentMessages,+ ),);/// `tab_activity` on the computer [sharedTabs] asks: every harness of a desk@@ -6697,7 +6702,7 @@ class AppNotifier extends ChangeNotifier {'This copy of Harness cannot install updates automatically.';return false;}- flushAppLog();+ flushAppLog(durable: true);productRuntimeHealth?.cleanExit();exit(0);} catch (error) {diff --git a/desktop/lib/update/desktop_updater.dart b/desktop/lib/update/desktop_updater.dartindex af64a1077..02b888c60 100644--- a/desktop/lib/update/desktop_updater.dart+++ b/desktop/lib/update/desktop_updater.dart@@ -1,7 +1,8 @@import 'dart:async';import 'dart:io';+import 'dart:isolate';-import 'package:cryptography/cryptography.dart';+import 'package:cryptography/dart.dart' show DartSha256;import 'package:dio/dio.dart';import 'package:flutter/foundation.dart';@@ -122,6 +123,24 @@ List<int>? _parseSemverCore(String version) {String _singleQuote(String value) => "'${value.replaceAll("'", "'\\''")}'";+/// The lowercase hex SHA-256 of [bytes], worked out on a background isolate.+///+/// A release download is ~45 MB, and the hash used to be awaited on the UI+/// isolate — but `Sha256().hash` is pure Dart and synchronous underneath+/// (`DartHashAlgorithmMixin.hash` calls `hashSync`), so every Update froze the+/// window for the whole of it: 45 MiB took 535 ms in an AOT build and ~560 ms+/// under `flutter test` (i7-10700K, 2026-10-17). Same algorithm, same digest;+/// only the isolate changes. A top-level function, so the closure carries+/// nothing but the bytes, which are copied to the worker once.+Future<String> sha256HexOffUiIsolate(List<int> bytes) =>+ Isolate.run(() => _sha256Hex(bytes));++String _sha256Hex(List<int> bytes) => const DartSha256()+ .hashSync(bytes)+ .bytes+ .map((b) => b.toRadixString(16).padLeft(2, '0'))+ .join();+/// Resolves the path the running build should be swapped at.////// On macOS this walks up from the running executable to the enclosing@@ -364,10 +383,7 @@ class DesktopUpdater {);return null;}- final hash = await Sha256().hash(bytes);- final actualSha = hash.bytes- .map((b) => b.toRadixString(16).padLeft(2, '0'))- .join();+ final actualSha = await sha256HexOffUiIsolate(bytes);if (actualSha != info.sha256) {debugPrint('DesktopUpdater: sha256 mismatch for ${info.version} — discarding download',diff --git a/desktop/lib/ws/ws_conn.dart b/desktop/lib/ws/ws_conn.dartindex fff09efdf..c39db83e9 100644--- a/desktop/lib/ws/ws_conn.dart+++ b/desktop/lib/ws/ws_conn.dart@@ -641,6 +641,16 @@ class WsConn {type != 'pair_result' &&!type.startsWith('observer_');+ /// Refusals that are the daemon working as designed, logged at DEBUG: Agent+ /// Messages off (the account default) and an action an older CLI does not+ /// know. At WARN each was an immediate, fsync'd write to the app log on the+ /// UI isolate — once a minute for `shares` alone, for every account that+ /// never turned Agent Messages on — while saying nothing anyone acts on.+ static const _expectedRefusals = {'MESSAGES_OFF', 'UNKNOWN_ACTION'};++ static bool _expectedRefusal(Object error) =>+ error is WsRequestFailure && _expectedRefusals.contains(error.code);+Future<Map<String, dynamic>> request(String type, {Map<String, dynamic> payload = const {},@@ -669,8 +679,12 @@ class WsConn {// becomes an unhandled rejection.completer.future.then((value) => appLog.debug('ws', '← $type ${summariseForLog(value)}'),- onError: (Object error) =>- appLog.warn('ws', '← $type failed', error: error),+ onError: (Object error) => appLog.record(+ _expectedRefusal(error) ? AppLogLevel.debug : AppLogLevel.warn,+ 'ws',+ '← $type failed',+ error: error,+ ),);}final frame = {diff --git a/desktop/test/benchmarks/diagnostic_log_benchmark.dart b/desktop/test/benchmarks/diagnostic_log_benchmark.dartindex b56ff0918..fb25e8a95 100644--- a/desktop/test/benchmarks/diagnostic_log_benchmark.dart+++ b/desktop/test/benchmarks/diagnostic_log_benchmark.dart@@ -110,7 +110,15 @@ class _TimedLogFile extends DailyLogFile {Directory directory,DateTime Function() clock,void Function(File, String) appendFile,- ) : super(directory, 'app', clock: clock, appendFile: appendFile);+ ) : super(+ directory,+ 'app',+ clock: clock,+ appendFile: appendFile,+ // Every write durable, as when this benchmark was written: it+ // measures batching, not the fsync INFO/WARN have since dropped.+ appendFileUnsynced: appendFile,+ );final work = Stopwatch();var depth = 0;@@ -126,11 +134,14 @@ class _TimedLogFile extends DailyLogFile {}@override- void append(String block, {bool buffered = false}) =>- _measure(() => super.append(block, buffered: buffered));+ void append(String block, {bool buffered = false, bool durable = false}) =>+ _measure(+ () => super.append(block, buffered: buffered, durable: durable),+ );@override- void flush() => _measure(super.flush);+ void flush({bool durable = false}) =>+ _measure(() => super.flush(durable: durable));}class _Writes {diff --git a/desktop/test/buffered_log_test.dart b/desktop/test/buffered_log_test.dartindex b2766b345..d651b6171 100644--- a/desktop/test/buffered_log_test.dart+++ b/desktop/test/buffered_log_test.dart@@ -5,6 +5,7 @@ import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/crash_log.dart';import 'package:harness/core/harness_cli_runner.dart';import 'package:harness/logging/app_log.dart';+import 'package:harness/logging/cli_log.dart';import 'package:harness/logging/error_burst_filter.dart';import 'package:harness/logging/log_export.dart';import 'package:harness/logging/log_append.dart';@@ -243,7 +244,7 @@ void main() {});for (final level in [AppLogLevel.info, AppLogLevel.warn, AppLogLevel.error]) {- test('$level makes its preceding debug context durable immediately', () {+ test('$level writes its preceding debug context immediately', () {final sink = file();final log = FileAppLog(sink, bufferDebug: true);log.debug('ws', 'preceding context');@@ -263,6 +264,125 @@ void main() {});}+ // An fsync on the UI isolate waits for an ext4 journal commit on Linux+ // (10–500+ ms under I/O), and INFO/WARN fsynced every record: the best fit+ // for production's long frames, ~69 of 72 of them on two Linux computers.+ group('fsync', () {+ late List<(String, bool)> writes;++ DailyLogFile recorded() {+ writes = [];+ final result = DailyLogFile(+ dir,+ 'app',+ clock: () => DateTime(2026, 10, 1, 12),+ appendFile: (file, contents) {+ writes.add((contents, true));+ appendDurableLog(file, contents);+ },+ appendFileUnsynced: (file, contents) {+ writes.add((contents, false));+ appendLog(file, contents);+ },+ );+ files.add(result);+ return result;+ }++ test('INFO and WARN write at once without one; an admitted ERROR has one, '+ 'with its context and stack', () {+ final at = DateTime(2026, 10, 1, 12);+ final sink = recorded();+ final log = FileAppLog(+ sink,+ bufferDebug: true,+ clock: () => at,+ burst: ErrorBurstFilter(clock: () => at),+ );+ log.debug('ws', 'context');+ log.info('app', 'started');+ log.warn('ws', 'poll failed');+ log.debug('ws', 'more context');+ log.failure(+ 'flutter',+ 'threw',+ stackTrace: StackTrace.fromString('frame one'),+ );+ log.failure('flutter', 'threw'); // suppressed by the burst filter+ expect(writes, [+ (+ '[2026-10-01 12:00:00] DEBUG ws context\n'+ '[2026-10-01 12:00:00] INFO app started\n',+ false,+ ),+ ('[2026-10-01 12:00:00] WARN ws poll failed\n', false),+ (+ '[2026-10-01 12:00:00] DEBUG ws more context\n'+ '[2026-10-01 12:00:00] ERROR flutter threw\n'+ ' frame one\n',+ true,+ ),+ ]);+ expect(+ sink.currentFile.readAsStringSync(),+ writes.map((w) => w.$1).join(),+ );+ });++ test('a durable flush syncs the pending batch, or else what was written '+ 'unsynced, and does nothing twice', () {+ final sink = recorded();+ sink.flush(durable: true);+ expect(writes, isEmpty, reason: 'nothing written, nothing to sync');+ sink.append('immediate');+ sink.flush(durable: true);+ sink.flush(durable: true);+ expect(writes, [('immediate\n', false), ('', true)]);+ sink.append('batched', buffered: true);+ sink.flush(durable: true);+ sink.flush(durable: true);+ expect(writes.skip(2), [('batched\n', true)]);+ sink.append('routine', buffered: true);+ sink.flush();+ expect(writes.skip(3), [('routine\n', false)]);+ expect(+ sink.currentFile.readAsStringSync(),+ 'immediate\nbatched\nroutine\n',+ );+ });++ test('flushAppLog fsyncs only when asked to', () {+ final sink = recorded();+ appLog = FileAppLog(sink, bufferDebug: true);+ appLog.debug('ws', 'one');+ flushAppLog();+ appLog.debug('ws', 'two');+ flushAppLog(durable: true);+ expect(writes.map((w) => w.$2), [false, true]);+ });++ test('a CLI transcript is written line by line without one', () {+ final sink = recorded();+ FileCliLog(sink).begin('harness auth status --json')+ ..output('{"signedIn":true}')+ ..end(exitCode: 0);+ expect(writes, hasLength(3));+ expect(writes.every((w) => !w.$2), isTrue);+ });++ test('the unsynced append keeps every byte, as the durable one does', () {+ final output = File('${dir.path}/log 日本語 🦋.txt');+ appendLog(output, 'first\n');+ appendDurableLog(output, '');+ appendLog(output, 'second 🦋\n');+ expect(output.readAsStringSync(), 'first\nsecond 🦋\n');+ expect(+ () => appendLog(File(dir.path), 'bad'),+ throwsA(isA<FileSystemException>()),+ );+ });+ });+test('duplicate errors preserve burst protection with interleaved debug context',() {diff --git a/desktop/test/desktop_updater_test.dart b/desktop/test/desktop_updater_test.dartindex 0ac6d10c3..a6b15362f 100644--- a/desktop/test/desktop_updater_test.dart+++ b/desktop/test/desktop_updater_test.dart@@ -1,8 +1,11 @@+import 'dart:async';import 'dart:convert';import 'dart:io';import 'dart:math' show min;+import 'dart:typed_data';import 'package:cryptography/cryptography.dart';+import 'package:cryptography/dart.dart' show DartSha256;import 'package:dio/dio.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/update/desktop_updater.dart';@@ -12,6 +15,65 @@ Future<String> _sha256Hex(List<int> bytes) async {return hash.bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join();}+String _sha256HexSync(List<int> bytes) => const DartSha256()+ .hashSync(bytes)+ .bytes+ .map((b) => b.toRadixString(16).padLeft(2, '0'))+ .join();++/// Serves [bytes] for any GET, in 64 KiB pieces as a socket would, without a+/// server on this isolate whose own copying would muddy [_EventLoopGaps].+class _MemoryAdapter implements HttpClientAdapter {+ _MemoryAdapter(this.bytes);+ final Uint8List bytes;++ @override+ Future<ResponseBody> fetch(+ RequestOptions options,+ Stream<Uint8List>? requestStream,+ Future<void>? cancelFuture,+ ) async {+ const piece = 64 << 10;+ return ResponseBody(+ Stream.fromIterable([+ for (var at = 0; at < bytes.length; at += piece)+ Uint8List.sublistView(bytes, at, min(at + piece, bytes.length)),+ ]),+ 200,+ headers: {+ Headers.contentLengthHeader: ['${bytes.length}'],+ },+ );+ }++ @override+ void close({bool force = false}) {}+}++/// The longest stretch the event loop went without running a 1 ms timer.+class _EventLoopGaps {+ final _clock = Stopwatch();+ Timer? _timer;+ var _last = Duration.zero, _longest = Duration.zero;++ void start() {+ _clock.start();+ _timer = Timer.periodic(const Duration(milliseconds: 1), (_) => _tick());+ }++ void _tick() {+ final now = _clock.elapsed;+ if (now - _last > _longest) _longest = now - _last;+ _last = now;+ }++ Duration stop() {+ _tick();+ _timer?.cancel();+ return _longest;+ }+}+/// Why the macOS half of this file is host-gated.////// `ditto` is macOS-only, and so is the branch it stands in for: unpacking a@@ -682,6 +744,64 @@ void main() {},);+ // A release is ~45 MB. Its hash ran synchronously on the UI isolate+ // (535 ms for 45 MiB in an AOT build), so nothing else — no frame, no+ // timer — ran until it finished. The same hash timed here, twice so the+ // second is warm, is the yardstick: the longest the event loop goes+ // unserved while the download is verified must be well under it (the old+ // code measured 0.96 of it; this one ~0.13; 0.75 leaves room for a busy CI+ // runner slowing both alike).+ test('downloadAndStage verifies a large download off the UI isolate', () async {+ final bytes = Uint8List(24 << 20);+ for (var i = 0; i < bytes.length; i += 4093) {+ bytes[i] = i & 0xff;+ }+ var onThisIsolate = const Duration(days: 1);+ late String expected;+ for (var round = 0; round < 2; round++) {+ final timing = Stopwatch()..start();+ expected = _sha256HexSync(bytes);+ if (timing.elapsed < onThisIsolate) onThisIsolate = timing.elapsed;+ }+ final dio = Dio()..httpClientAdapter = _MemoryAdapter(bytes);+ final updater = DesktopUpdater(+ enabled: true,+ dio: dio,+ isLinux: true,+ architecture: 'x64',+ );+ final gaps = _EventLoopGaps()..start();+ final staged = await updater.downloadAndStage(+ UpdateInfo(+ version: newVersion,+ url: 'https://fixture.invalid/Harness-linux-x64.AppImage',+ sha256: expected,+ size: bytes.length,+ ),+ );+ final longest = gaps.stop();+ expect(staged, isNotNull, reason: 'the digest must still match');+ addTearDown(+ () => Directory(staged!.stagingDirPath).delete(recursive: true),+ );+ expect(File(staged!.bundlePath).lengthSync(), bytes.length);+ expect(+ longest,+ lessThan(onThisIsolate * 0.75),+ reason:+ 'the UI isolate went ${longest.inMilliseconds} ms without an event; '+ 'hashing these bytes here takes ${onThisIsolate.inMilliseconds} ms',+ );+ });++ test('the background digest is the sha256 the manifest carries', () async {+ expect(+ await sha256HexOffUiIsolate(utf8.encode('abc')),+ 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad',+ );+ expect(await sha256HexOffUiIsolate(appImageBytes), appImageSha);+ });+test('applyStaged on Linux execs the swapped AppImage file directly instead of `open -n`', () async {final calls = <String>[];final updater = DesktopUpdater(diff --git a/desktop/test/shared_tabs_app_test.dart b/desktop/test/shared_tabs_app_test.dartindex 7966f9f85..e6d5ebad5 100644--- a/desktop/test/shared_tabs_app_test.dart+++ b/desktop/test/shared_tabs_app_test.dart@@ -8,6 +8,7 @@ import 'package:harness/viewer/viewer_key_store.dart';import 'package:harness/viewer/viewer_services.dart';import 'package:harness/ws/ws_conn.dart';+import 'support/agent_messages_api.dart' show agentMessagesSwitch;import 'swarm_state_test.dart' show createApp, MemoryStore;const _tab = 'aaaaaaaaaaaaaaaaaaaaaaaa';@@ -139,6 +140,29 @@ void main() {expect(daemon.shareReads, before + 1);});+ // The account default. Every daemon refuses `shares` then; asking was a+ // WARN every 60 s and on each reconnect.+ test('with the account\'s Agent Messages switch off, a reconnect or '+ 'shared_tabs_changed asks nothing; turned on, shares are read', () async {+ final daemon = _Daemon('m');+ final app = _native(daemon);+ addTearDown(app.dispose);+ await agentMessagesSwitch(app, false);+ app.onMachineConnectedForTest('m');+ await app.handleEventForTest('m', {+ 'type': 'shared_tabs_changed',+ 'payload': {'rev': 2},+ });+ await app.sharedTabs.refresh();+ await Future<void>.delayed(Duration.zero);+ expect(daemon.shareReads, 0);+ expect(app.sharedTabs.state, SharedTabsState.off);+ await agentMessagesSwitch(app, true);+ await Future<void>.delayed(Duration.zero);+ expect(daemon.shareReads, 1);+ expect(app.sharedTabs.state, SharedTabsState.ready);+ });+test('sign-out resets shared tabs', () async {final daemon = _Daemon('m');final app = _native(daemon)diff --git a/desktop/test/shared_tabs_controller_test.dart b/desktop/test/shared_tabs_controller_test.dartindex 37a91cb91..caa740c2c 100644--- a/desktop/test/shared_tabs_controller_test.dart+++ b/desktop/test/shared_tabs_controller_test.dart@@ -60,6 +60,19 @@ void main() {expect(c.agentMessagesTabIds('other'), ['other']);});+ // tabForDesk asks every shared tab for its desk id, for each desk tab, on+ // every native menu flush; each answer was a fresh SHA-256.+ test("a member tab's desk id is worked out once, not on every ask", () async {+ final c = make((p) async => shares(rosters: [roster()]));+ await c.refresh();+ final tab = c.snapshot.tabs.single;+ final desk = tab.deskTabId('bob');+ expect(desk, memberDeskTabId(id1));+ expect(identical(tab.deskTabId('bob'), desk), isTrue);+ expect(identical(c.tabForDesk(desk!), tab), isTrue);+ expect(tab.deskTabId('alice'), isNull, reason: "the owner's: its own tab id");+ });+test("the owner's tab's Agent Messages are its desk tab's alone", () async {final c = make((p) async => shares(rosters: [roster(owner: 'bob', tabId: 'swarm-3')]));await c.refresh();@@ -194,6 +207,132 @@ void main() {});});+ // With the account's Agent Messages switch off (the default) every daemon+ // refuses `shares` with MESSAGES_OFF; asking anyway was a request and an+ // fsync'd WARN every 60 s and on each reconnect, for everyone.+ group("the account's Agent Messages switch", () {+ test('off: nothing is asked, by the poll or anything else, and the state is off', () {+ fakeAsync((async) {+ var reads = 0;+ final front = ValueNotifier(true);+ final on = ValueNotifier<bool?>(false);+ final c = SharedTabsController(+ request: (p) async {+ reads++;+ return shares(rosters: [roster()]);+ },+ foreground: front,+ messagesSwitch: on,+ );+ final watch = SharedTabsWatch(controller: c, foreground: front)..start();+ async.flushMicrotasks();+ expect(c.state, SharedTabsState.off);+ async.elapse(const Duration(minutes: 5));+ c.changed(); // a reconnect, or shared_tabs_changed+ front.value = false;+ front.value = true;+ async.elapse(const Duration(minutes: 5));+ expect(reads, 0);+ expect(c.state, SharedTabsState.off);+ watch.dispose();+ });+ });++ test('turned on: read at once, then every 60 s; off again: stops, and the shares are gone', () {+ fakeAsync((async) {+ var reads = 0;+ final front = ValueNotifier(true);+ final on = ValueNotifier<bool?>(false);+ final c = SharedTabsController(+ request: (p) async {+ reads++;+ return shares(rosters: [roster()]);+ },+ foreground: front,+ messagesSwitch: on,+ );+ final watch = SharedTabsWatch(controller: c, foreground: front)..start();+ on.value = true;+ async.flushMicrotasks();+ expect(reads, 1);+ expect(c.state, SharedTabsState.ready);+ expect(c.snapshot.tabs, hasLength(1));+ async.elapse(const Duration(seconds: 60));+ expect(reads, 2);+ on.value = false;+ expect(c.state, SharedTabsState.off);+ expect(c.snapshot.tabs, isEmpty);+ async.elapse(const Duration(minutes: 5));+ expect(reads, 2);+ watch.dispose();+ });+ });++ test('the settings store notifying with nothing changed starts no read', () {+ fakeAsync((async) {+ var reads = 0;+ final front = ValueNotifier(true);+ final on = _Switch(true);+ final c = SharedTabsController(+ request: (p) async {+ reads++;+ return shares();+ },+ foreground: front,+ messagesSwitch: on,+ );+ final watch = SharedTabsWatch(controller: c, foreground: front)..start();+ async.flushMicrotasks();+ expect(reads, 1);+ for (var i = 0; i < 10; i++) {+ async.elapse(const Duration(seconds: 5));+ on.ping(); // the store's 30 s read, the same answer+ }+ expect(reads, 1);+ async.elapse(const Duration(seconds: 10));+ expect(reads, 2, reason: 'the 60 s poll keeps its own pace');+ watch.dispose();+ });+ });++ test('not read yet, it asks as before; bound again (null), it remembers it was off', () async {+ var reads = 0;+ final on = ValueNotifier<bool?>(null);+ final c = SharedTabsController(+ request: (p) async {+ reads++;+ return shares();+ },+ foreground: ValueNotifier(true),+ messagesSwitch: on,+ );+ await c.refresh();+ expect(reads, 1);+ expect(c.state, SharedTabsState.ready);+ on.value = false;+ on.value = null;+ on.value = true;+ await pumpEventQueue();+ expect(reads, 2, reason: 'off to on through an unread store is a turn-on');+ });++ test('an answer in flight when it is turned off is dropped', () async {+ final gate = Completer<Map<String, dynamic>>();+ final on = ValueNotifier<bool?>(true);+ final c = SharedTabsController(+ request: (p) => gate.future,+ foreground: ValueNotifier(true),+ messagesSwitch: on,+ );+ final read = c.refresh();+ on.value = false;+ gate.complete(shares(rosters: [roster()]));+ await read;+ expect(c.state, SharedTabsState.off);+ expect(c.snapshot.tabs, isEmpty);+ });+ });+test('dismiss asks the daemon', () async {final asked = <Map<String, dynamic>>[];final notice = {'id': 'n1', 'sharedTabId': id1, 'kind': 'removed', 'at': '2026-10-16T10:00:00Z'};@@ -491,3 +630,14 @@ void main() {expect(c.state, SharedTabsState.unknown);});}++/// A switch that notifies without changing, as the settings store does on+/// every 30 s read.+class _Switch extends ChangeNotifier implements ValueListenable<bool?> {+ _Switch(this.value);++ @override+ bool? value;++ void ping() => notifyListeners();+}diff --git a/desktop/test/swarm_async_test.dart b/desktop/test/swarm_async_test.dartindex d9e0a2f1f..fbd1f66af 100644--- a/desktop/test/swarm_async_test.dart+++ b/desktop/test/swarm_async_test.dart@@ -279,6 +279,7 @@ void main() {1,reason: 'quit must commit the pending debug tail',);+ expect(log.durableFlushes, 1, reason: 'and fsync the day so far');await app.flushPaneLayout();expect(storage.values['swarm_layout_v1'], contains('Before quit'));await tester.pumpWidget(const SizedBox());@@ -310,6 +311,8 @@ void main() {expect(log.flushes, 1);await tester.pumpWidget(const SizedBox());expect(log.flushes, 2);+ // A desktop goes inactive on every focus change: write, never fsync.+ expect(log.durableFlushes, 0);app.dispose();},);@@ -413,9 +416,12 @@ void main() {}class _FlushLog implements FlushableAppLog {- var flushes = 0;+ var flushes = 0, durableFlushes = 0;@override- void flush() => flushes++;+ void flush({bool durable = false}) {+ flushes++;+ if (durable) durableFlushes++;+ }@overridevoid record(AppLogLevel level,diff --git a/desktop/test/ws_conn_test.dart b/desktop/test/ws_conn_test.dartindex f078ef49f..e82c43f92 100644--- a/desktop/test/ws_conn_test.dart+++ b/desktop/test/ws_conn_test.dart@@ -84,6 +84,20 @@ class FakeHub {},}),);+ } else if (frame['type'] == 'agent_messages') {+ // How a daemon answers `shares` and the rest with Agent Messages+ // off, or, from an older CLI, for an action it does not know.+ final request = frame['payload'] as Map;+ ws.add(+ jsonEncode({+ 'type': 'agent_messages_result',+ 'payload': {+ 'requestId': request['requestId'],+ 'error': request['refuseWith'] ?? 'MESSAGES_OFF',+ 'detail': 'refused by the fixture',+ },+ }),+ );} else if (frame['type'] == 'agent_close') {ws.add(jsonEncode({@@ -198,6 +212,57 @@ void main() {},);+ // `shares` is asked every 60 s, and with Agent Messages off (the account+ // default) every answer is MESSAGES_OFF: at WARN that was an immediate,+ // fsync'd app-log write each minute. Other refusals still warn.+ test('expected refusals are logged at DEBUG, others still at WARN', () async {+ final previousLog = appLog;+ final stream = LogStream();+ appLog = StreamAppLog(stream);+ addTearDown(() => appLog = previousLog);+ hub = await FakeHub.start();+ conn = WsConn(+ wsBaseUrl: 'ws://127.0.0.1:${hub.port}',+ autonomousEnv: 'test',+ machineId: 'fixture',+ accessTokenProvider: (_, _) async => 'fixture-token',+ onAuthFailure: (_) {},+ onEvent: (_) {},+ onStatus: (_) {},+ );+ await conn!.connect();+ for (final code in ['MESSAGES_OFF', 'UNKNOWN_ACTION']) {+ await expectLater(+ conn!.request(+ 'agent_messages',+ payload: {'action': 'shares', 'refuseWith': code},+ ),+ throwsA(isA<WsRequestFailure>()),+ );+ }+ await expectLater(+ conn!.request('agent_create'),+ throwsA(isA<WsRequestFailure>()),+ );+ // The logging listener runs after the caller's own error handler.+ await Future<void>.delayed(Duration.zero);+ final failures = {+ for (final e in stream.entries)+ if (e.message.endsWith('failed')) '${e.message} ${e.error}': e.level,+ };+ expect(failures, {+ '← agent_messages failed agent_messages_result: MESSAGES_OFF — '+ 'refused by the fixture':+ AppLogLevel.debug,+ '← agent_messages failed agent_messages_result: UNKNOWN_ACTION — '+ 'refused by the fixture':+ AppLogLevel.debug,+ '← agent_create failed agent_create_result: UNSUPPORTED_ON_REMOTE — '+ 'this machine cannot create agents':+ AppLogLevel.warn,+ });+ });+test('uses SSO subprotocol, environment, readiness, and machine_select',() async {