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
perf(desktop): open the workspace while the daemon is still scanning
0xdiego2522d9ba79a126
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dartindex 8320735e3..672f7a23e 100644--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@ -4058,10 +4058,15 @@ class AppNotifier extends ChangeNotifier {if (previous == null || previous.computerId != endpoint.computerId) {continue;}- if (!mapEquals(previous.agentProjects, endpoint.agentProjects)) {+ final scanEnded = previous.scanning && !endpoint.scanning;+ if (!mapEquals(previous.agentProjects, endpoint.agentProjects) ||+ previous.scanning != endpoint.scanning) {machine.localEndpoint = endpoint;changed = true;}+ // The list this window loaded while the daemon was still on its first scan may have been+ // missing agents (see LocalCliEndpoint.scanning): ask again now that it is complete.+ if (scanEnded) unawaited(_loadMachineData(machine, force: true));if (!kUnderTest) {for (final project in endpoint.agentProjects.values) {unawaited(_localGitProjects.read(project.cwd));diff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dartindex 3ddc9c164..675fdb350 100644--- a/desktop/lib/widgets/pane_grid.dart+++ b/desktop/lib/widgets/pane_grid.dart@@ -1672,6 +1672,18 @@ class _PaneContent extends StatelessWidget {onClose: close,);}+ // The daemon is still on its first scan, so an agent missing from the list may simply not have+ // been reached yet — say "loading", not "gone" (owner, 2026-10-01). It attaches on its own.+ if (agentName == null && (machine.localEndpoint?.scanning ?? false)) {+ return _PaneStatus(+ activity: activityMark,+ title: kUntitledPane,+ icon: AppIcons.hourglass,+ message: 'Loading harnesses on ${machine.machine.displayName}…',+ busy: true,+ onClose: close,+ );+ }if (agentName == null) {return _PaneStatus(activity: activityMark,diff --git a/desktop/lib/ws/local_cli_discovery.dart b/desktop/lib/ws/local_cli_discovery.dartindex 5fc0abe26..6535d6156 100644--- a/desktop/lib/ws/local_cli_discovery.dart+++ b/desktop/lib/ws/local_cli_discovery.dart@@ -41,6 +41,13 @@ class LocalCliEndpoint {/// on the loopback port. [wsUri] names the same endpoint either way.final String? socketPath;+ /// The daemon is still on its first scan for agents (`discoveryReady: false`). NOT part of+ /// readiness, for the same reason [backendOnline] is not: its socket already serves every agent it+ /// knows, restored tiles wait as intent and attach as each agent's `agent_synced` arrives, so+ /// holding the app on "Starting local service…" for the scan only made the window late (owner,+ /// 2026-10-01; measured 2–2.5 s of a cold start). The next probe clears it.+ final bool scanning;+const LocalCliEndpoint({required this.computerId,required this.wsUri,@@ -50,6 +57,7 @@ class LocalCliEndpoint {this.backendOnline = true,this.agentProjects = const {},this.socketPath,+ this.scanning = false,});}@@ -606,16 +614,9 @@ class LocalCliDiscovery {if (body == null) {return const LocalCliProbe.notReady('not a harness status');}- // New CLIs expose the initial terminal scan explicitly. A missing field means an older CLI and- // remains accepted for backward compatibility; false means the daemon is alive but not ready to- // publish an authoritative empty/non-empty agent list yet.- if (body['discoveryReady'] == false) {- return LocalCliProbe.notReady(- 'still scanning for agents',- pid: pid,- version: version,- );- }+ // New CLIs expose the initial terminal scan explicitly; false means the daemon is alive but its+ // agent list is not complete yet. Reported, not gated on — see [LocalCliEndpoint.scanning].+ final scanning = body['discoveryReady'] == false;// `connected` is the daemon's own backend-socket state. It used to gate readiness — so a// computer that could not reach the backend never got past "Starting local service…", with a// daemon, tmux and every agent sitting right there on the loopback. It is reported instead@@ -672,6 +673,7 @@ class LocalCliDiscovery {identity.environment,),socketPath: socketPath,+ scanning: scanning,),pid: pid,version: version,diff --git a/desktop/test/local_cli_discovery_test.dart b/desktop/test/local_cli_discovery_test.dartindex a3532bb4d..92be014ee 100644--- a/desktop/test/local_cli_discovery_test.dart+++ b/desktop/test/local_cli_discovery_test.dart@@ -62,41 +62,40 @@ void main() {);});- test(- 'waits while a new CLI is still performing initial terminal discovery',- () async {- const computerId = '0123456789abcdef0123456789abcdef';- final identityFile = File('${scratch.path}/computer-id')- ..writeAsStringSync(computerId);- server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0);- server!.listen((request) async {- request.response.headers.contentType = ContentType.json;- request.response.write(- jsonEncode({- 'computerId': computerId,- 'discoveryReady': false,- 'localWs': {- 'path': '/api/local-ws',- 'protocolVersion': 1,- 'terminalProtocolVersion': 3,- 'e2ee': false,- },- }),- );- await request.response.close();- });+ test('a CLI still on its initial terminal discovery is usable, and says it is scanning', () async {+ const computerId = '0123456789abcdef0123456789abcdef';+ final identityFile = File('${scratch.path}/computer-id')+ ..writeAsStringSync(computerId);+ server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0);+ server!.listen((request) async {+ request.response.headers.contentType = ContentType.json;+ request.response.write(+ jsonEncode({+ 'computerId': computerId,+ 'discoveryReady': false,+ 'localWs': {+ 'path': '/api/local-ws',+ 'protocolVersion': 1,+ 'terminalProtocolVersion': 3,+ 'e2ee': false,+ },+ }),+ );+ await request.response.close();+ });- final endpoint = await LocalCliDiscovery(- config: AppConfig(- apiBaseUrl: 'https://harness-api.autonomous.ai',- localCliBaseUrl: 'http://127.0.0.1:${server!.port}',- ),- identity: LocalMachineIdentity(computerIdFile: identityFile),- ).discover();+ final endpoint = await LocalCliDiscovery(+ config: AppConfig(+ apiBaseUrl: 'https://harness-api.autonomous.ai',+ localCliBaseUrl: 'http://127.0.0.1:${server!.port}',+ ),+ identity: LocalMachineIdentity(computerIdFile: identityFile),+ ).discover();- expect(endpoint, isNull);- },- );+ // Not a reason to hold the window: tiles wait as intent and attach as agents arrive.+ expect(endpoint, isNotNull);+ expect(endpoint!.scanning, isTrue);+ });test('rejects non-loopback and mismatched status endpoints', () async {const computerId = 'abcdef0123456789abcdef0123456789';@@ -214,7 +213,8 @@ void main() {const computerId = '0123456789abcdef0123456789abcdef';final identityFile = File('${scratch.path}/computer-id')..writeAsStringSync(computerId);- var status = readyStatus(computerId, extra: {'discoveryReady': false});+ // Not ready: a daemon answering for another computer.+ var status = readyStatus('fedcba9876543210fedcba9876543210');server = await serveStatus(await freePort(), () => status);final checked = <int>[];final discovery = discoveryFor(@@ -435,30 +435,32 @@ void main() {);test(- 'a daemon still scanning for agents is NOT READY, and says so',+ 'a daemon still scanning for agents is READY, marked scanning',() async {server = await serveStatus(0,() => readyStatus(computerId, extra: {'discoveryReady': false}),);final probe = await discoveryFor(server!.port, identityFile).probe();- expect(probe.state, LocalCliProbeState.notReady);- expect(probe.reason, 'still scanning for agents');+ expect(probe.state, LocalCliProbeState.ready);+ expect(probe.endpoint!.scanning, isTrue);expect(probe.pid, 4242);expect(probe.version, '9.9.9');- expect(probe.endpoint, isNull);},);- test('a daemon still scanning for agents is NOT READY', () async {- server = await serveStatus(- 0,- () => readyStatus(computerId, extra: {'discoveryReady': false}),- );- final probe = await discoveryFor(server!.port, identityFile).probe();- expect(probe.state, LocalCliProbeState.notReady);- expect(probe.reason, 'still scanning for agents');- });+ test(+ 'a daemon that has finished scanning is not marked scanning',+ () async {+ server = await serveStatus(+ 0,+ () => readyStatus(computerId, extra: {'discoveryReady': true}),+ );+ final probe = await discoveryFor(server!.port, identityFile).probe();+ expect(probe.state, LocalCliProbeState.ready);+ expect(probe.endpoint!.scanning, isFalse);+ },+ );test('a daemon for another computer is NOT READY, not down', () async {server = await serveStatus(@@ -502,14 +504,35 @@ void main() {expect(spawned, isFalse);});+ test('ensureRunning does not wait for a daemon that is still scanning for agents', () async {+ const computerId = '0123456789abcdef0123456789abcdef';+ final identityFile = File('${scratch.path}/computer-id')+ ..writeAsStringSync(computerId);+ server = await serveStatus(+ 0,+ () => readyStatus(computerId, extra: {'discoveryReady': false}),+ );+ final watch = Stopwatch()..start();+ final probe = await discoveryFor(+ server!.port,+ identityFile,+ ).ensureRunning(readyTimeout: const Duration(seconds: 5));+ expect(probe.state, LocalCliProbeState.ready);+ expect(probe.endpoint!.scanning, isTrue);+ expect(watch.elapsedMilliseconds, lessThan(1000));+ });+test('ensureRunning waits for a daemon that answers but is not ready, without spawning', () async {const computerId = '0123456789abcdef0123456789abcdef';final identityFile = File('${scratch.path}/computer-id')..writeAsStringSync(computerId);var scanned = false;+ // Answers, but not ready yet: for another computer until it flips.server = await serveStatus(0,- () => readyStatus(computerId, extra: {'discoveryReady': scanned}),+ () => readyStatus(+ scanned ? computerId : 'fedcba9876543210fedcba9876543210',+ ),);var spawned = false;final discovery = discoveryFor(@@ -533,7 +556,7 @@ void main() {..writeAsStringSync(computerId);server = await serveStatus(0,- () => readyStatus(computerId, extra: {'discoveryReady': false}),+ () => readyStatus('fedcba9876543210fedcba9876543210'),);var spawned = false;final probe = await discoveryFor(@@ -544,7 +567,7 @@ void main() {},).ensureRunning(readyTimeout: const Duration(milliseconds: 600));expect(probe.state, LocalCliProbeState.notReady);- expect(probe.reason, 'still scanning for agents');+ expect(probe.reason, 'a daemon for a different computer');expect(spawned, isFalse);});