tao-shen Claude Opus 4.6 commited on
Commit
1e3d376
Β·
1 Parent(s): 862bae1

fix: delete devices dir to force fresh auto-pair, skip error replies

Browse files

- Delete ~/.openclaw/devices/ on startup to force fresh auto-pair
with operator.write/read scopes (fixes A2A dispatch error)
- Conversation loop now checks task state=failed and skips errors
- Force rebuild (v3.9)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (3) hide show
  1. Dockerfile +1 -1
  2. scripts/conversation-loop.py +7 -0
  3. scripts/sync_hf.py +6 -20
Dockerfile CHANGED
@@ -1,4 +1,4 @@
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 ─────────────────────────────────────────
 
1
+ # OpenClaw on Hugging Face Spaces β€” Pre-built image (v3.9)
2
  # Uses official pre-built image to avoid 30+ minute builds on cpu-basic
3
 
4
  # ── Stage 1: Pull pre-built OpenClaw ─────────────────────────────────────────
scripts/conversation-loop.py CHANGED
@@ -31,6 +31,13 @@ def send_a2a(url, text):
31
  try:
32
  resp = requests.post(f"{url}/a2a/jsonrpc", json=payload, timeout=90)
33
  data = resp.json()
 
 
 
 
 
 
 
34
  parts = data.get("result", {}).get("status", {}).get("message", {}).get("parts", [])
35
  for p in parts:
36
  if p.get("kind") == "text" or p.get("type") == "text":
 
31
  try:
32
  resp = requests.post(f"{url}/a2a/jsonrpc", json=payload, timeout=90)
33
  data = resp.json()
34
+ # Check if task failed
35
+ state = data.get("result", {}).get("status", {}).get("state", "")
36
+ if state == "failed":
37
+ parts = data.get("result", {}).get("status", {}).get("message", {}).get("parts", [])
38
+ err = parts[0].get("text", "") if parts else "unknown error"
39
+ print(f"[error] A2A task failed: {err}", file=sys.stderr)
40
+ return ""
41
  parts = data.get("result", {}).get("status", {}).get("message", {}).get("parts", [])
42
  for p in parts:
43
  if p.get("kind") == "text" or p.get("type") == "text":
scripts/sync_hf.py CHANGED
@@ -563,26 +563,12 @@ class OpenClawFullSync:
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:
 
563
  print("[SYNC] Config patched and saved.")
564
 
565
  # Fix paired devices scopes (OpenClaw 2026.2.19+ requires operator.write/read)
566
+ # Delete old paired devices to force fresh auto-pair with correct scopes
567
+ devices_dir = Path(OPENCLAW_DIR) / "devices"
568
+ if devices_dir.exists():
569
+ import shutil
570
+ shutil.rmtree(devices_dir, ignore_errors=True)
571
+ print("[SYNC] Deleted devices/ dir to force fresh auto-pair with operator.write/read scopes")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
 
573
  # Verify write
574
  with open(config_path, "r") as f: