feat(cloud): accept mcp_busy_device_ids in heartbeat payload
This commit is contained in:
@@ -40,6 +40,7 @@ class HeartbeatRequest(BaseModel):
|
|||||||
devices: list[DeviceSnapshotModel] = Field(default_factory=list)
|
devices: list[DeviceSnapshotModel] = Field(default_factory=list)
|
||||||
policy_revision: int = Field(default=0, ge=0)
|
policy_revision: int = Field(default=0, ge=0)
|
||||||
planner_transport: Literal["direct", "cloud"] = "direct"
|
planner_transport: Literal["direct", "cloud"] = "direct"
|
||||||
|
mcp_busy_device_ids: list[str] = Field(default_factory=list)
|
||||||
|
|
||||||
|
|
||||||
class HostGovernancePolicyModel(BaseModel):
|
class HostGovernancePolicyModel(BaseModel):
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from cloud.internal_api.models import HeartbeatRequest
|
||||||
|
|
||||||
|
|
||||||
|
def test_heartbeat_request_defaults_mcp_busy_device_ids_to_empty() -> None:
|
||||||
|
req = HeartbeatRequest(host_id="h1")
|
||||||
|
assert req.mcp_busy_device_ids == []
|
||||||
|
|
||||||
|
|
||||||
|
def test_heartbeat_request_accepts_mcp_busy_device_ids() -> None:
|
||||||
|
req = HeartbeatRequest(host_id="h1", mcp_busy_device_ids=["phone-1"])
|
||||||
|
assert req.mcp_busy_device_ids == ["phone-1"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_heartbeat_request_omitting_field_is_backward_compatible() -> None:
|
||||||
|
"""Old host-agents that don't send the field must still validate."""
|
||||||
|
raw = {"host_id": "h1", "devices": []}
|
||||||
|
req = HeartbeatRequest.model_validate(raw)
|
||||||
|
assert req.mcp_busy_device_ids == []
|
||||||
Reference in New Issue
Block a user