From fedebc245ea0b5cba59ec91b07171e35ec883fcf Mon Sep 17 00:00:00 2001 From: Mariano <132747814+mbelinky@users.noreply.github.com> Date: Wed, 18 Feb 2026 17:47:13 +0000 Subject: [PATCH] fix(protocol): align bool-first AnyCodable equality/hash dispatch (#20233) * fix(protocol): preserve booleans in AnyCodable bridge * fix(protocol): align AnyCodable bool-first type dispatch --- .../OpenClawKit/Sources/OpenClawProtocol/AnyCodable.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/shared/OpenClawKit/Sources/OpenClawProtocol/AnyCodable.swift b/apps/shared/OpenClawKit/Sources/OpenClawProtocol/AnyCodable.swift index 062005f1ed..4315bb073e 100644 --- a/apps/shared/OpenClawKit/Sources/OpenClawProtocol/AnyCodable.swift +++ b/apps/shared/OpenClawKit/Sources/OpenClawProtocol/AnyCodable.swift @@ -62,9 +62,9 @@ public struct AnyCodable: Codable, @unchecked Sendable, Hashable { public static func == (lhs: AnyCodable, rhs: AnyCodable) -> Bool { switch (lhs.value, rhs.value) { + case let (l as Bool, r as Bool): l == r case let (l as Int, r as Int): l == r case let (l as Double, r as Double): l == r - case let (l as Bool, r as Bool): l == r case let (l as String, r as String): l == r case (_ as NSNull, _ as NSNull): true case let (l as [String: AnyCodable], r as [String: AnyCodable]): l == r @@ -76,12 +76,12 @@ public struct AnyCodable: Codable, @unchecked Sendable, Hashable { public func hash(into hasher: inout Hasher) { switch self.value { + case let v as Bool: + hasher.combine(2); hasher.combine(v) case let v as Int: hasher.combine(0); hasher.combine(v) case let v as Double: hasher.combine(1); hasher.combine(v) - case let v as Bool: - hasher.combine(2); hasher.combine(v) case let v as String: hasher.combine(3); hasher.combine(v) case _ as NSNull: