Reject null governor policy values, remove the unused per-board cadence knob, and await governor shutdown cleanly. Also scope the agent query to governor-managed rows and drop temporary migration server defaults. Co-Authored-By: Claude <noreply@anthropic.com>
60 lines
2.1 KiB
Python
60 lines
2.1 KiB
Python
"""Board model for organization workspaces and goal configuration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from uuid import UUID, uuid4
|
|
|
|
from sqlalchemy import JSON, Column
|
|
from sqlmodel import Field
|
|
|
|
from app.core.time import utcnow
|
|
from app.models.tenancy import TenantScoped
|
|
|
|
RUNTIME_ANNOTATION_TYPES = (datetime,)
|
|
|
|
|
|
class Board(TenantScoped, table=True):
|
|
"""Primary board entity grouping tasks, agents, and goal metadata."""
|
|
|
|
__tablename__ = "boards" # pyright: ignore[reportAssignmentType]
|
|
|
|
id: UUID = Field(default_factory=uuid4, primary_key=True)
|
|
organization_id: UUID = Field(foreign_key="organizations.id", index=True)
|
|
name: str
|
|
slug: str = Field(index=True)
|
|
description: str = Field(default="")
|
|
gateway_id: UUID | None = Field(default=None, foreign_key="gateways.id", index=True)
|
|
board_group_id: UUID | None = Field(
|
|
default=None,
|
|
foreign_key="board_groups.id",
|
|
index=True,
|
|
)
|
|
board_type: str = Field(default="goal", index=True)
|
|
objective: str | None = None
|
|
success_metrics: dict[str, object] | None = Field(
|
|
default=None,
|
|
sa_column=Column(JSON),
|
|
)
|
|
target_date: datetime | None = None
|
|
goal_confirmed: bool = Field(default=False)
|
|
goal_source: str | None = None
|
|
require_approval_for_done: bool = Field(default=True)
|
|
require_review_before_done: bool = Field(default=False)
|
|
comment_required_for_review: bool = Field(default=False)
|
|
block_status_changes_with_pending_approval: bool = Field(default=False)
|
|
only_lead_can_change_status: bool = Field(default=False)
|
|
max_agents: int = Field(default=1)
|
|
|
|
# Auto heartbeat governor policy (board-scoped).
|
|
auto_heartbeat_governor_enabled: bool = Field(default=True)
|
|
auto_heartbeat_governor_ladder: list[str] = Field(
|
|
default_factory=lambda: ["10m", "30m", "1h", "3h", "6h"],
|
|
sa_column=Column(JSON),
|
|
)
|
|
auto_heartbeat_governor_lead_cap_every: str = Field(default="1h")
|
|
auto_heartbeat_governor_activity_trigger_type: str = Field(default="B")
|
|
|
|
created_at: datetime = Field(default_factory=utcnow)
|
|
updated_at: datetime = Field(default_factory=utcnow)
|