Skip to content

Commit bea0556

Browse files
JiaDeclaude
andcommitted
feat: version-aware config — 3.24 default, 4.5/latest optional
OpenClaw 3.24 doesn't support the plugins.entries.discovery config format from PR #58 (silently fails, no models discovered). This adds version-aware logic: - Default: 2026.3.24 (no model approval needed, WeChat compatible) - Optional: 2026.4.5 (auto-discovery, embeddings) or latest - Two config templates: legacy (models.providers) and modern (plugins.entries) - UserData selects config based on OpenClawVersion parameter - ARM64 install: --ignore-scripts only for 3.24 (4.5 needs native modules) Tested on production EC2: - 3.24 + old config: works - 3.24 + new config: fails (unknown model) - 4.5 + new config: works (with Gateway running) - 4.5 + --ignore-scripts: fails (missing @buape/carbon) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b626254 commit bea0556

2 files changed

Lines changed: 75 additions & 16 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ Switch models with one CloudFormation parameter — no code changes:
230230
| Parameter | Default | Description |
231231
|-----------|---------|-------------|
232232
| `OpenClawModel` | Nova 2 Lite | Bedrock model ID |
233+
| `OpenClawVersion` | 2026.3.24 | `2026.3.24` (default, no model approval needed, WeChat compatible), `2026.4.5` (auto-discovery, embeddings), or `latest` |
233234
| `InstanceType` | c7g.large | EC2 instance type |
234235
| `CreateVPCEndpoints` | false | Private networking (+$22/mo) |
235236
| `EnableSandbox` | true | Docker isolation for code execution |

clawdbot-bedrock.yaml

Lines changed: 74 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,12 @@ Parameters:
8181

8282
OpenClawVersion:
8383
Type: String
84-
Default: "2026.4.5"
85-
Description: "OpenClaw version to install (npm package version)"
84+
Default: "2026.3.24"
85+
AllowedValues:
86+
- "2026.3.24"
87+
- "2026.4.5"
88+
- "latest"
89+
Description: "OpenClaw version. 2026.3.24 (default, no model approval needed, WeChat compatible). 2026.4.5+ (auto-discovery, embeddings)."
8690

8791
EnableDataProtection:
8892
Type: String
@@ -458,7 +462,52 @@ Resources:
458462
- run_setup
459463
write_files:
460464
files:
461-
/opt/openclaw/openclaw-config.json:
465+
/opt/openclaw/openclaw-config-legacy.json:
466+
content: |
467+
{
468+
"gateway": {
469+
"mode": "local",
470+
"port": 18789,
471+
"bind": "loopback",
472+
"controlUi": {
473+
"enabled": true,
474+
"allowInsecureAuth": true
475+
},
476+
"auth": {
477+
"mode": "token",
478+
"token": "GATEWAY_TOKEN_PLACEHOLDER"
479+
}
480+
},
481+
"models": {
482+
"providers": {
483+
"amazon-bedrock": {
484+
"baseUrl": "https://bedrock-runtime.REGION_PLACEHOLDER.amazonaws.com",
485+
"api": "bedrock-converse-stream",
486+
"auth": "aws-sdk",
487+
"models": [
488+
{
489+
"id": "MODEL_ID_PLACEHOLDER",
490+
"name": "Bedrock Model",
491+
"input": ["text", "image"],
492+
"contextWindow": 200000,
493+
"maxTokens": 8192
494+
}
495+
]
496+
}
497+
}
498+
},
499+
"agents": {
500+
"defaults": {
501+
"model": {
502+
"primary": "amazon-bedrock/MODEL_ID_PLACEHOLDER"
503+
}
504+
}
505+
}
506+
}
507+
mode: "000644"
508+
owner: root
509+
group: root
510+
/opt/openclaw/openclaw-config-modern.json:
462511
content: |
463512
{
464513
"gateway": {
@@ -683,18 +732,17 @@ Resources:
683732
npm config set registry https://registry.npmjs.org/
684733
OPENCLAW_VERSION="${OpenClawVersion}"
685734
ARCH=$(uname -m)
686-
if [ "$ARCH" = "aarch64" ]; then
687-
echo "ARM64 detected, installing with --ignore-scripts..."
688-
npm install -g openclaw@$OPENCLAW_VERSION --timeout=300000 --ignore-scripts || {
689-
npm cache clean --force
690-
npm install -g openclaw@$OPENCLAW_VERSION --timeout=300000 --ignore-scripts
691-
}
692-
else
693-
npm install -g openclaw@$OPENCLAW_VERSION --timeout=300000 || {
694-
npm cache clean --force
695-
npm install -g openclaw@$OPENCLAW_VERSION --timeout=300000
696-
}
735+
# 2026.3.24 on ARM64: use --ignore-scripts (avoids native build issues)
736+
# 2026.4.5+: must NOT use --ignore-scripts (needs native modules like @buape/carbon)
737+
IGNORE_FLAG=""
738+
if [ "$ARCH" = "aarch64" ] && [ "$OPENCLAW_VERSION" = "2026.3.24" ]; then
739+
IGNORE_FLAG="--ignore-scripts"
740+
echo "ARM64 + 3.24: installing with --ignore-scripts"
697741
fi
742+
npm install -g openclaw@$OPENCLAW_VERSION --timeout=300000 $IGNORE_FLAG || {
743+
npm cache clean --force
744+
npm install -g openclaw@$OPENCLAW_VERSION --timeout=300000 $IGNORE_FLAG
745+
}
698746

699747
if ! grep -q 'NVM_DIR' ~/.bashrc; then
700748
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc
@@ -748,8 +796,18 @@ Resources:
748796

749797
GATEWAY_TOKEN=$(openssl rand -hex 24)
750798

751-
# Copy config files from cfn-init staging area
752-
cp /opt/openclaw/openclaw-config.json /home/ubuntu/.openclaw/openclaw.json
799+
# Select config template based on OpenClaw version
800+
# 2026.3.24: uses models.providers (explicit model list)
801+
# 2026.4.5+: uses plugins.entries.discovery (auto-discovers Bedrock models)
802+
OPENCLAW_VERSION="${OpenClawVersion}"
803+
if [ "$OPENCLAW_VERSION" = "2026.3.24" ]; then
804+
echo "Using legacy config (models.providers) for $OPENCLAW_VERSION"
805+
cp /opt/openclaw/openclaw-config-legacy.json /home/ubuntu/.openclaw/openclaw.json
806+
sed -i "s/REGION_PLACEHOLDER/$AWS_REGION/g" /home/ubuntu/.openclaw/openclaw.json
807+
else
808+
echo "Using modern config (plugins.discovery) for $OPENCLAW_VERSION"
809+
cp /opt/openclaw/openclaw-config-modern.json /home/ubuntu/.openclaw/openclaw.json
810+
fi
753811
chown ubuntu:ubuntu /home/ubuntu/.openclaw/openclaw.json
754812
sed -i "s/GATEWAY_TOKEN_PLACEHOLDER/$GATEWAY_TOKEN/g" /home/ubuntu/.openclaw/openclaw.json
755813
sed -i "s|MODEL_ID_PLACEHOLDER|${OpenClawModel}|g" /home/ubuntu/.openclaw/openclaw.json

0 commit comments

Comments
 (0)