fix(backend): resolve circular import for block exclusion constants

Move EXCLUDED_BLOCK_TYPES and EXCLUDED_BLOCK_IDS to backend/data/block.py
to break the circular import chain:
embeddings.py → content_handlers.py → find_block.py → hybrid_search.py → embeddings.py

The constants now live alongside the BlockType enum they reference,
and all consumers import from the single source of truth.

Co-authored-by: Nicholas Tindle <ntindle@users.noreply.github.com>
This commit is contained in:
claude[bot]
2026-02-05 07:12:55 +00:00
parent 54b75a7bbb
commit c4ec780ad6
4 changed files with 22 additions and 28 deletions

View File

@@ -13,28 +13,10 @@ from backend.api.features.chat.tools.models import (
NoResultsResponse,
)
from backend.api.features.store.hybrid_search import unified_hybrid_search
from backend.data.block import BlockType, get_block
from backend.data.block import EXCLUDED_BLOCK_IDS, EXCLUDED_BLOCK_TYPES, get_block
logger = logging.getLogger(__name__)
# Blocks excluded from CoPilot standalone execution
# NOTE: This does NOT affect the Builder UI which uses load_all_blocks() directly
EXCLUDED_BLOCK_TYPES = {
BlockType.INPUT, # Graph interface definition - data enters via chat, not graph inputs
BlockType.OUTPUT, # Graph interface definition - data exits via chat, not graph outputs
BlockType.WEBHOOK, # Wait for external events - would hang forever in CoPilot
BlockType.WEBHOOK_MANUAL, # Same as WEBHOOK
BlockType.NOTE, # Visual annotation only - no runtime behavior
BlockType.HUMAN_IN_THE_LOOP, # Pauses for human approval - CoPilot IS human-in-the-loop
BlockType.AGENT, # AgentExecutorBlock requires execution_context - use run_agent tool
}
# Blocks that have STANDARD/other types but still require graph context
EXCLUDED_BLOCK_IDS = {
# SmartDecisionMakerBlock - dynamically discovers downstream blocks via graph topology
"3b191d9f-356f-482d-8238-ba04b6d18381",
}
class FindBlockTool(BaseTool):
"""Tool for searching available blocks."""

View File

@@ -8,11 +8,7 @@ from typing import Any
from pydantic_core import PydanticUndefined
from backend.api.features.chat.model import ChatSession
from backend.api.features.chat.tools.find_block import (
EXCLUDED_BLOCK_IDS,
EXCLUDED_BLOCK_TYPES,
)
from backend.data.block import get_block
from backend.data.block import EXCLUDED_BLOCK_IDS, EXCLUDED_BLOCK_TYPES, get_block
from backend.data.execution import ExecutionContext
from backend.data.model import CredentialsMetaInput
from backend.data.workspace import get_or_create_workspace

View File

@@ -13,10 +13,7 @@ from typing import Any
from prisma.enums import ContentType
from backend.api.features.chat.tools.find_block import (
EXCLUDED_BLOCK_IDS,
EXCLUDED_BLOCK_TYPES,
)
from backend.data.block import EXCLUDED_BLOCK_IDS, EXCLUDED_BLOCK_TYPES
from backend.data.db import query_raw_with_schema
logger = logging.getLogger(__name__)

View File

@@ -76,6 +76,25 @@ class BlockType(Enum):
HUMAN_IN_THE_LOOP = "Human In The Loop"
# Blocks excluded from CoPilot standalone execution
# NOTE: This does NOT affect the Builder UI which uses load_all_blocks() directly
EXCLUDED_BLOCK_TYPES = {
BlockType.INPUT, # Graph interface definition - data enters via chat, not graph inputs
BlockType.OUTPUT, # Graph interface definition - data exits via chat, not graph outputs
BlockType.WEBHOOK, # Wait for external events - would hang forever in CoPilot
BlockType.WEBHOOK_MANUAL, # Same as WEBHOOK
BlockType.NOTE, # Visual annotation only - no runtime behavior
BlockType.HUMAN_IN_THE_LOOP, # Pauses for human approval - CoPilot IS human-in-the-loop
BlockType.AGENT, # AgentExecutorBlock requires execution_context - use run_agent tool
}
# Blocks that have STANDARD/other types but still require graph context
EXCLUDED_BLOCK_IDS = {
# SmartDecisionMakerBlock - dynamically discovers downstream blocks via graph topology
"3b191d9f-356f-482d-8238-ba04b6d18381",
}
class BlockCategory(Enum):
AI = "Block that leverages AI to perform a task."
SOCIAL = "Block that interacts with social media platforms."