From 08edc6e37d9ebd8d1fb84f18775e04a3df8b6a4d Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Mon, 1 Jun 2026 12:22:08 +0100 Subject: [PATCH] fix: WebSocket auth handshake overwriting explicit workspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The auth-ok response includes the token's bound workspace, and AsyncSocketClient was unconditionally adopting it — clobbering any workspace the caller explicitly requested via the constructor. --- trustgraph-base/trustgraph/api/async_socket_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trustgraph-base/trustgraph/api/async_socket_client.py b/trustgraph-base/trustgraph/api/async_socket_client.py index d18bee34..7b38a4b1 100644 --- a/trustgraph-base/trustgraph/api/async_socket_client.py +++ b/trustgraph-base/trustgraph/api/async_socket_client.py @@ -30,6 +30,7 @@ class AsyncSocketClient: self.timeout = timeout self.token = token self.workspace = workspace + self._workspace_explicit = workspace != "default" self._request_counter = 0 self._socket = None self._connect_cm = None @@ -92,7 +93,8 @@ class AsyncSocketClient: ) if resp.get("type") == "auth-ok": - self.workspace = resp.get("workspace", self.workspace) + if not self._workspace_explicit: + self.workspace = resp.get("workspace", self.workspace) elif resp.get("type") == "auth-failed": await self._socket.close() raise ProtocolException(