Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
chore: add missing @override decorators to `api/libs` (#37012)
eryue0220bb3c9929f964
diff --git a/api/libs/broadcast_channel/channel.py b/api/libs/broadcast_channel/channel.pyindex 8eeac372325..a4957c97715 100644--- a/api/libs/broadcast_channel/channel.py+++ b/api/libs/broadcast_channel/channel.py@@ -8,7 +8,7 @@ import typesfrom abc import abstractmethodfrom collections.abc import Iteratorfrom contextlib import AbstractContextManager-from typing import Protocol, Self+from typing import Protocol, Self, overrideclass Subscription(AbstractContextManager["Subscription"], Protocol):@@ -37,10 +37,12 @@ class Subscription(AbstractContextManager["Subscription"], Protocol):"""close closes the subscription, releases any resources associated with it."""...+ @overridedef __enter__(self) -> Self:"""`__enter__` does the setup logic of the subscription (if any), and return itself."""return self+ @overridedef __exit__(self,exc_type: type[BaseException] | None,diff --git a/api/libs/broadcast_channel/redis/_subscription.py b/api/libs/broadcast_channel/redis/_subscription.pyindex 9fe50445e4e..15355a77620 100644--- a/api/libs/broadcast_channel/redis/_subscription.py+++ b/api/libs/broadcast_channel/redis/_subscription.py@@ -3,7 +3,7 @@ import queueimport threadingimport typesfrom collections.abc import Generator, Iterator-from typing import Any, Self+from typing import Any, Self, overridefrom libs.broadcast_channel.channel import Subscriptionfrom libs.broadcast_channel.exc import SubscriptionClosedError@@ -165,6 +165,7 @@ class RedisSubscriptionBase(Subscription):yield item+ @overridedef __iter__(self) -> Iterator[bytes]:"""Return an iterator over messages from the subscription."""if self._closed.is_set():@@ -172,6 +173,7 @@ class RedisSubscriptionBase(Subscription):self._start_if_needed()return iter(self._message_iterator())+ @overridedef receive(self, timeout: float | None = 0.1) -> bytes | None:"""Receive the next message from the subscription."""if self._closed.is_set():@@ -185,11 +187,13 @@ class RedisSubscriptionBase(Subscription):return item+ @overridedef __enter__(self) -> Self:"""Context manager entry point."""self._start_if_needed()return self+ @overridedef __exit__(self,exc_type: type[BaseException] | None,@@ -200,6 +204,7 @@ class RedisSubscriptionBase(Subscription):self.close()return None+ @overridedef close(self) -> None:"""Close the subscription and clean up resources."""if self._closed.is_set():diff --git a/api/libs/broadcast_channel/redis/channel.py b/api/libs/broadcast_channel/redis/channel.pyindex 7f13ebaabcd..bf304cc4a0b 100644--- a/api/libs/broadcast_channel/redis/channel.py+++ b/api/libs/broadcast_channel/redis/channel.py@@ -1,6 +1,6 @@from __future__ import annotations-from typing import Any+from typing import Any, overridefrom extensions.redis_names import serialize_redis_namefrom libs.broadcast_channel.channel import Producer, Subscriber, Subscription@@ -68,20 +68,25 @@ class Topic:class _RedisSubscription(RedisSubscriptionBase):"""Regular Redis pub/sub subscription implementation."""+ @overridedef _get_subscription_type(self) -> str:return "regular"+ @overridedef _subscribe(self) -> None:assert self._pubsub is not Noneself._pubsub.subscribe(self._topic)+ @overridedef _unsubscribe(self) -> None:assert self._pubsub is not Noneself._pubsub.unsubscribe(self._topic)+ @overridedef _get_message(self) -> dict[str, Any] | None:assert self._pubsub is not Nonereturn self._pubsub.get_message(ignore_subscribe_messages=True, timeout=1)+ @overridedef _get_message_type(self) -> str:return "message"diff --git a/api/libs/broadcast_channel/redis/sharded_channel.py b/api/libs/broadcast_channel/redis/sharded_channel.pyindex 02dc9871078..a7303c07823 100644--- a/api/libs/broadcast_channel/redis/sharded_channel.py+++ b/api/libs/broadcast_channel/redis/sharded_channel.py@@ -1,6 +1,6 @@from __future__ import annotations-from typing import Any+from typing import Any, overridefrom extensions.redis_names import serialize_redis_namefrom libs.broadcast_channel.channel import Producer, Subscriber, Subscription@@ -64,17 +64,21 @@ class ShardedTopic:class _RedisShardedSubscription(RedisSubscriptionBase):"""Redis 7.0+ sharded pub/sub subscription implementation."""+ @overridedef _get_subscription_type(self) -> str:return "sharded"+ @overridedef _subscribe(self) -> None:assert self._pubsub is not Noneself._pubsub.ssubscribe(self._topic) # type: ignore[attr-defined]+ @overridedef _unsubscribe(self) -> None:assert self._pubsub is not Noneself._pubsub.sunsubscribe(self._topic) # type: ignore[attr-defined]+ @overridedef _get_message(self) -> dict[str, Any] | None:assert self._pubsub is not None# NOTE(QuantumGhost): this is an issue in@@ -101,5 +105,6 @@ class _RedisShardedSubscription(RedisSubscriptionBase):else:raise AssertionError("client should be either Redis or RedisCluster.")+ @overridedef _get_message_type(self) -> str:return "smessage"diff --git a/api/libs/broadcast_channel/redis/streams_channel.py b/api/libs/broadcast_channel/redis/streams_channel.pyindex 985b253c7ce..30c14585793 100644--- a/api/libs/broadcast_channel/redis/streams_channel.py+++ b/api/libs/broadcast_channel/redis/streams_channel.py@@ -4,7 +4,7 @@ import loggingimport queueimport threadingfrom collections.abc import Iterator-from typing import Self+from typing import Self, overridefrom extensions.redis_names import serialize_redis_namefrom libs.broadcast_channel.channel import Producer, Subscriber, Subscription@@ -165,6 +165,7 @@ class _StreamsSubscription(Subscription):)self._listener.start()+ @overridedef __iter__(self) -> Iterator[bytes]:# Iterator delegates to receive with timeout; stops on closure.with self._lock:@@ -181,6 +182,7 @@ class _StreamsSubscription(Subscription):if item is not None:yield item+ @overridedef receive(self, timeout: float | None = 0.1) -> bytes | None:with self._lock:if self._closed:@@ -200,6 +202,7 @@ class _StreamsSubscription(Subscription):assert isinstance(item, (bytes, bytearray)), "Unexpected item type in stream queue"return bytes(item)+ @overridedef close(self) -> None:with self._lock:if self._closed:@@ -221,11 +224,13 @@ class _StreamsSubscription(Subscription):)# Context manager helpers+ @overridedef __enter__(self) -> Self:with self._lock:self._start_if_needed()return self+ @overridedef __exit__(self, exc_type, exc_value, traceback) -> bool | None:self.close()return Nonediff --git a/api/libs/email_template_renderer.py b/api/libs/email_template_renderer.pyindex 98ea30ab463..f249187e21f 100644--- a/api/libs/email_template_renderer.py+++ b/api/libs/email_template_renderer.py@@ -4,7 +4,7 @@ Email template rendering helpers with configurable safety modes.import timefrom collections.abc import Mapping-from typing import Any+from typing import Any, overridefrom flask import render_template_stringfrom jinja2.runtime import Context@@ -21,6 +21,7 @@ class SandboxedEnvironment(ImmutableSandboxedEnvironment):self._deadline = time.time() + timeout if timeout else Nonesuper().__init__(*args, **kwargs)+ @overridedef call(self, context: Context, obj: Any, *args: Any, **kwargs: Any) -> Any:if self._deadline is not None and time.time() > self._deadline:raise TimeoutError("Template rendering timeout")diff --git a/api/libs/helper.py b/api/libs/helper.pyindex b66079fd5f7..a31b5466248 100644--- a/api/libs/helper.py+++ b/api/libs/helper.py@@ -10,7 +10,7 @@ import uuidfrom collections.abc import Callable, Generator, Mappingfrom datetime import datetimefrom hashlib import sha256-from typing import TYPE_CHECKING, Annotated, Any, Protocol, cast, overload+from typing import TYPE_CHECKING, Annotated, Any, Protocol, cast, overload, overridefrom uuid import UUIDfrom zoneinfo import available_timezones@@ -128,6 +128,7 @@ def run(script):class AppIconUrlField(fields.Raw):+ @overridedef output(self, key, obj, **kwargs):if obj is None:return None@@ -163,6 +164,7 @@ def build_avatar_url(avatar: str | None) -> str | None:class AvatarUrlField(fields.Raw):+ @overridedef output(self, key, obj, **kwargs):if obj is None:return None@@ -175,11 +177,13 @@ class AvatarUrlField(fields.Raw):class TimestampField(fields.Raw):+ @overridedef format(self, value) -> int:return int(value.timestamp())class OptionalTimestampField(fields.Raw):+ @overridedef format(self, value) -> int | None:if value is None:return Nonediff --git a/api/libs/oauth.py b/api/libs/oauth.pyindex 309f2aa812a..687fd086572 100644--- a/api/libs/oauth.py+++ b/api/libs/oauth.py@@ -4,7 +4,7 @@ import jsonimport loggingimport urllib.parsefrom dataclasses import dataclass-from typing import NotRequired, TypedDict+from typing import NotRequired, TypedDict, overrideimport httpxfrom pydantic import TypeAdapter, ValidationError@@ -145,6 +145,7 @@ class GitHubOAuth(OAuth):_USER_INFO_URL = "https://api.github.com/user"_EMAIL_INFO_URL = "https://api.github.com/user/emails"+ @overridedef get_authorization_url(self,invite_token: str | None = None,@@ -161,6 +162,7 @@ class GitHubOAuth(OAuth):params["state"] = statereturn f"{self._AUTH_URL}?{urllib.parse.urlencode(params)}"+ @overridedef get_access_token(self, code: str) -> str:data = {"client_id": self.client_id,@@ -179,6 +181,7 @@ class GitHubOAuth(OAuth):return access_token+ @overridedef get_raw_user_info(self, token: str) -> JsonObject:headers = {"Authorization": f"token {token}"}response = _http_client.get(self._USER_INFO_URL, headers=headers)@@ -219,6 +222,7 @@ class GitHubOAuth(OAuth):return ""+ @overridedef _transform_user_info(self, raw_info: JsonObject) -> OAuthUserInfo:payload = GITHUB_RAW_USER_INFO_ADAPTER.validate_python(raw_info)email = payload.get("email") or ""@@ -238,6 +242,7 @@ class GoogleOAuth(OAuth):_TOKEN_URL = "https://oauth2.googleapis.com/token"_USER_INFO_URL = "https://www.googleapis.com/oauth2/v3/userinfo"+ @overridedef get_authorization_url(self,invite_token: str | None = None,@@ -255,6 +260,7 @@ class GoogleOAuth(OAuth):params["state"] = statereturn f"{self._AUTH_URL}?{urllib.parse.urlencode(params)}"+ @overridedef get_access_token(self, code: str) -> str:data = {"client_id": self.client_id,@@ -274,12 +280,14 @@ class GoogleOAuth(OAuth):return access_token+ @overridedef get_raw_user_info(self, token: str) -> JsonObject:headers = {"Authorization": f"Bearer {token}"}response = _http_client.get(self._USER_INFO_URL, headers=headers)response.raise_for_status()return _json_object(response)+ @overridedef _transform_user_info(self, raw_info: JsonObject) -> OAuthUserInfo:payload = GOOGLE_RAW_USER_INFO_ADAPTER.validate_python(raw_info)return OAuthUserInfo(id=str(payload["sub"]), name="", email=payload["email"])diff --git a/api/libs/oauth_data_source.py b/api/libs/oauth_data_source.pyindex 934aacb45b3..d9971d39928 100644--- a/api/libs/oauth_data_source.py+++ b/api/libs/oauth_data_source.py@@ -1,5 +1,5 @@import urllib.parse-from typing import Any, Literal, TypedDict+from typing import Any, Literal, TypedDict, overrideimport httpxfrom flask_login import current_user@@ -64,6 +64,7 @@ class NotionOAuth(OAuthDataSource):_NOTION_BLOCK_SEARCH = "https://api.notion.com/v1/blocks"_NOTION_BOT_USER = "https://api.notion.com/v1/users/me"+ @overridedef get_authorization_url(self) -> str:params = {"client_id": self.client_id,@@ -73,6 +74,7 @@ class NotionOAuth(OAuthDataSource):}return f"{self._AUTH_URL}?{urllib.parse.urlencode(params)}"+ @overridedef get_access_token(self, code: str) -> None:data = {"code": code, "grant_type": "authorization_code", "redirect_uri": self.redirect_uri}headers = {"Accept": "application/json"}