Skip to content
Merged
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
5 changes: 4 additions & 1 deletion examples/personal-workspace-browser/turn-steps.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ export const turnStepsScenario = {
const answer = "两位负责人都保留,中英文分别择时发布。";
const runtime = page.__loopxRuntime;
runtime.sessions.set(turn.sessionId, { ...runtime.sessions.get(turn.sessionId), active_turn_id: null, status: "ready" });
runtime.messages.get(turn.sessionId).push({ message_id: `${turn.turnId}-assistant`, turn_id: turn.turnId, role: "assistant", text: answer });
runtime.messages.get(turn.sessionId).push({
message_id: `${turn.turnId}-assistant`, turn_id: turn.turnId, role: "assistant", text: answer,
created_at: await page.evaluate(() => new Date().toISOString()),
});
live.end(event("turn.completed", { response: { schema_version: "loopx_chat_agent_response_v0", message: answer, proposals: [], gate: null } }));
await page.getByRole("button", { name: "中断本轮", exact: true }).waitFor({ state: "detached" });
const done = page.locator(".personal-message .personal-turn-steps").last();
Expand Down
8 changes: 4 additions & 4 deletions loopx/canary/module_metric_baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
"dict_any_count": 0
},
"loopx/control_plane/goals/goal_frontier/terminal.py": {
"any_count": 22,
"any_count": 15,
"dict_any_count": 0
},
"loopx/control_plane/work_items/interaction_contract.py": {
"any_count": 107,
"any_count": 85,
"dict_any_count": 0
},
"loopx/extensions/lark/goal_topic_runtime.py": {
Expand Down Expand Up @@ -96,7 +96,7 @@
"dict_any_count": 0
},
"loopx/pr_review.py": {
"any_count": 50,
"any_count": 49,
"dict_any_count": 0
},
"loopx/presentation/renderers/status_markdown.py": {
Expand All @@ -109,7 +109,7 @@
"lines": 1999
},
"loopx/slash_command_install.py": {
"any_count": 12,
"any_count": 11,
"dict_any_count": 0
},
"loopx/state_refresh.py": {
Expand Down
22 changes: 11 additions & 11 deletions loopx/control_plane/goals/goal_frontier/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def _terminal_todo_source_state(
done = summary.get("done_count")
deferred = summary.get("deferred_count")
watch_only = summary.get("watch_only_monitor_count", 0)
monitor_open_items = summary.get("monitor_open_items")
if not (
type(total) is int
and total >= 0
Expand All @@ -42,8 +43,8 @@ def _terminal_todo_source_state(
and done + watch_only == total
and _strict_zero(summary.get("convergence_open_count", summary.get("open_count")))
and _strict_zero(deferred)
and isinstance(summary.get("monitor_open_items"), list)
and len(cast(list[Any], summary.get("monitor_open_items"))) == watch_only
and isinstance(monitor_open_items, list)
and len(monitor_open_items) == watch_only
):
return "invalid", False
intent = summary.get("closure_intent")
Expand All @@ -67,14 +68,14 @@ def _projection_has_empty_terminal_frontier(projection: dict[str, Any] | None) -
frontier = projection.get("remaining_advancement_frontier")
monitors = projection.get("monitor_only_lanes")
successors = projection.get("deferred_successors")
if not all(isinstance(value, dict) for value in (normalized, frontier, monitors, successors)):
if not (
isinstance(normalized, dict)
and isinstance(frontier, dict)
and isinstance(monitors, dict)
and isinstance(successors, dict)
):
return False

normalized = cast(dict[str, Any], normalized)
frontier = cast(dict[str, Any], frontier)
monitors = cast(dict[str, Any], monitors)
successors = cast(dict[str, Any], successors)

required_keys = (
(normalized, {"user_open_count", "agent_open_count", "agent_advancement_open_count", "agent_monitor_open_count", "agent_monitor_due_count"}),
(frontier, {"current_agent_claimed_advancement_count", "unclaimed_advancement_count", "other_agent_claimed_advancement_count"}),
Expand Down Expand Up @@ -114,7 +115,7 @@ def _terminal_todo_source_contract(
) -> tuple[dict[str, Any], bool]:
user_status, user_intent = _terminal_todo_source_state(user_todo_summary, role="user")
agent_status, agent_intent = _terminal_todo_source_state(agent_todo_summary, role="agent")
source_completeness: dict[str, Any] = {
source_completeness: dict[str, object] = {
"schema_version": GOAL_TERMINAL_SOURCE_COMPLETENESS_SCHEMA_VERSION,
"user_todos": user_status,
"agent_todos": agent_status,
Expand Down Expand Up @@ -180,9 +181,8 @@ def _terminal_no_followup_resolves_vision_checkpoint(


def goal_frontier_is_terminal_no_followup(*, projection: dict[str, Any] | None) -> bool:
if not _projection_has_empty_terminal_frontier(projection):
if projection is None or not _projection_has_empty_terminal_frontier(projection):
return False
projection = cast(dict[str, Any], projection)
terminal_state = projection.get("terminal_state")
completeness = projection.get("source_completeness")
return bool(
Expand Down
Loading
Loading