mirror of
https://github.com/abhi1693/openclaw-mission-control.git
synced 2026-08-14 01:07:51 +00:00
fix: replace hardcoded platform python with host OS in gateway_rpc connect params
Agent-Logs-Url: https://github.com/abhi1693/openclaw-mission-control/sessions/594e3cb4-df31-4e4a-972e-8e89f6a6ef24 Co-authored-by: abhi1693 <5083532+abhi1693@users.noreply.github.com>
This commit is contained in:
co-authored by
abhi1693
parent
48215644dc
commit
4df25a3d27
@@ -9,6 +9,7 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import platform as _platform
|
||||
import ssl
|
||||
from dataclasses import dataclass
|
||||
from time import perf_counter, time
|
||||
@@ -28,6 +29,9 @@ from app.services.openclaw.device_identity import (
|
||||
)
|
||||
|
||||
PROTOCOL_VERSION = 3
|
||||
# Resolved once at import time; matches the value written by the openclaw CLI
|
||||
# during pairing ("linux", "darwin", or "windows").
|
||||
_HOST_PLATFORM: str = _platform.system().lower()
|
||||
logger = get_logger(__name__)
|
||||
GATEWAY_OPERATOR_SCOPES = (
|
||||
"operator.read",
|
||||
@@ -334,7 +338,7 @@ def _build_connect_params(
|
||||
"client": {
|
||||
"id": CONTROL_UI_CLIENT_ID if use_control_ui else DEFAULT_GATEWAY_CLIENT_ID,
|
||||
"version": "1.0.0",
|
||||
"platform": "python",
|
||||
"platform": _HOST_PLATFORM,
|
||||
"mode": CONTROL_UI_CLIENT_MODE if use_control_ui else DEFAULT_GATEWAY_CLIENT_MODE,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import platform
|
||||
|
||||
import pytest
|
||||
|
||||
import app.services.openclaw.gateway_rpc as gateway_rpc
|
||||
@@ -57,6 +59,7 @@ def test_build_connect_params_defaults_to_device_pairing(
|
||||
assert params["scopes"] == list(GATEWAY_OPERATOR_SCOPES)
|
||||
assert params["client"]["id"] == DEFAULT_GATEWAY_CLIENT_ID
|
||||
assert params["client"]["mode"] == DEFAULT_GATEWAY_CLIENT_MODE
|
||||
assert params["client"]["platform"] == platform.system().lower()
|
||||
assert params["device"] == expected_device_payload
|
||||
assert "auth" not in params
|
||||
assert captured["client_id"] == DEFAULT_GATEWAY_CLIENT_ID
|
||||
@@ -80,6 +83,7 @@ def test_build_connect_params_uses_control_ui_when_pairing_disabled() -> None:
|
||||
assert params["scopes"] == list(GATEWAY_OPERATOR_SCOPES)
|
||||
assert params["client"]["id"] == CONTROL_UI_CLIENT_ID
|
||||
assert params["client"]["mode"] == CONTROL_UI_CLIENT_MODE
|
||||
assert params["client"]["platform"] == platform.system().lower()
|
||||
assert "device" not in params
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user