Spaces:
Sleeping
Sleeping
fix: patch paired device scopes for OpenClaw 2026.2.19+ compatibility
Browse files- Add operator.write and operator.read to paired devices on startup
- Fixes 'missing scope: operator.write' A2A dispatch error
- Known OpenClaw bug: auto-pair doesn't grant new scopes (issue #23006)
- Force rebuild (v3.8)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Dockerfile +1 -1
- scripts/sync_hf.py +22 -0
Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# OpenClaw on Hugging Face Spaces β Pre-built image (v3.
|
| 2 |
# Uses official pre-built image to avoid 30+ minute builds on cpu-basic
|
| 3 |
|
| 4 |
# ββ Stage 1: Pull pre-built OpenClaw βββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 1 |
+
# OpenClaw on Hugging Face Spaces β Pre-built image (v3.8)
|
| 2 |
# Uses official pre-built image to avoid 30+ minute builds on cpu-basic
|
| 3 |
|
| 4 |
# ββ Stage 1: Pull pre-built OpenClaw βββββββββββββββββββββββββββββββββββββββββ
|
scripts/sync_hf.py
CHANGED
|
@@ -562,6 +562,28 @@ class OpenClawFullSync:
|
|
| 562 |
json.dump(data, f, indent=2)
|
| 563 |
print("[SYNC] Config patched and saved.")
|
| 564 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 565 |
# Verify write
|
| 566 |
with open(config_path, "r") as f:
|
| 567 |
verify_data = json.load(f)
|
|
|
|
| 562 |
json.dump(data, f, indent=2)
|
| 563 |
print("[SYNC] Config patched and saved.")
|
| 564 |
|
| 565 |
+
# Fix paired devices scopes (OpenClaw 2026.2.19+ requires operator.write/read)
|
| 566 |
+
paired_path = Path(OPENCLAW_DIR) / "devices" / "paired.json"
|
| 567 |
+
required_scopes = {"operator.admin", "operator.approvals", "operator.pairing", "operator.write", "operator.read"}
|
| 568 |
+
if paired_path.exists():
|
| 569 |
+
try:
|
| 570 |
+
with open(paired_path, "r") as f:
|
| 571 |
+
devices = json.load(f)
|
| 572 |
+
changed = False
|
| 573 |
+
if isinstance(devices, list):
|
| 574 |
+
for dev in devices:
|
| 575 |
+
if isinstance(dev, dict) and "scopes" in dev:
|
| 576 |
+
existing = set(dev["scopes"])
|
| 577 |
+
if not required_scopes.issubset(existing):
|
| 578 |
+
dev["scopes"] = list(required_scopes | existing)
|
| 579 |
+
changed = True
|
| 580 |
+
if changed:
|
| 581 |
+
with open(paired_path, "w") as f:
|
| 582 |
+
json.dump(devices, f, indent=2)
|
| 583 |
+
print(f"[SYNC] Fixed paired device scopes: added operator.write/read")
|
| 584 |
+
except Exception as e:
|
| 585 |
+
print(f"[SYNC] Warning: could not fix paired devices: {e}")
|
| 586 |
+
|
| 587 |
# Verify write
|
| 588 |
with open(config_path, "r") as f:
|
| 589 |
verify_data = json.load(f)
|