From 66a1ceac259a36aa235719f8c7566d3518187259 Mon Sep 17 00:00:00 2001 From: dadachann <185672915+dadachann@users.noreply.github.com> Date: Sun, 26 Jul 2026 10:54:21 +0800 Subject: [PATCH] style: format collaboration changes --- src/langbot/pkg/cloud/launch.py | 7 ++---- src/langbot/pkg/persistence/mgr.py | 4 +--- .../pkg/workspace/invitation_delivery.py | 23 ++++++------------- web/src/app/auth/space/callback/page.tsx | 7 +++++- 4 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/langbot/pkg/cloud/launch.py b/src/langbot/pkg/cloud/launch.py index ab8baa7e4..d37329724 100644 --- a/src/langbot/pkg/cloud/launch.py +++ b/src/langbot/pkg/cloud/launch.py @@ -199,8 +199,7 @@ class SpaceLaunchService: if not public_key_value or not key_id: raise SpaceLaunchError('Space launch control-plane trust is not configured') clock_skew = self._bounded_float( - os.environ.get('LANGBOT_SPACE_CONTROL_PLANE_CLOCK_SKEW_SECONDS') - or launch_config.get('clock_skew_seconds'), + os.environ.get('LANGBOT_SPACE_CONTROL_PLANE_CLOCK_SKEW_SECONDS') or launch_config.get('clock_skew_seconds'), default=30.0, minimum=0.0, maximum=300.0, @@ -211,9 +210,7 @@ class SpaceLaunchService: digest = hashlib.sha256(jti.encode('utf-8')).hexdigest() now = int(self._wall_time()) async with self._replay_lock: - self._consumed_jtis = { - existing: expiry for existing, expiry in self._consumed_jtis.items() if expiry > now - } + self._consumed_jtis = {existing: expiry for existing, expiry in self._consumed_jtis.items() if expiry > now} if digest in self._consumed_jtis: raise SpaceLaunchError('Launch assertion has already been consumed') if len(self._consumed_jtis) >= 4096: diff --git a/src/langbot/pkg/persistence/mgr.py b/src/langbot/pkg/persistence/mgr.py index 537be7404..e35cd6704 100644 --- a/src/langbot/pkg/persistence/mgr.py +++ b/src/langbot/pkg/persistence/mgr.py @@ -1499,9 +1499,7 @@ class PersistenceManager: local_workspace_expression = ( f"(((uuid)::text = {setting(TENANT_SETTING)}) AND ((source)::text = 'local'::text))" ) - local_membership_expression = ( - f'((workspace_uuid)::text = {setting(TENANT_SETTING)})' - ) + local_membership_expression = f'((workspace_uuid)::text = {setting(TENANT_SETTING)})' local_execution_expression = ( f'(((workspace_uuid)::text = {setting(TENANT_SETTING)}) AND (EXISTS ( SELECT 1\n' ' FROM workspaces local_workspace\n' diff --git a/src/langbot/pkg/workspace/invitation_delivery.py b/src/langbot/pkg/workspace/invitation_delivery.py index cea3f05f2..68972360d 100644 --- a/src/langbot/pkg/workspace/invitation_delivery.py +++ b/src/langbot/pkg/workspace/invitation_delivery.py @@ -106,7 +106,9 @@ class InvitationDeliveryService: json=payload, ) if response.status_code >= 400: - self._log_delivery_failure(config.provider or 'resend', RuntimeError(f'Resend returned {response.status_code}')) + self._log_delivery_failure( + config.provider or 'resend', RuntimeError(f'Resend returned {response.status_code}') + ) return False return True @@ -140,11 +142,7 @@ class InvitationDeliveryService: def _email_config(self) -> _EmailConfig: data = getattr(getattr(self.ap, 'instance_config', None), 'data', {}) or {} - email = ( - data.get('workspace', {}) - .get('invitations', {}) - .get('email', {}) - ) + email = data.get('workspace', {}).get('invitations', {}).get('email', {}) if not isinstance(email, dict): email = {} raw_provider = self._env('WORKSPACE__INVITATIONS__EMAIL__PROVIDER', email.get('provider', '')) @@ -189,9 +187,7 @@ class InvitationDeliveryService: smtp_starttls = self._bool( self._env('WORKSPACE__INVITATIONS__EMAIL__SMTP__STARTTLS', smtp_config.get('starttls', True)) ) - smtp_ssl = self._bool( - self._env('WORKSPACE__INVITATIONS__EMAIL__SMTP__SSL', smtp_config.get('ssl', False)) - ) + smtp_ssl = self._bool(self._env('WORKSPACE__INVITATIONS__EMAIL__SMTP__SSL', smtp_config.get('ssl', False))) if provider == 'resend' and not (sender and resend_api_key and resend_api_url): provider = None @@ -244,14 +240,9 @@ class InvitationDeliveryService: @staticmethod def _html(workspace_name: str, invitation_link: str) -> str: - escaped_workspace = ( - workspace_name.replace('&', '&').replace('<', '<').replace('>', '>') - ) + escaped_workspace = workspace_name.replace('&', '&').replace('<', '<').replace('>', '>') escaped_link = ( - invitation_link.replace('&', '&') - .replace('<', '<') - .replace('>', '>') - .replace('"', '"') + invitation_link.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"') ) return ( '
You were invited to join ' diff --git a/web/src/app/auth/space/callback/page.tsx b/web/src/app/auth/space/callback/page.tsx index 68f0a810d..e37fc55d8 100644 --- a/web/src/app/auth/space/callback/page.tsx +++ b/web/src/app/auth/space/callback/page.tsx @@ -221,7 +221,12 @@ function SpaceOAuthCallbackContent() { setErrorMessage(t('common.spaceLoginFailed')); return; } - handleOAuthCallback(authCode ?? '', state ?? '', workspaceUuid, launchAssertion); + handleOAuthCallback( + authCode ?? '', + state ?? '', + workspaceUuid, + launchAssertion, + ); } else { if (!authCode) { setStatus('error');