OpenClawKit uses Swift Testing (import Testing) for unit, E2E and gated live coverage.
swift testAt 2026.3.0 this runs 3,711 tests on macOS (Xcode 27.1, Swift 6.4). The Linux runtime
target runs 533 tests under Swift 6.2.
Tests/OpenClawKitTests- unit-level tests for protocol, core shims, runtime primitives, diagnostics, facade helpers, the gateway client, native state, Talk, Watch, ChatUI, ChatStore, App Intents, providers (including the stubbed live-provider regressions) and Apple Foundation Models
Tests/OpenClawKitE2ETests- end-to-end tests across transport/runtime/channels/plugin flow and reconnect lifecycle
Tests/OpenClawLinuxRuntimeTests- Linux-focused runtime, provider, gateway, channel, MCP, memory and config-contract regressions exercised in CI and Docker
Tests/Fixtures/Config- upstream config corpus, doctor and talk contract fixtures, synced with
Scripts/sync-config-fixtures.sh
- upstream config corpus, doctor and talk contract fixtures, synced with
Run this before committing networking changes:
Scripts/check-networking-concurrency.shThis builds the networking-related targets (including OpenClawMCP, and on macOS
OpenClawKit, OpenClawChatUI and OpenClawAppIntents) with complete strict
concurrency and warnings as errors.
The package builds every product for macOS, iOS, tvOS, watchOS (arm64_32 and arm64)
and visionOS with Xcode 27.1. Logs go to .build/logs, DerivedData to
.build/xcode-<platform>.
Scripts/validate-apple-matrix.sh # static guard rules (fast)
Scripts/typecheck-apple-sdks.sh all # typecheck OpenClawKit at every SDK floor
Scripts/build-apple-platforms.sh all # build every product on all five platforms
Scripts/check-apple-weak-links.sh all # weak-link and runtime-symbol checkvalidate-apple-matrix.shchecks the platform declarations, the example share extension artifacts, that 27-only APIs sit behind#if compiler(>=6.4), the FoundationModels tvOS/watchOS guards, ChatUI view guards, per-OS availability (neveranyAppleOS) and that everysubmitTaskRequest(call has an@available(iOS 27.0/#available(iOS 27.0gate.typecheck-apple-sdks.shemits every module OpenClawKit imports (Protocol, Core, NativeState, Gateway, Media, Models, Skills, Agents, Memory, MCP, Plugins, Channels) for each minimum-OS triple and typechecks all OpenClawKit sources with-warnings-as-errors, plus an iOS app-extension pass. It takes a few minutes per SDK and does not run SIL diagnostics; the full build stays authoritative.check-apple-weak-links.shlinks the built objects into a probe dylib at the deployment floors and fails when a framework newer than the floor is strongly linked (27-only frameworks everywhere; FoundationModels, TelephonyMessagingKit, ImagePlayground and ManagedApp except on visionOS, where they exist at the floor), or when the probe strongly references a 27-only Swift runtime symbol such asswift_task_cancellationShieldPush/Pop. Use--no-buildto reuse existing DerivedData,<platform> --binary <Mach-O>to inspect a linked app binary, andOPENCLAW_WEAK_LINK_FRAMEWORKS/OPENCLAW_STRONG_SYMBOL_DENYLISTto override the watched lists.
The experimental App Intents model-delegation surface is compiled only with its package trait:
swift build --traits ExperimentalAppleModelDelegation -Xswiftc -warnings-as-errors
swift test --traits ExperimentalAppleModelDelegation --filter "PackageSkeletonTests|OpenClawAppIntents"Scripts/build-ios-example.sh # builds Examples/iOS and verifies bundled skills
Scripts/test-ios-example.sh # unit + UI tests on an available iPhone simulator
Scripts/build-tvos-example.sh # builds Examples/tvOSExample DerivedData goes to .build/xcode-example-* (override with
OPENCLAW_EXAMPLE_DERIVED_DATA); IOS_SIMULATOR_NAME picks the simulator.
Protocol models, the provider and channel catalogs, the native-state schema and several
test fixtures are derived from the pinned upstream checkout (.codex/openclaw, OpenClaw
v2026.9.6 at eb377ac59e). One command runs every --check:
OPENCLAW_UPSTREAM_DIR=.codex/openclaw Scripts/check-upstream-drift.sh
Scripts/check-upstream-drift.sh --allow-missing-upstream # CI: skips when the checkout is absentIt runs protocol-gen-swift.mjs, provider-catalog-gen.mjs, channel-catalog-gen.mjs,
check-native-state-parity.mjs, sync-upstream-gateway-method-fixtures.mjs,
sync-upstream-runtime-ext-fixtures.mjs, sync-upstream-tool-catalog-fixture.mjs and
sync-config-fixtures.sh --check. Run a generator without --check to regenerate, and
review the diff (for the provider catalog, also
Tests/OpenClawKitTests/ProviderCatalogReferenceFixture.swift).
The LiveProvider*Tests suites call real provider APIs. They run only when
OPENCLAW_LIVE_PROVIDER_TESTS=1 is set and the provider's key is in the test
process environment; otherwise they report as skipped, so CI and a normal swift test
never call a provider. Keep keys in a local, git-ignored .env and never commit it.
set -a; . ./.env; set +a
OPENCLAW_LIVE_PROVIDER_TESTS=1 swift test --filter LiveProvider- Keys:
OPENAI_API_KEY,ANTHROPIC_API_KEY,XAI_API_KEY. - One provider:
--filter LiveProviderOpenAIResponses,LiveProviderOpenAIChatCompletions,LiveProviderAnthropic,LiveProviderXAIorLiveProviderAgentLoop. - Model overrides:
OPENCLAW_LIVE_OPENAI_MODEL(defaultgpt-6-luna),OPENCLAW_LIVE_ANTHROPIC_MODEL(defaultclaude-haiku-4-5),OPENCLAW_LIVE_XAI_MODEL(defaultgrok-4.20-0309-non-reasoning). - Anthropic keys that are not scoped to a workspace need
ANTHROPIC_WORKSPACE_ID(orOPENCLAW_LIVE_ANTHROPIC_WORKSPACE_ID), sent as theanthropic-workspace-idheader. Without it the API rejects every Messages call with 400 and the tests record that exact rejection as a known issue. - Cost: a full pass is about 48 billed calls and about 4.5k input / 0.8k output tokens, well under $0.01 at catalog prices. Output is capped at 64 tokens (160 for tool and JSON turns) and there are no retries; the Anthropic thinking tests may use up to about 1.2k output tokens each.
- Each call prints a
[live-usage] <label> model=… input=… output=… cacheRead=… reasoning=… total=…line. Prompts, bodies and keys are never printed, and failure descriptions redact configured keys. - The stubbed offline regressions (
LiveProviderRegressionTests) always run.
Status at 2026.3.0: the final pass on the release tree ran 67 tests in 6 suites and all
passed: OpenAI Responses, OpenAI Chat Completions, Anthropic Messages, xAI, the
OpenAI/Anthropic/xAI agent loops and router fallback for generate and generateStream.
- Apple Foundation Models:
OPENCLAW_LIVE_APPLE_FM=1 swift test --filter AppleFoundationModelsLiveTests(needs Apple Intelligence enabled); addOPENCLAW_LIVE_APPLE_PCC=1for Private Cloud Compute, which needs Apple's managed entitlement (unsigned test processes getModelManagerError1046, mapped tonotEntitled, and fall back to on-device). - Media:
OPENCLAW_LIVE_APPLE_MEDIA=1(Vision OCR, MusicUnderstanding, MediaIntelligence) andOPENCLAW_LIVE_SPEECH=1(missing speech assets count as a skip). The first Vision run on a machine can take about 80 s. - CoreAI:
OPENCLAW_COREAI_MODEL_PATH=<model.aimodel>.
swift build -Xswiftc -warnings-as-errorsScripts/lint-swift.sh(Sources, Tests, Examples andPackage.swift)Scripts/check-networking-concurrency.shswift testScripts/build-docs-site.shScripts/validate-apple-matrix.shScripts/typecheck-apple-sdks.sh allScripts/build-apple-platforms.sh allScripts/check-apple-weak-links.sh allScripts/build-ios-example.shScripts/test-ios-example.shScripts/build-tvos-example.shScripts/check-upstream-drift.sh(with the upstream checkout)- The Linux Swift 6.2 gate below, for cross-platform module changes
Clean up large build folders afterwards with rm -rf .build/xcode-*.
The repo CI runs the Linux runtime gate on Ubuntu with Swift 6.2. The cross-platform
modules must stay Swift 6.2 compatible: no Swift 6.3/6.4-only syntax outside
#if compiler(>=6.4), Apple frameworks only behind #if canImport, and
FoundationNetworking where URLSession is used. To catch Linux-only failures before
pushing, run the same scripts in Docker. The named volume keeps the Linux .build separate
from the macOS one:
docker run --rm -v "$PWD:/workspace" -v openclawkit-linux-build:/workspace/.build \
-w /workspace swift:6.2 bash -c \
'Scripts/build-linux-runtime.sh && Scripts/check-networking-concurrency.sh && Scripts/test-linux-runtime.sh'The public docs site is generated with Swift-DocC on macOS.
Scripts/build-docs-site.shThe script builds every first-party module's archive (including OpenClawMCP,
OpenClawNativeState, OpenClawChatStore and OpenClawAppIntents), merges them, and
fails if the static site does not contain index.html and the
documentation/openclawkit entry point expected by GitHub Pages.