tao-shen Claude Opus 4.6 (1M context) commited on
Commit
b41db96
·
1 Parent(s): 2064383

fix: pre-create device with operator scopes for A2A dispatch

Browse files

The A2A gateway dispatch requires operator.write scope but inboundAuth=none
doesn't grant any scopes. Pre-creating a device file with the gateway token
and operator.read/write scopes may allow authenticated A2A requests to dispatch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. scripts/sync_hf.py +14 -8
scripts/sync_hf.py CHANGED
@@ -537,10 +537,7 @@ class OpenClawFullSync:
537
  },
538
  "server": {"host": "0.0.0.0", "port": 18800},
539
  "security": {"inboundAuth": "none"},
540
- "routing": {
541
- "defaultAgentId": "main",
542
- "grantScopes": ["operator.read", "operator.write"]
543
- },
544
  "peers": peers
545
  }
546
  }
@@ -579,13 +576,22 @@ class OpenClawFullSync:
579
  target.write_text(text)
580
  print(f"[SYNC] Deployed workspace template: {tmpl.name}")
581
 
582
- # Fix paired devices scopes (OpenClaw 2026.2.19+ requires operator.write/read)
583
- # Delete old paired devices to force fresh auto-pair with correct scopes
584
  devices_dir = Path(OPENCLAW_HOME) / "devices"
585
  if devices_dir.exists():
586
- import shutil
587
  shutil.rmtree(devices_dir, ignore_errors=True)
588
- print("[SYNC] Deleted devices/ dir to force fresh auto-pair with operator.write/read scopes")
 
 
 
 
 
 
 
 
 
 
589
 
590
  # Verify write
591
  with open(config_path, "r") as f:
 
537
  },
538
  "server": {"host": "0.0.0.0", "port": 18800},
539
  "security": {"inboundAuth": "none"},
540
+ "routing": {"defaultAgentId": "main"},
 
 
 
541
  "peers": peers
542
  }
543
  }
 
576
  target.write_text(text)
577
  print(f"[SYNC] Deployed workspace template: {tmpl.name}")
578
 
579
+ # Pre-create a paired device with operator.write/read scopes.
580
+ # This is needed for A2A gateway dispatch to have sufficient permissions.
581
  devices_dir = Path(OPENCLAW_HOME) / "devices"
582
  if devices_dir.exists():
 
583
  shutil.rmtree(devices_dir, ignore_errors=True)
584
+ devices_dir.mkdir(parents=True, exist_ok=True)
585
+ device_file = devices_dir / "a2a-bridge.json"
586
+ device_file.write_text(json.dumps({
587
+ "id": "a2a-bridge",
588
+ "name": "A2A Bridge",
589
+ "token": GATEWAY_TOKEN,
590
+ "scopes": ["operator.read", "operator.write"],
591
+ "createdAt": datetime.now().isoformat(),
592
+ "approved": True
593
+ }, indent=2))
594
+ print("[SYNC] Created A2A bridge device with operator scopes")
595
 
596
  # Verify write
597
  with open(config_path, "r") as f: