Skip to content

Comments

fix(mac): add Sendable conformance to generated Swift protocol structs#195

Merged
steipete merged 5 commits intoopenclaw:mainfrom
andranik-sahakyan:fix/swift-sendable-protocol-gen
Jan 4, 2026
Merged

fix(mac): add Sendable conformance to generated Swift protocol structs#195
steipete merged 5 commits intoopenclaw:mainfrom
andranik-sahakyan:fix/swift-sendable-protocol-gen

Conversation

@andranik-sahakyan
Copy link
Contributor

Summary

Adds Sendable conformance to all structs generated by protocol-gen-swift.ts.

Problem

Swift 6's strict concurrency checking requires types passed across actor boundaries to conform to Sendable. The generated GatewayModels.swift structs are used in async contexts (e.g., OnboardingWizard.swift) but don't conform to Sendable, causing build failures:

error: non-Sendable 'WizardStartResult'-typed result can not be returned from actor-isolated instance method

Solution

One-line change to the generator:

-  lines.push(\`public struct \${name}: Codable {\`);
+  lines.push(\`public struct \${name}: Codable, Sendable {\`);

All generated structs only contain value types (strings, ints, optionals, arrays of Codable), so they're safe to be Sendable.

Testing

  • Tested locally - macOS app builds successfully with this fix
  • Ran pnpm lint - no errors
  • Verified generated GatewayModels.swift includes Sendable conformance

AI Disclosure 🤖

  • AI-assisted (Claude)
  • Fully tested locally
  • I understand what the code does

This fix was discovered while setting up clawdbot on a fresh machine and attempting to build the macOS app from source.

@steipete steipete merged commit d9a9f6d into openclaw:main Jan 4, 2026
13 checks passed
@steipete
Copy link
Contributor

steipete commented Jan 4, 2026

Thanks @andranik-sahakyan — great catch. Landed (incl. generator regen + CI lint fix + changelog credit).

@andranik-sahakyan andranik-sahakyan deleted the fix/swift-sendable-protocol-gen branch January 4, 2026 22:42
dgarson added a commit to dgarson/clawdbot that referenced this pull request Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants