Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion loopx/cli_commands/quota.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"spend_quota_slot",
"void_quota_slot",
),
"loopx.status": ("collect_status",),
"loopx.status": ("collect_status", "external_progress_review_context"),
"loopx.upgrade": ("resolve_codex_app_automation_rrule",),
"loopx.cli_commands.lark_inbox": (
"build_lark_operator_inbox_urgency_projector",
Expand Down
2 changes: 2 additions & 0 deletions loopx/cli_commands/quota_scheduler_followup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
resolve_scheduler_execution_context,
)
from ..quota import record_quota_scheduler_ack
from ..status import external_progress_review_context
from ..upgrade import resolve_codex_app_automation_rrule


Expand Down Expand Up @@ -71,6 +72,7 @@ def _build_scheduler_followup_decision(
bounded_research_frontier_projector=project_live_explore_composition_frontier,
receipt_bound_todo_id=receipt_todo_id,
receipt_bound_replan_obligation_id=receipt_replan_id,
external_progress_review_loader=external_progress_review_context,
turn_instance_id=turn_instance_id,
interaction_projection_hooks=(
repository_delivery_interaction_hook(repo_path=Path.cwd()),
Expand Down
9 changes: 7 additions & 2 deletions loopx/cli_commands/quota_should_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import argparse
from collections.abc import Callable, Mapping
from dataclasses import dataclass, field
from functools import partial
from pathlib import Path
from typing import TYPE_CHECKING, Any

Expand Down Expand Up @@ -367,7 +368,11 @@ def execute_quota_should_run(
todo_id=args.todo_id,
)
complete_context = not getattr(args, "scheduler_observation", False)
payload = export("build_live_quota_should_run_decision")(
decision_builder = partial(
export("build_live_quota_should_run_decision"),
external_progress_review_loader=export("external_progress_review_context"),
)
payload = decision_builder(
status_payload,
goal_id=args.goal_id,
agent_id=args.agent_id,
Expand Down Expand Up @@ -482,7 +487,7 @@ def execute_quota_should_run(
find_monitor_poll_turn=export("find_quota_monitor_poll_turn"),
monitor_poll_recorder=export("record_quota_monitor_poll"),
status_collector=export("collect_status"),
decision_builder=export("build_live_quota_should_run_decision"),
decision_builder=decision_builder,
host_observation_resolver=export("resolve_codex_app_automation_rrule"),
)
execution.heartbeat_receipt_ready = True
Expand Down
9 changes: 8 additions & 1 deletion loopx/cli_commands/turn_decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@
SchedulerExecutionContextResolution,
scheduler_execution_context_for_turn,
)
from ..status import AUTONOMOUS_REPLAN_PERIODIC_LOOKBACK, collect_status
from ..status import (
AUTONOMOUS_REPLAN_PERIODIC_LOOKBACK,
collect_status,
external_progress_review_context,
)
from ..control_plane.effect_runtime import effect_runtime_result
from ..control_plane.work_items.autonomous_replan_obligation import replan_obligation_id_from_packet
from .lark_inbox import build_lark_operator_inbox_urgency_projector
Expand Down Expand Up @@ -192,6 +196,7 @@ def build_turn_decision(
# Preserve ordinary Todo decision/context behavior. Only an
# already bound empty-frontier replan needs this scoped reentry.
receipt_bound_replan_obligation_id=bound_replan,
external_progress_review_loader=external_progress_review_context,
turn_instance_id=turn_instance_id if bound_replan else None,
turn_start_hook_dispatch=dict(turn_start_hook_dispatch or {}),
turn_context_projector=turn_context_projector,
Expand Down Expand Up @@ -387,6 +392,7 @@ def current_turn_host_launch_decision(
bounded_research_frontier_projector=project_live_explore_composition_frontier,
receipt_bound_todo_id=identity.todo_id or None,
receipt_bound_replan_obligation_id=identity.replan_obligation_id,
external_progress_review_loader=external_progress_review_context,
turn_instance_id=identity.turn_instance_id,
turn_start_hook_dispatch=turn_start_hook_dispatch,
workspace_path=Path(args.project).expanduser().resolve(), goal_ref=goal_ref,
Expand Down Expand Up @@ -484,6 +490,7 @@ def current_heartbeat_host_launch_decision(
bounded_research_frontier_projector=project_live_explore_composition_frontier,
receipt_bound_todo_id=selection.receipt_bound_todo_id,
receipt_bound_replan_obligation_id=selection.receipt_bound_replan_obligation_id,
external_progress_review_loader=external_progress_review_context,
retained_action_selection_todo_id=selection.retained_todo_id_for_decision,
turn_instance_id=original_turn, workspace_path=project, goal_ref=goal_ref,
interaction_projection_hooks=(periodic_report_pending_intent_interaction_hook(
Expand Down
14 changes: 9 additions & 5 deletions loopx/control_plane/quota/live_decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

HostObservationResolver = Callable[..., Mapping[str, Any]]
BoundedResearchFrontierProjector = Callable[..., Mapping[str, Any] | None]
ExternalProgressReviewLoader = Callable[[dict[str, Any], Path], dict[str, Any] | None]


def _receipt_bound_guard_fields(
Expand Down Expand Up @@ -676,12 +677,10 @@ def _restore_replan_obligation_without_foreign_acks(
registry_goal: Mapping[str, Any] | None,
registry_path: Path,
runtime_root: Path,
external_progress_review_loader: ExternalProgressReviewLoader | None,
) -> None:
"""Recompute the open review after removing another instance's ACK rows."""
from ...status import (
autonomous_replan_obligation_from_runs,
external_progress_review_context,
)
from ..status.autonomous_replan_projection import autonomous_replan_obligation_from_runs
from ..work_items.autonomous_replan_ack import drop_unowned_recorded_replan_acks
from ..work_items.project_asset import attach_active_state_project_asset_fields
from ..work_items.replan_history_codec import effective_turn_cadence_context
Expand Down Expand Up @@ -739,7 +738,10 @@ def _restore_replan_obligation_without_foreign_acks(
target.pop("autonomous_replan_ack", None)
source_goal = dict(registry_goal) if isinstance(registry_goal, Mapping) else {"id": goal_id}
source_goal.setdefault("id", goal_id)
review = external_progress_review_context(source_goal, runtime_root)
review = (
external_progress_review_loader(source_goal, runtime_root)
if external_progress_review_loader is not None else None
)
cadence_goal_ref = dict(goal_ref) if isinstance(goal_ref, Mapping) else None
attach_active_state_project_asset_fields(
item, latest_runs=filtered,
Expand Down Expand Up @@ -773,6 +775,7 @@ def build_live_quota_should_run_decision(
| None = None,
operator_inbox_urgency_projector: Callable[..., dict[str, Any]] | None = None,
bounded_research_frontier_projector: BoundedResearchFrontierProjector | None = None,
external_progress_review_loader: ExternalProgressReviewLoader | None = None,
receipt_bound_todo_id: str | None = None,
requested_action_todo_id: str | None = None,
receipt_bound_replan_obligation_id: str | None = None,
Expand Down Expand Up @@ -894,6 +897,7 @@ def build_live_quota_should_run_decision(
_restore_replan_obligation_without_foreign_acks(
decision_status_payload, goal_id=goal_id, agent_id=agent_id, goal_ref=goal_ref,
registry_goal=registered_goal, registry_path=registry_path, runtime_root=runtime_root,
external_progress_review_loader=external_progress_review_loader,
)
fresh_operator_inbox_read = _fresh_operator_inbox_read_required(
turn_start_hook_dispatch
Expand Down
Loading