Repository navigation
fix(status): distinguish absent Goal status from absent history - #7917
Conversation
Signed-off-by: xiaobaifly7 <196511160+xiaobaifly7@users.noreply.github.com> (cherry picked from commit 681b55910e773c5a0e3900d8bf81c029a1d010a8)
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max.
动机 / Motivation
查看已连接项目当前工作和下一步操作的用户与 Agent。项目只有 Agent 自己的历史记录、当前仍有 Todo 时,旧版显示“从未运行”;新版显示当前 Todo。没有可用 Todo 的同类历史改为 unknown,避免误导重新启动。真实 File、SQLite 的历史、当前 Todo 和空历史对照证明状态区分准确;不由历史记录推断 Host 此刻正在执行。本 PR 不启动 Agent,不改变 quota、claim、gate 或运行历史,也不新增界面和安装流程。
改动思路 / Approach
在原 attention 路由中派生状态并复用现有 canonical Todo,比新增状态字段、强行提升 Agent 历史或另建分类 owner 更小且更真实。当前 PR 边界是既有 status 的只读状态纠正,包含用户 gate、真实 Goal run 和零历史兼容。既有入口、权威来源和失败 owner 继续保留,当前结果由原数据派生,无需人工同步声明。先检查不发布和较小修复:保留现状会保留已复现问题;另建状态或摘要反而增加兼容和同步负担。这里直接扩展最近的既有 owner,正向读回和负向恢复一起验证。
同一历史与 Todo 的真实 CLI 对照:
| 输入 | base | 当前 head |
|---|---|---|
| 只有 Agent 历史,有当前 Todo | connected_without_run | active_state_agent_todo |
| 只有 Agent 历史,没有 Todo | connected_without_run | unknown |
| 确实无历史 | connected_without_run | connected_without_run |
具体改动 / Changes
本次全量 diff 为 126 行增加、3 行删除,覆盖 docs/status-data-contract.md、loopx/control_plane/work_items/attention_queue.py、loopx/control_plane/work_items/attention_routing.py、tests/control_plane/test_status_no_run_projection.py。测试和说明各自服务当前行为,无生成产物或迁移状态。
关键代码讲解
-
goal_attention:没有 Goal 状态记录时,分别判断全量 unique_runs 和兼容 latest_runs;仅确实无历史才显示 connected_without_run。输入来自原公开入口,返回给既有消费者;失败和重试不转交新服务。 -
build_attention_queue:当前用户 gate 仍优先;仅无 Goal 状态记录且分类 unknown 时,使用已有 canonical Todo 路由。输入来自原公开入口,返回给既有消费者;失败和重试不转交新服务。 -
latest_run:已有 agent_lane/status-neutral 过滤继续决定 Goal 状态来源;未分类的真实 Goal run 不被 Todo 静默覆盖。输入来自原公开入口,返回给既有消费者;失败和重试不转交新服务。
修改前契约映射
依据 docs/status-data-contract.md,不可变版本 ba7bf7796ae6b39bf1a3f2012c150eedc5b53b98。以下是原文已有字段/节名,未把本 PR 新写的说明当作独立验收依据:
-
Attention Queue:主工作列表由当前状态路由,不能把缺少 Goal 状态等同于没有任何运行历史。 implemented;见loopx/control_plane/work_items/attention_routing.py及真实 CLI 正负对照。 -
project_asset:当前 Todo 可用时由既有 typed attention owner 派生下一步;gate 与停止条件保留。 implemented;见loopx/control_plane/work_items/attention_queue.py及真实 CLI 正负对照。 -
agent_lane_next_action:Agent lane 的运行建议与 Goal 状态分别投影,不由共享历史取代当前权威工作。 implemented;见loopx/control_plane/runtime/run_history.py及真实 CLI 正负对照。
新增说明披露当前行为。状态值、选择协议和原错误分类复用既有语义,没有按自然语言子串推断状态;也未让只读 guidance 取得执行或结算权限。
对主干的风险 / Risks
未发现阻塞问题。最强负向场景是:真实 Goal run 未分类时仍 unknown/source=latest_run,用户 gate 仍 controller;零历史继续 connected_without_run。原拒绝原因、恢复方式和权威来源保留,来源字节未变。独立执行 File/SQLite 各八组(共十六组),包含 lane/neutral history、用户 gate、真实 blocked run、未分类 Goal run、零历史和空展示;仅验证过的 provider 观察时钟被归一化,未删除状态或错误差异。聚焦 Python 27 PASS,Ruff PASS,标准 premerge PASS(含编译、双语检查、公共边界和十六项 catalog/risk smokes)。初次独立 fixture 缺少 registry domain、观察时钟与未知 schema 的测试预期错误已单独保留并纠正;这些是 harness 问题,未作为 PR 回归。回滚可退回本 PR;恢复继续使用原 provider 或同一 capture 的显式路径。当前 wait_for_ci=false,未获取、轮询或等待远端 CI,也没有把 CI 状态当作本地实证。安装、真实模型理解和完整成本未测;这些限制不被局部分页或状态正确性冒充。
我的整体评价 / Verdict
APPROVE:未发现阻塞项。 本次 named slice 的 source-checkout 行为目标已达成,不把这个结论扩展到父目标完成。在原 attention 路由中派生状态并复用现有 canonical Todo,比新增状态字段、强行提升 Agent 历史或另建分类 owner 更小且更真实。当前 PR 边界是既有 status 的只读状态纠正,包含用户 gate、真实 Goal run 和零历史兼容。long_horizon 保持、现有用户读取体验改善;使用已有上下文和授权,新增人工准备、确认轮次均为零。采纳 repository experience 的真实任务与有用读回建议,同时排除其恢复 RFC 专属场景;没有继承旧案评价或声称记忆带来净收益。未改动渲染布局;已检查 dashboard-page.tsx 对 connected_without_run 的现有消费者,修改的是 status 数据路由。视觉未验证范围:无适用的布局变更;本轮证据边界为精确 head 的 source-checkout CLI。最强未验证范围是安装后运行与实际模型/完整费用,本 PR 未作这些承诺。评审结论、change-quality 及合并 readiness 分别保留;没有合并授权或合并动作。
English verdict: APPROVE — head 57f2f625bde3771caeb6d89552056cd64c369652; no blocking findings. Real File/SQLite CLI proves history-aware status with gates and zero-history behavior preserved. Focused tests and standard premerge pass.
A connected Goal with agent-lane or status-neutral history but no Goal-level status run currently appears as
connected_without_run, which suggests no execution has ever been recorded and can hide authoritative current work. This change distinguishes recorded history from a Goal status run. When current authoritative Todo state exists, attention uses it; otherwise the status remainsunknown. A genuinely never-run Goal still reportsconnected_without_run. The projection does not infer that a host is currently active.Validation: 12 focused status regression tests passed on the current
mainbase. Ruff, the four-file public-boundary/contract scan, and diff whitespace checks passed.