Skip to content

Commit 0fc3519

Browse files
chore: merge current main for exact-head CI
Punchcard-Session: amber-workshop-workshop-36 Co-authored-by: Galin Iliev <[email protected]>
2 parents a089616 + 4cb33d4 commit 0fc3519

326 files changed

Lines changed: 17206 additions & 4421 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/actions/setup-node-env/action.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,23 +154,23 @@ runs:
154154
# Blacksmith transparently accelerates the upstream Actions cache API.
155155
# The scheduled/dispatch warmer writes one immutable protected archive;
156156
# all CI shards restore it into isolated runner-local directories.
157-
key: ${{ github.repository }}-vitest-fs-v3-protected-${{ runner.os }}-${{ runner.arch }}-node-${{ inputs.node-version }}-${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', '**/package.json', '**/tsconfig*.json', 'vitest.config.*', 'test/vitest/**', '!**/node_modules/**') }}-${{ github.run_id }}-${{ github.run_attempt }}
157+
key: ${{ github.repository }}-vitest-fs-v3-protected-${{ runner.os }}-${{ runner.arch }}-node-${{ inputs.node-version }}-${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', '**/package.json', '**/tsconfig*.json', 'vitest.config.*', 'test/vitest/**', 'src/state/*.sql', '!**/node_modules/**') }}-${{ github.run_id }}-${{ github.run_attempt }}
158158
restore-keys: |
159-
${{ github.repository }}-vitest-fs-v3-protected-${{ runner.os }}-${{ runner.arch }}-node-${{ inputs.node-version }}-${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', '**/package.json', '**/tsconfig*.json', 'vitest.config.*', 'test/vitest/**', '!**/node_modules/**') }}-
159+
${{ github.repository }}-vitest-fs-v3-protected-${{ runner.os }}-${{ runner.arch }}-node-${{ inputs.node-version }}-${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', '**/package.json', '**/tsconfig*.json', 'vitest.config.*', 'test/vitest/**', 'src/state/*.sql', '!**/node_modules/**') }}-
160160
161161
- name: Restore Vitest transform cache
162162
if: inputs.vitest-fs-cache == 'true' && inputs.save-vitest-fs-cache != 'true' && runner.os != 'Windows'
163163
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
164164
with:
165165
path: /var/tmp/openclaw-vitest-fs-cache
166-
key: ${{ github.repository }}-vitest-fs-v3-protected-${{ runner.os }}-${{ runner.arch }}-node-${{ inputs.node-version }}-${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', '**/package.json', '**/tsconfig*.json', 'vitest.config.*', 'test/vitest/**', '!**/node_modules/**') }}-${{ github.run_id }}-${{ github.run_attempt }}
166+
key: ${{ github.repository }}-vitest-fs-v3-protected-${{ runner.os }}-${{ runner.arch }}-node-${{ inputs.node-version }}-${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', '**/package.json', '**/tsconfig*.json', 'vitest.config.*', 'test/vitest/**', 'src/state/*.sql', '!**/node_modules/**') }}-${{ github.run_id }}-${{ github.run_attempt }}
167167
restore-keys: |
168-
${{ github.repository }}-vitest-fs-v3-protected-${{ runner.os }}-${{ runner.arch }}-node-${{ inputs.node-version }}-${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', '**/package.json', '**/tsconfig*.json', 'vitest.config.*', 'test/vitest/**', '!**/node_modules/**') }}-
168+
${{ github.repository }}-vitest-fs-v3-protected-${{ runner.os }}-${{ runner.arch }}-node-${{ inputs.node-version }}-${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', '**/package.json', '**/tsconfig*.json', 'vitest.config.*', 'test/vitest/**', 'src/state/*.sql', '!**/node_modules/**') }}-
169169
170170
- name: Configure Vitest transform cache
171171
if: inputs.vitest-fs-cache == 'true' && runner.os != 'Windows'
172172
env:
173-
CACHE_GENERATION: ${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', '**/package.json', '**/tsconfig*.json', 'vitest.config.*', 'test/vitest/**', '!**/node_modules/**') }}
173+
CACHE_GENERATION: ${{ hashFiles('pnpm-lock.yaml', 'pnpm-workspace.yaml', '**/package.json', '**/tsconfig*.json', 'vitest.config.*', 'test/vitest/**', 'src/state/*.sql', '!**/node_modules/**') }}
174174
CACHE_WRITER: ${{ inputs.save-vitest-fs-cache == 'true' && '1' || '0' }}
175175
shell: bash
176176
run: |

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Docs: https://docs.openclaw.ai
6565

6666
### Fixes
6767

68+
- **Control UI profile avatar refreshes:** carry canonical content revisions through mutation responses and live presence so rapid replacements refresh every connected browser without stale cache rollback. Thanks @shakkernerd.
6869
- **Control UI appearance accessibility:** keep the unavailable custom-theme card announced as an Import command while preserving selected-state semantics for selectable themes and text sizes. Thanks @shakkernerd.
6970
- **Control UI dashboard index refresh:** keep an open Dashboards page current after session changes, agent-scope updates, and Gateway reconnects while preserving the last safe list until replacement hydration completes. Fixes #120602. Thanks @shakkernerd.
7071
- **Browser extension relay security:** require canonical 64-character relay secrets and safe WebSocket pairing URLs, and recheck OpenClaw tab-group consent at the extension edge before every authority-bearing existing-tab command.

‎apps/macos/Sources/OpenClaw/CLIInstaller.swift‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,8 @@ enum CLIInstaller {
573573
paused: Bool = AppStateStore.shared.isPaused,
574574
start: @MainActor () -> Void = { GatewayProcessManager.shared.setActive(true) },
575575
waitUntilReady: @MainActor () async -> Bool = {
576-
await GatewayProcessManager.shared.waitForGatewayReady(timeout: 12)
576+
await GatewayProcessManager.shared.waitForGatewayReady(
577+
timeout: GatewayLaunchAgentManager.startupMigrationTolerance)
577578
}) async -> LocalGatewayActivation
578579
{
579580
guard mode == .local, !paused else { return .deferred }

‎apps/macos/Sources/OpenClaw/CommandResolver.swift‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import Foundation
33
enum CommandResolver {
44
private static let projectRootDefaultsKey = "openclaw.gatewayProjectRootPath"
55
private static let helperName = "openclaw"
6+
/// Version probes may queue under machine load; keep command resolution tolerant but bounded.
7+
static let versionProbeTimeout: TimeInterval = 10
68

79
static func gatewayEntrypoint(in root: URL) -> String? {
810
let distEntry = root.appendingPathComponent("dist/index.js").path

‎apps/macos/Sources/OpenClaw/GatewayEnvironment.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ enum GatewayEnvironment {
332332
path: binary,
333333
arguments: ["--version"],
334334
environment: ["PATH": searchPaths.joined(separator: ":")],
335-
timeout: 2)
335+
timeout: CommandResolver.versionProbeTimeout)
336336
let elapsedMs = Int(Date().timeIntervalSince(start) * 1000)
337337
if elapsedMs > 500 {
338338
self.logger.warning(

‎apps/macos/Sources/OpenClaw/GatewayLaunchAgentManager.swift‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ enum GatewayLaunchAgentManager {
88

99
private static let logger = Logger(subsystem: "ai.openclaw", category: "gateway.launchd")
1010
private static let disableLaunchAgentMarker = ".openclaw/disable-launchagent"
11+
/// A first-run daemon command may wait behind state integrity checks and the shared startup-
12+
/// migration lease. Keep the app from killing healthy migration work before it can finish.
13+
static let startupMigrationTolerance: TimeInterval = 120
1114

1215
private static var disableLaunchAgentMarkerURL: URL {
1316
#if DEBUG
@@ -130,7 +133,7 @@ enum GatewayLaunchAgentManager {
130133
self.logger.info("launchd restart skipped (disable marker set)")
131134
return nil
132135
}
133-
return await self.runDaemonCommand(["restart"], timeout: 20)
136+
return await self.runDaemonCommand(["restart"])
134137
}
135138

136139
static func launchdConfigSnapshot() -> LaunchAgentPlistSnapshot? {
@@ -234,7 +237,7 @@ extension GatewayLaunchAgentManager {
234237

235238
private static func runDaemonCommand(
236239
_ args: [String],
237-
timeout: Double = 15,
240+
timeout: Double = Self.startupMigrationTolerance,
238241
quiet: Bool = false) async -> String?
239242
{
240243
let result = await self.runDaemonCommandResult(args, timeout: timeout, quiet: quiet)

‎apps/macos/Sources/OpenClaw/GatewayProcessManager.swift‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -698,14 +698,13 @@ extension GatewayProcessManager {
698698
context: LaunchAgentStartupContext,
699699
startGeneration: UInt64,
700700
readinessWindow: TimeInterval = 6,
701-
// A fresh install gets ten six-second probe windows for Local Network authorization.
702-
firstInstallReadinessGraceWindows: Int = 9) async
701+
// Fresh installs keep probing through the same first-run migration budget as the CLI.
702+
firstInstallReadinessBudget: TimeInterval = GatewayLaunchAgentManager.startupMigrationTolerance) async
703703
{
704704
let startedAt = Date()
705705
var deadline = startedAt.addingTimeInterval(readinessWindow)
706-
let graceWindowCount = max(0, firstInstallReadinessGraceWindows)
707706
let finalProbeDeadline = startedAt.addingTimeInterval(
708-
readinessWindow * (Double(graceWindowCount) + 1))
707+
max(readinessWindow, firstInstallReadinessBudget))
709708
var latestRetryDisposition: GatewayProbeFailureDisposition?
710709
var readinessPID = context.readinessPID
711710
var freshInstallGraceAuthorized = false
@@ -983,7 +982,8 @@ extension GatewayProcessManager {
983982
launchAgentInstalled: Bool = false) async -> Bool
984983
{
985984
let startGeneration = self.gatewayStartGeneration
986-
if let result = await self.observeCurrentGatewayStart(generation: startGeneration) { return result }
985+
if await self.observeCurrentGatewayStart(generation: startGeneration) == true { return true }
986+
guard !Task.isCancelled, self.isCurrentGatewayStart(startGeneration) else { return false }
987987
let readinessCandidate = self.launchAgentReadinessCandidate
988988
let readinessFailure = self.launchAgentReadinessFailure
989989
let readinessRevision = self.launchAgentReadinessRevision
@@ -1337,7 +1337,7 @@ extension GatewayProcessManager {
13371337
port: Int,
13381338
pid: Int32,
13391339
readinessWindow: TimeInterval,
1340-
firstInstallReadinessGraceWindows: Int)
1340+
firstInstallReadinessBudget: TimeInterval)
13411341
{
13421342
self.desiredActive = true
13431343
self.status = .starting
@@ -1354,7 +1354,7 @@ extension GatewayProcessManager {
13541354
readinessRevision: readinessRevision),
13551355
startGeneration: generation,
13561356
readinessWindow: readinessWindow,
1357-
firstInstallReadinessGraceWindows: firstInstallReadinessGraceWindows)
1357+
firstInstallReadinessBudget: firstInstallReadinessBudget)
13581358
}
13591359
}
13601360
}

‎apps/macos/Sources/OpenClaw/RuntimeLocator.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ enum RuntimeLocator {
147147
path: binary,
148148
arguments: ["--version"],
149149
environment: ["PATH": pathEnv],
150-
timeout: 2)
150+
timeout: CommandResolver.versionProbeTimeout)
151151
let elapsedMs = Int(Date().timeIntervalSince(start) * 1000)
152152
if elapsedMs > 500 {
153153
self.logger.warning(

‎apps/macos/Tests/OpenClawIPCTests/GatewayEnvironmentTests.swift‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ struct GatewayEnvironmentTests {
7272
#expect(version == "2026.7.29")
7373
}
7474

75+
@Test func `gateway version probe tolerates loaded host delay`() async throws {
76+
let root = try makeTempDirForTests()
77+
defer { try? FileManager.default.removeItem(at: root) }
78+
let gateway = root.appendingPathComponent("openclaw")
79+
try "#!/bin/sh\nsleep 2.1\necho OpenClaw 2026.7.30\n"
80+
.write(to: gateway, atomically: true, encoding: .utf8)
81+
try FileManager.default.setAttributes([.posixPermissions: 0o755], ofItemAtPath: gateway.path)
82+
83+
let version = await GatewayEnvironment.installedGatewayVersion(
84+
gatewayBin: gateway.path,
85+
projectRoot: root,
86+
searchPaths: [root.path, "/usr/bin", "/bin"])
87+
88+
#expect(version == "2026.7.30")
89+
}
90+
7591
@Test func `gateway launch resolution scans preferred paths once`() async throws {
7692
let root = try makeTempDirForTests()
7793
defer { try? FileManager.default.removeItem(at: root) }

‎apps/macos/Tests/OpenClawIPCTests/GatewayLaunchAgentManagerTests.swift‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import Testing
44

55
@Suite(.serialized)
66
struct GatewayLaunchAgentManagerTests {
7+
@Test func `daemon commands tolerate first run state migrations`() {
8+
#expect(GatewayLaunchAgentManager.startupMigrationTolerance >= 120)
9+
}
10+
711
@Test func `reads Gateway service ownership command directly from launchd`() throws {
812
let url = FileManager.default.temporaryDirectory
913
.appendingPathComponent("openclaw-gateway-\(UUID().uuidString).plist")

0 commit comments

Comments
 (0)