Repository navigation
refactor(work-items): slim progress_observation to <=550 LOC and Zero-Any - #9483
Conversation
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
收紧重规划观察桥接层的类型和扫描开销,在恢复与写回时保持同 Turn 身份和新证据要求。 原 Python facade 归一化观察和 obligation 历史,TS owner 决定重放、阻塞的新颖性和合格写回。 运行控制面重规划、回放原 Turn 和检查结算结果的 Host。
只看表面完成或重复观察会把同一证据误当新进展并提交额外副作用。 相同证据按稳定顺序产生相同 fingerprint。两次独立 Turn 触发复核,同一 Turn 重试不触发。 投影测试基线 67 项、精确头 71 项通过。独立探针读回相同 fingerprint b133896233e4be38、同一 Turn 计数 1、两个历史 Turn 计数 2。旧 blocker 被拒,新的 blocker 触发 new_concrete_blocker。配对 DSH CLI 从 File 和 SQLite 读回未授权零扣额、合格写回后同 Turn 重放仍只有一次扣额。git diff --check 与 merge-tree 通过。 验证在隔离源检出中使用真实 CLI、TS 与 File/SQLite,DSH 模型为合成适配器。安装版、真实模型、远程 CI 未核验。生产路径使用 JSON 数组。直接传入 Python tuple 时,基线返回触发器,精确头返回空列表。 基线契约
改动思路 / Approach
该改动沿用 DSH turn run-once → native replan packet/readback → typed progress writeback owner。复用既有 normalize、replan context 和共享 typed owner,拆出的窄 helper 保持原结构化事实。 以稳定观察字段计算摘要。新颖性依据原完整历史和当前上下文快照,由原 TS 校验同 Turn 与写入义务。 保留现有 owner 及既有关联证据。薄投影只读 canonical 证据,无需新恢复状态或兼容 shim。
具体改动 / Changes
精确提交 f0f52c0,本次对照目标 81ff83a。完整 diff 自分叉点 7f7297a 起,共 4 文件,+570/-305。
关键代码讲解
-
normalize_progress_observation。以稳定身份与有序证据生成原 fingerprint。 源码 -
semantic_delta_from_writeback。把当前、历史和上下文作为原 runtime 输入。 源码 -
build_replan_action_packet。使用原 obligation 与要求发出后续工作或结算入口。 源码 -
replan-writeback-requires-fresh-bound-semantic-evidence(implemented)。确认历史作用域与真实性,重复 Turn 或旧 blocker 无法冒充新 progress。验收后可按原身份重放。
对主干的风险 / Risks
历史出现过的 blocker 在新 work item 仍不能作为新证据结算。用真实 TypeScript 审查,新的 blocker 可形成原接受结果。 以完整历史判断证据新颖性很重要,因为可见窗口可能已经省略先前的 blocker。否则同一障碍可能在后续 Turn 被重复计为新进展,进而产生新的回执与额度消耗。 维持基于原 Turn identity 和历史完整度的 TS owner 检查。
我的整体评价 / Verdict
APPROVE。 生产 wire 输入通过配对验证。真实 TypeScript owner 在两个存储上维持证据资格、绑定 Turn 身份和按一次成功扣额的规则。模型限于隔离适配器。 保留已有证据、可归因进展与原恢复边界。
English verdict: APPROVE at f0f52c0. Paired native replan tests preserved same-Turn deduplication, fresh-evidence qualification, and File/SQLite writeback and replay.
…cans in progress_observation Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
f0f52c0 to
83410fc
Compare
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · deepseek-flash · DeepSeek · runtime_reported · high
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
收紧重规划观察桥接层的类型和扫描开销,在恢复与写回时保持同 Turn 身份和新证据要求。 原 Python facade 归一化观察和 obligation 历史,TS owner 决定重放、阻塞的新颖性和合格写回。 运行控制面重规划、回放原 Turn 和检查结算结果的 Host。
只看表面完成或重复观察会把同一证据误当新进展并提交额外副作用。 相同证据按稳定顺序产生相同 fingerprint。两次独立 Turn 触发复核,同一 Turn 重试不触发。 投影测试基线 67 项、精确头 71 项通过。独立探针读回相同 fingerprint b133896233e4be38、同一 Turn 计数 1、两个历史 Turn 计数 2。旧 blocker 被拒,新的 blocker 触发 new_concrete_blocker。配对 DSH CLI 从 File 和 SQLite 读回未授权零扣额、合格写回后同 Turn 重放仍只有一次扣额。git diff --check 与 merge-tree 通过。 验证在隔离源检出中使用真实 CLI、TS 与 File/SQLite,DSH 模型为合成适配器。安装版、真实模型、远程 CI 未核验。生产路径使用 JSON 数组。直接传入 Python tuple 时,基线返回触发器,精确头返回空列表。 基线契约
改动思路 / Approach
该改动沿用 DSH turn run-once → native replan packet/readback → typed progress writeback owner。复用既有 normalize、replan context 和共享 typed owner,拆出的窄 helper 保持原结构化事实。 以稳定观察字段计算摘要。新颖性依据原完整历史和当前上下文快照,由原 TS 校验同 Turn 与写入义务。 保留现有 owner 及既有关联证据。薄投影只读 canonical 证据,无需新恢复状态或兼容 shim。
具体改动 / Changes
精确提交 83410fc,本次对照目标 81ff83a。完整 diff 自分叉点 7f7297a 起,共 4 文件,+570/-305。
关键代码讲解
-
normalize_progress_observation。以稳定身份与有序证据生成原 fingerprint。 源码 -
semantic_delta_from_writeback。把当前、历史和上下文作为原 runtime 输入。 源码 -
build_replan_action_packet。使用原 obligation 与要求发出后续工作或结算入口。 源码 -
replan-writeback-requires-fresh-bound-semantic-evidence(implemented)。确认历史作用域与真实性,重复 Turn 或旧 blocker 无法冒充新 progress。验收后可按原身份重放。
对主干的风险 / Risks
历史出现过的 blocker 在新 work item 仍不能作为新证据结算。用真实 TypeScript 审查,新的 blocker 可形成原接受结果。 以完整历史判断证据新颖性很重要,因为可见窗口可能已经省略先前的 blocker。否则同一障碍可能在后续 Turn 被重复计为新进展,进而产生新的回执与额度消耗。 维持基于原 Turn identity 和历史完整度的 TS owner 检查。
当前 exact head 复核 / Rebased-head validation
PR #9483 已无冲突 rebase 到 origin/main 2302e42d9cad35a8a4150e24496ffecfbfdce8cb,当前精确头为 83410fc9050d5545a1950883b225d21818ce929e。本轮在新 base 上重新执行定向测试、静态检查和 diff 级 premerge。
最终 exact head 复核:4 项 progress-observation 合约测试通过;核心文件严格 mypy、Ruff、diff 检查和标准 premerge 的 13 项选定检查全部通过。触发计数、历史 generator、successor writeback 与 loopx-jev import pin 均保持。
我的整体评价 / Verdict
APPROVE。 生产 wire 输入通过配对验证。真实 TypeScript owner 在两个存储上维持证据资格、绑定 Turn 身份和按一次成功扣额的规则。模型限于隔离适配器。 保留已有证据、可归因进展与原恢复边界。
English verdict: APPROVE at 83410fc. Paired native replan tests preserved same-Turn deduplication, fresh-evidence qualification, and File/SQLite writeback and replay.
Summary
Slims
loopx/control_plane/work_items/progress_observation.pyin place and eliminates allAnytype usages across the module and its new contract test suite while preserving every exported constant, typed facade signature,loopx-jevpackage kernel pin, and runtime behavior.Changes
loopx/control_plane/work_items/progress_observation.py(566 -> 503 <= 550LOC,41 -> 0ASTAny,0 # type: ignore,0 # noqa,max_span=80):Anysurfaces with explicitTypedDict(ProgressTriggerRule,ObservationCheckpoints,ProgressDeltaFields,ReplanContextFields,ReplanActionPacket),Literal, andCallablecontracts._validated_replan_context,_obligation_baseline_and_window, and_successor_writeback_contract.history_runsnormalization to zero-copySequencehandling and_stable_idsdeduplication toO(1)setlookups while keeping a singlecoverage_completeread and exactreplan_successor_semantic_binding(None, None, None)fallback call semantics.tests/architecture/package_kernel_import_pins.json(loopx-jev) import pin with0changes toautonomous_replan_obligation.py,module_metric_baseline.json, and top-levelloopx/*.py(112).mypycompatibility updates):loopx/control_plane/work_items/external_progress_review.py: narrowedobservation["fingerprint"]tostr(+1/-1).loopx/control_plane/work_items/semantic_replan_writeback.py: checkedraw_outcomescontainer type before membership lookup (+4/-3).tests/control_plane/test_progress_observation_contract.py(327LOC,0ASTAny,0 # type: ignore,0 # noqa):Any/loopx-jevpin/export invariants, malformed-input fail-closed validation,_progress_turn_instance_id, TypeScript codec error surfacing, single-pass trigger counting & generatorhistory_runs,recovering_writeback_pathchecks, andbuild_replan_action_packetcommand formatting.Verification
origin/mainvsHEADcounterfactual parity (14/14exact matches): verifiednormalize_progress_observation, historical extraction,_progress_turn_instance_id, writeback requirements, transition eligibility/delta, trigger kinds/checkpoints,semantic_delta_from_writeback, andbuild_replan_action_packet.pytest -n 6 -rs(control-plane, delivery/refresh, architecture, canary suites):3,033 passed, 18 skipped, 0 failed(18environment skips for PowerShell 7/Windows launcher and non-UTF-8/root APFS filesystem cases).packages/loopx-jev/tests(6suites):57 passed.mypy&ruff:ruff check(4/4clean),mypy --strict --no-incremental --follow-imports=silent(2/2clean),[tool.mypy](17/17clean),40-file*.pycallermypy(336 -> 336,0errors in touched files), and cross-module--follow-imports=normalclean.npm run typecheck:control-planeclean; TS replan/progress/delivery suites158 passed, 0 failed, 0 skipped.scripts/check_rfc_bilingual.pypassed,loopx check(0errors,0warnings), Goal CQR receiptcqr_147f7fbf9eba80e39967(decision=pass,status=valid),canary premerge(tier=standard,gate.status=passed,direct_checks=4/4,python_compile=1/1,catalog_canaries=5/5,risk_profile_smokes=8/8,failures=0).