Some checks failed
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Failing after 4m15s
Test Suite / k6 /api/health Baseline (push) Has been skipped
Test Suite / playwright-smoke (push) Has been skipped
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
K-Ext-4/P8 deklarative Agent-Slots; P7 tech_debt Read Model und Vokabular; Review-Attention in den Kernel verlagert. Co-authored-by: Cursor <cursoragent@cursor.com>
55 lines
1.8 KiB
Python
55 lines
1.8 KiB
Python
"""Agent slots for architecture guardrail reviews at active gates."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from steering.eval_context import SteeringEvalContext
|
|
|
|
|
|
def resolve_guardrail_review_slots(
|
|
ctx: SteeringEvalContext,
|
|
read_models: dict[str, Any],
|
|
) -> list[dict[str, Any]]:
|
|
"""Emit guardrail slot when active gate has planning debt or open review actions."""
|
|
horizon = ctx.horizon
|
|
if horizon.kind != "gate" or not horizon.gate_roadmap_item_id:
|
|
return []
|
|
|
|
gate_id = str(horizon.gate_roadmap_item_id)
|
|
guardrail_pack = ctx.agent_slot_config.get("guardrail_pack") or "default_v0"
|
|
|
|
has_planned_guardrail = any(
|
|
review.get("status") == "planned"
|
|
and str(review.get("milestone_id") or "") == gate_id
|
|
for review in ctx.reviews
|
|
)
|
|
if has_planned_guardrail:
|
|
return []
|
|
|
|
planning_debt = read_models.get("planning_debt") or []
|
|
gate_debt = any(str(d.get("roadmap_item_id") or "") == gate_id for d in planning_debt)
|
|
open_review_actions = any(
|
|
action.get("action_kind") == "review"
|
|
and str(action.get("roadmap_item_id") or "") == gate_id
|
|
and action.get("status") in ("open", "ready", "in_progress", "review_required")
|
|
for action in ctx.actions
|
|
)
|
|
if not gate_debt and not open_review_actions:
|
|
return []
|
|
|
|
return [
|
|
{
|
|
"slot_key": "review.guardrail",
|
|
"scope_type": "roadmap_item",
|
|
"scope_id": gate_id,
|
|
"title": horizon.gate_title or "Guardrail-Review",
|
|
"summary": "Architektur-Guardrail für aktives Gate prüfen",
|
|
"actor_role_hint": "architecture_reviewer",
|
|
"payload_keys": ["checklist_id", "guardrail_pack"],
|
|
"guardrail_pack": guardrail_pack,
|
|
"priority": "normal",
|
|
"roadmap_item_id": gate_id,
|
|
}
|
|
]
|