|
8 | 8 | agent_scope_item_claimed_by, |
9 | 9 | agent_scope_item_claimed_by_agent_or_unclaimed, |
10 | 10 | ) |
| 11 | +from ..agents.profile import agent_profile_requires_vision |
11 | 12 | from ..agents.runtime_model import peer_work_key, select_peer_for_work |
12 | 13 | from ..work_items.autonomous_replan_ack import ( |
13 | 14 | autonomous_replan_ack_matches_frontier, |
|
45 | 46 | VISION_ACCEPTANCE_GAP_TRIGGER = "vision_acceptance_gap" |
46 | 47 | VISION_SUCCESSOR_GAP_TRIGGER = "vision_successor_required" |
47 | 48 | VISION_CHECKPOINT_MISSING_TRIGGER = "vision_checkpoint_missing" |
| 49 | +VISION_PROFILE_MISSING_TRIGGER = "required_agent_vision_missing" |
48 | 50 | TODO_SUCCESSION_GAP_TRIGGER = "completed_advancement_without_successor" |
49 | 51 | TODO_TASK_CLASS_ADVANCEMENT = "advancement_task" |
50 | 52 | TODO_TASK_CLASS_MONITOR = "continuous_monitor" |
@@ -634,6 +636,41 @@ def acceptance_gaps_from_agent_vision( |
634 | 636 | return [gap] |
635 | 637 |
|
636 | 638 |
|
| 639 | +def acceptance_gaps_from_agent_profile_requirement( |
| 640 | + agent_profile: dict[str, Any] | None, |
| 641 | + *, |
| 642 | + agent_id: str | None, |
| 643 | + agent_vision: dict[str, Any] | None, |
| 644 | + missing_checkpoint: dict[str, Any] | None, |
| 645 | +) -> list[dict[str, Any]]: |
| 646 | + """Require a vision baseline for registered long-lived peer lanes.""" |
| 647 | + |
| 648 | + if ( |
| 649 | + not agent_id |
| 650 | + or not agent_profile_requires_vision(agent_profile) |
| 651 | + or isinstance(agent_vision, dict) |
| 652 | + or isinstance(missing_checkpoint, dict) |
| 653 | + ): |
| 654 | + return [] |
| 655 | + return [ |
| 656 | + { |
| 657 | + "kind": VISION_PROFILE_MISSING_TRIGGER, |
| 658 | + "source": "agent_profile", |
| 659 | + "agent_id": agent_id, |
| 660 | + "replan_trigger_summary": ( |
| 661 | + "the registered long-lived agent lane requires a persisted vision " |
| 662 | + "baseline before ordinary delivery or monitor-only quiet wait" |
| 663 | + ), |
| 664 | + "acceptance_summary": ( |
| 665 | + "Write a bounded agent vision with objective, acceptance evidence, " |
| 666 | + "advancement policy, and replan trigger; or explicitly mark the " |
| 667 | + "profile vision requirement optional." |
| 668 | + ), |
| 669 | + "advancement_policy": "repeat_until_closed", |
| 670 | + } |
| 671 | + ] |
| 672 | + |
| 673 | + |
637 | 674 | def acceptance_gaps_from_vision_checkpoint( |
638 | 675 | checkpoint: dict[str, Any] | None, |
639 | 676 | ) -> list[dict[str, Any]]: |
@@ -1187,7 +1224,8 @@ def derive_goal_frontier_replan_obligation_from_summaries( |
1187 | 1224 | item for item in (acceptance_gaps or []) if isinstance(item, dict) |
1188 | 1225 | ] |
1189 | 1226 | successor_vision_required = any( |
1190 | | - item.get("kind") == VISION_SUCCESSOR_GAP_TRIGGER |
| 1227 | + item.get("kind") |
| 1228 | + in {VISION_SUCCESSOR_GAP_TRIGGER, VISION_PROFILE_MISSING_TRIGGER} |
1191 | 1229 | for item in compact_acceptance_gaps |
1192 | 1230 | ) |
1193 | 1231 | acceptance_allows_watch_lane_continuation = bool( |
@@ -1514,6 +1552,7 @@ def build_goal_frontier_projection_context_from_status( |
1514 | 1552 | neutral_replan_ack_classifications: set[str], |
1515 | 1553 | registered_agent_ids: list[str] | None = None, |
1516 | 1554 | goal_status: str | None = None, |
| 1555 | + agent_profile: dict[str, Any] | None = None, |
1517 | 1556 | ) -> dict[str, Any]: |
1518 | 1557 | """Build the quota-facing goal-frontier read model. |
1519 | 1558 |
|
@@ -1548,7 +1587,13 @@ def build_goal_frontier_projection_context_from_status( |
1548 | 1587 | agent_id=agent_id, |
1549 | 1588 | ) |
1550 | 1589 | source_acceptance_gaps = ( |
1551 | | - acceptance_gaps_from_agent_vision( |
| 1590 | + acceptance_gaps_from_agent_profile_requirement( |
| 1591 | + agent_profile, |
| 1592 | + agent_id=agent_id, |
| 1593 | + agent_vision=latest_agent_vision, |
| 1594 | + missing_checkpoint=latest_missing_vision_checkpoint, |
| 1595 | + ) |
| 1596 | + + acceptance_gaps_from_agent_vision( |
1552 | 1597 | latest_agent_vision, |
1553 | 1598 | goal_status=goal_status, |
1554 | 1599 | ) |
|
0 commit comments