fix(briefing): exclude paused-project tasks from briefing tooling
list_notes gains exclude_paused_projects; list_tasks tool sets it when no explicit project filter is given. Paused projects no longer leak tasks into briefings or list_tasks results. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -136,6 +136,7 @@ async def list_notes(
|
|||||||
milestone_ids: list[int] | None = None,
|
milestone_ids: list[int] | None = None,
|
||||||
parent_id: int | None = None,
|
parent_id: int | None = None,
|
||||||
no_project: bool = False,
|
no_project: bool = False,
|
||||||
|
exclude_paused_projects: bool = False,
|
||||||
sort: str = "updated_at",
|
sort: str = "updated_at",
|
||||||
order: str = "desc",
|
order: str = "desc",
|
||||||
limit: int = 50,
|
limit: int = 50,
|
||||||
@@ -211,6 +212,17 @@ async def list_notes(
|
|||||||
query = query.where(Note.project_id.is_(None))
|
query = query.where(Note.project_id.is_(None))
|
||||||
count_query = count_query.where(Note.project_id.is_(None))
|
count_query = count_query.where(Note.project_id.is_(None))
|
||||||
|
|
||||||
|
if exclude_paused_projects:
|
||||||
|
from fabledassistant.models.project import Project
|
||||||
|
paused_ids = (
|
||||||
|
select(Project.id)
|
||||||
|
.where(Project.user_id == user_id, Project.status == "paused")
|
||||||
|
.scalar_subquery()
|
||||||
|
)
|
||||||
|
paused_filter = or_(Note.project_id.is_(None), Note.project_id.not_in(paused_ids))
|
||||||
|
query = query.where(paused_filter)
|
||||||
|
count_query = count_query.where(paused_filter)
|
||||||
|
|
||||||
sort_col = getattr(Note, sort, Note.updated_at)
|
sort_col = getattr(Note, sort, Note.updated_at)
|
||||||
if order == "asc":
|
if order == "asc":
|
||||||
query = query.order_by(sort_col.asc())
|
query = query.order_by(sort_col.asc())
|
||||||
|
|||||||
@@ -1509,6 +1509,7 @@ async def execute_tool(
|
|||||||
due_after=_parse_due_date(arguments.get("due_after")),
|
due_after=_parse_due_date(arguments.get("due_after")),
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
milestone_id=milestone_id,
|
milestone_id=milestone_id,
|
||||||
|
exclude_paused_projects=project_id is None,
|
||||||
limit=int(arguments.get("limit", 10)),
|
limit=int(arguments.get("limit", 10)),
|
||||||
sort="due_date",
|
sort="due_date",
|
||||||
order="asc",
|
order="asc",
|
||||||
|
|||||||
Reference in New Issue
Block a user