From 9e0c8480571bcf20798b573d6d7b8ea4c097ce28 Mon Sep 17 00:00:00 2001 From: cybermaggedon Date: Mon, 1 Jun 2026 12:24:27 +0100 Subject: [PATCH] fix: WebSocket auth handshake overwriting explicit workspace (#965) 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(