fix(device-pool): scope primary key by host and thread through capability_tags

- pooled_devices primary key changed from device_id alone to
  (host_id, device_id), so two hosts reporting the same local
  device_id no longer crash sync_host_devices() with an uncaught
  sqlite3.IntegrityError.
- Device gained a capability_tags field so DevicePool.sync_host_devices()
  can actually populate PooledDevice.capability_tags from a real host
  sync instead of always falling back to an empty list.

openspec: device-pool capability, archived change cloud-runtime
This commit is contained in:
2026-07-07 08:30:47 +08:00
parent a15756835c
commit 1bdc3784dc
7 changed files with 93 additions and 5 deletions
+2
View File
@@ -33,6 +33,7 @@ class DeviceManager:
driver_type: str = "wda",
connection_info: dict[str, object] | None = None,
status: DeviceStatus = "idle",
capability_tags: list[str] | None = None,
) -> Device:
with self._lock:
device = Device(
@@ -41,6 +42,7 @@ class DeviceManager:
status=status,
driver_type=driver_type,
connection_info=dict(connection_info or {}),
capability_tags=list(capability_tags or []),
)
self._devices[device_id] = device
self._factories[device_id] = driver_factory