|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | | -import json |
4 | 3 | from collections.abc import Callable, Mapping |
5 | 4 | from dataclasses import dataclass |
6 | 5 | from datetime import datetime, timedelta, timezone |
|
71 | 70 | refine_quota_recommended_action, |
72 | 71 | resolve_quota_run_decision, |
73 | 72 | ) |
74 | | -from .control_plane.quota.goal_boundary import effective_available_capabilities as _effective_available_capabilities, goal_boundary as _goal_boundary, quota_execution_profile_summary as _quota_execution_profile_summary |
| 73 | +from .control_plane.quota.goal_boundary import effective_available_capabilities as _effective_available_capabilities, goal_boundary as _goal_boundary, quota_execution_profile_summary as _quota_execution_profile_summary, registry_goal_by_id as _registry_goal_by_id |
75 | 74 | from .control_plane.quota.monitor_poll import ( |
76 | 75 | QUOTA_MONITOR_POLL_CLASSIFICATION as QUOTA_MONITOR_POLL_CLASSIFICATION, |
77 | 76 | build_quota_monitor_poll_event as build_quota_monitor_poll_event, |
|
116 | 115 | from .control_plane.quota.spend_sources import ( |
117 | 116 | DEFAULT_SLOT_SPEND_SOURCE, |
118 | 117 | ) |
119 | | -from .control_plane.quota.states import QUOTA_STATE_ORDER |
| 118 | +from .control_plane.quota.states import QUOTA_STATE_ORDER, quota_item_is_paused as _quota_item_is_paused |
120 | 119 | from .control_plane.quota.policy_constants import ( |
121 | 120 | AUTONOMOUS_CANDIDATE_CONTEXT_FIELDS, |
122 | 121 | DEFAULT_COMPUTE_QUOTA, |
@@ -1103,25 +1102,6 @@ def _reward_lesson_projection_warning( |
1103 | 1102 | } |
1104 | 1103 |
|
1105 | 1104 |
|
1106 | | -def _registry_goal_by_id(status_payload: dict[str, Any]) -> dict[str, dict[str, Any]]: |
1107 | | - registry_value = status_payload.get("registry") |
1108 | | - if not registry_value: |
1109 | | - return {} |
1110 | | - registry_path = Path(str(registry_value)).expanduser() |
1111 | | - try: |
1112 | | - payload = json.loads(registry_path.read_text(encoding="utf-8")) |
1113 | | - except (OSError, json.JSONDecodeError): |
1114 | | - return {} |
1115 | | - goals = payload.get("goals") if isinstance(payload, dict) else None |
1116 | | - if not isinstance(goals, list): |
1117 | | - return {} |
1118 | | - return { |
1119 | | - str(goal.get("id") or ""): goal |
1120 | | - for goal in goals |
1121 | | - if isinstance(goal, dict) and goal.get("id") |
1122 | | - } |
1123 | | - |
1124 | | - |
1125 | 1105 | def _recovery_delivery_allowed(quota: dict[str, Any], *, plan_ok: bool) -> bool: |
1126 | 1106 | return ( |
1127 | 1107 | bool(plan_ok) |
@@ -2434,22 +2414,6 @@ def _build_quota_should_run_payload( |
2434 | 2414 | QUOTA_PAUSED_MODE = "quota_paused" |
2435 | 2415 |
|
2436 | 2416 |
|
2437 | | -def _quota_item_is_paused(item: dict[str, Any]) -> bool: |
2438 | | - """Return True when a plan item carries a Goal-level hard pause. |
2439 | | -
|
2440 | | - A paused Goal (`quota.compute<=0`) is a typed terminal decision: it is |
2441 | | - evaluated before the selector builds any capability, workspace, replan, |
2442 | | - monitor, or inbox candidate, so no lane can emit a contradicting execution |
2443 | | - signal underneath the pause. |
2444 | | - """ |
2445 | | - |
2446 | | - quota = item.get("quota") if isinstance(item.get("quota"), dict) else {} |
2447 | | - if str(quota.get("state") or "") == "paused": |
2448 | | - return True |
2449 | | - compute = quota.get("compute") |
2450 | | - return isinstance(compute, (int, float)) and not isinstance(compute, bool) and compute <= 0 |
2451 | | - |
2452 | | - |
2453 | 2417 | def _build_quota_paused_should_run_payload( |
2454 | 2418 | status_payload: dict[str, Any], |
2455 | 2419 | *, |
|
0 commit comments