From cb60b0a6851025062b8a0ea685d8638df0aa179a Mon Sep 17 00:00:00 2001 From: Ayman Hamed Date: Tue, 25 Aug 2026 14:40:11 +0300 Subject: [PATCH] sim_list: actionable guidance when no simulators exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A fresh Xcode (no iOS runtime) made the model call sim_list repeatedly and attempt sim_build_install without boot — the bare 'No simulators available' gave it nothing to act on. The empty result now says: don't retry; check/download a runtime (xcodebuild -downloadPlatform iOS), create a device via simctl, or ask the user to install one in Xcode. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Tools/SimLifecycleTools.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Sources/SwiftAgentKitSimulator/Tools/SimLifecycleTools.swift b/Sources/SwiftAgentKitSimulator/Tools/SimLifecycleTools.swift index 3d8f295..0bd50eb 100644 --- a/Sources/SwiftAgentKitSimulator/Tools/SimLifecycleTools.swift +++ b/Sources/SwiftAgentKitSimulator/Tools/SimLifecycleTools.swift @@ -18,7 +18,20 @@ public struct SimListTool: AgentTool { do { let devices = try await Simctl.listDevices() if devices.isEmpty { - return .success(toolCallId: "", toolName: name, result: "No simulators available.") + // Fresh machine (new Xcode install, no runtimes downloaded). + // A bare "none available" was observed sending the model into + // a retry loop — give it the actionable next step instead. + return .success(toolCallId: "", toolName: name, result: """ + No simulators exist on this Mac — likely a fresh Xcode with no iOS \ + runtime downloaded. Do NOT call sim_list again; it will not change. \ + To fix, run via run_shell: `xcrun simctl runtime list` to check \ + installed runtimes; if none, download one with \ + `xcodebuild -downloadPlatform iOS` (several GB, takes minutes), \ + then create a device: \ + `xcrun simctl create "iPhone 16" com.apple.CoreSimulator.SimDeviceType.iPhone-16`. \ + Or ask the user to open Xcode → Settings → Components and install an \ + iOS simulator runtime. + """) } let lines = devices.map { d in "\(d.isBooted ? "● " : "○ ")\(d.name) [\(d.udid)] \(d.runtime)\(d.isBooted ? " (Booted)" : "")"