Skip to content

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
Copy Markdown
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
Copy Markdown
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
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
openclaw#195)

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

* fix(mac): make generated protocol types Sendable

* chore(mac): drop redundant Sendable extensions

* docs(changelog): thank @andranik-sahakyan for Sendable fix

* chore(swiftformat): exclude generated protocol models

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
ph0t0bar added a commit to ph0t0bar/openclaw that referenced this pull request Mar 17, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
openclaw#195)

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

* fix(mac): make generated protocol types Sendable

* chore(mac): drop redundant Sendable extensions

* docs(changelog): thank @andranik-sahakyan for Sendable fix

* chore(swiftformat): exclude generated protocol models

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
openclaw#195)

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

* fix(mac): make generated protocol types Sendable

* chore(mac): drop redundant Sendable extensions

* docs(changelog): thank @andranik-sahakyan for Sendable fix

* chore(swiftformat): exclude generated protocol models

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
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