fix(todos): share typed Agent addressing across list and quota reads - #4823
huangruiteng wants to merge 2 commits into
Conversation
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Exact head: b30c42789983c594d29f633ca3527886793a5246; reviewed against 0ef7ebd749ec97a698a8fc7f2a29844dd368689b.
动机
没有发现未解决的阻塞项。旧 todo list --agent-id 的 Python User 谓词忽略仅有 claimed_by 的历史记录,因此 B 的 gate/action 会混进 A 的列表,而 quota 已按 TS 规则排除它们。基线实际 legacy/File/SQLite CLI 均复现错误。这是 #4574、shared-authority L5 和 TS T2 下一个有独立用户结果的增量,不代表默认 provider 或整个 L5 已完成。
改动思路
复用现有 todo.summary_lanes.project 批次,先从完整来源完成 resume/succession,再执行 Agent/status/id 筛选,最后生成 lanes、计数及有界展示。agent_scope.ts 统一列表、quota 和 decision scope 的寻址规则。显式 global/blocks 优先于 gate 的旧 claim;action 的显式 binding 优先于旧 claim;Agent 工作仍受 claim/exclusion 过滤。保留 quota 额外的执行资格检查,可见不等于授权。
只在 Python 加 claim fallback 虽然更短,却会留下本次已发生漂移的第二份决策规则。独立 TS 筛选 RPC 则会多一次跨语言调用;当前方案扩展既有 owner,没有新增 capability/provider、持久化字段或 CLI 参数。Python 仍负责真实调用者需要的输入适配和展示。
具体改动
17 个路径,+431/-82:8 个产品路径 +107/-82,5 个测试/fixture 路径 +259,4 个文档路径 +65。删除独立 Python 列表谓词和旧 gate_scope.ts,更新真实引用;新增的 27 行范围模块承接原有 gate、action、claim 规则。内部 v1 request 带筛选意图,v0 调用兼容;response 中的 source indices 是当次快照的派生索引,不是新的权威状态。
测试包含真实 CLI、混合 native/legacy 复杂图的跨 provider conformance 和桥接负例。中英文 shared-authority RFC、TS checkpoint 和读取文档记录实际行为及未完成边界。前端/Lark manager 的实际调用使用未按 Agent 筛选的 Core 整 Goal 读取,不需要配置或编辑器 companion 改动。
关键代码讲解
agent_scope.ts:19 actionAddressesAgent:显式bound优先,其次claim。列表与 quota 引用同一函数;所有保留的非user_gateUser 类别都走 action 范围,避免只修显式user_action而遗漏历史类别。summary_lanes.ts:74 selectRows:筛选已求值的完整来源行,保留row.ordinal。筛选后的第 0 行不一定来自原数组第 0 行;先解码编号、再过滤保证身份不被重编号破坏。todo_summary.py:894 _project_summary_lanes:在原 summary 调用中传递 selection,校验返回索引为精确整数、唯一、合法范围且 lane 不越出 selected source。缺少 v1 selection metadata 的旧响应会报错,不会静默退回整列表。
对主干的风险
最大风险是从筛选后的局部视图重新推导依赖,或把筛选位置误当来源位置。真实 CLI 的已归档依赖、复杂图中的推导 successor、limit=1 保留完整匹配计数,以及错误 ordinal/downlevel 响应测试覆盖这些路径。缺失 Markdown 时 canonical CLI 仍正常读取;权威源不可用时失败关闭,不能悄悄回退旧展示文件。独立 provider readback 验证读取无写入。
整合最新 main(含 #4820)后重新验证:Python 121/121、TS 定向 23/23、真实隔离 PostgreSQL 16 193/193;File/SQLite/reference 的 native/legacy scope conformance 6/6。Canary 19/19 加五项直接检查通过;typecheck、Ruff、compile、配置内 mypy 及 public boundary 检查通过,无失败、跳过或 manual hold。质量 receipt 已验证;按 wait_for_ci=false 未查询或等待远端 CI。
真实来源的只读快照(1,005 Todos/9 leases)在同一输入上对照基线与新 head,File/SQLite/PostgreSQL 一致;整 Goal、Agent 工作视图和计数保持一致,peer-only User 泄漏按预期消失。此 PG 证据覆盖实际 store/runtime/read consumer,不覆盖 HTTP/auth 服务部署。
效率存在可测代价:8 次 warm 样本中,六次 runtime crossing 不变,传输 147,838→202,692 bytes,median 390→419 ms。样本不构成 SLO,不能宣传性能改善;作为一项非阻塞效率提示保留。没有提高硬预算或隐藏失败。后续 native consumer 迁移才有条件继续删除桥接。回滚只需还原代码,无持久化数据迁移。
语义与 CI 对齐
复用既有 gate/action/claim 词汇与 typed owner,未新增状态分类或领域专用义务。旧列表行为变化在读取文档中明确披露。范围筛选是机器执行的读取语义,不是可忽略的 guidance,也不是执行许可。仓库本地要求及风险选择检查已执行;不把未验证的 PostgreSQL 服务运维、D1 freshness、D2 soak 或整 Goal 默认切换包装成本 PR 验收通过。
我的整体评价
APPROVE。这是完整的 read-consumer 修复和边界重构,保留必要 Python 宿主适配,同时真正移除重复的决策知识;Python 产品代码净减仅 14 行,不应夸称大规模 Python 退出。已做相邻重构检查,应用共享范围 owner 与索引校验,暂不为此拆散整个大 renderer。剩余 caller/executor、其他 L5 recovery、contributor D2、whole-Goal capture/cutover 和默认 onboarding 仍依 RFC 条件估计为 5–8 个完整 PR,不能按本 PR 数量机械递减。保留 maintainer 合并边界。
English verdict: APPROVE - b30c427. No blocking findings: scoped Todo reads now reuse typed addressing, with explicit User-visibility correction, full-source topology/count preservation and no authority write. Final local validation: 121 Python, 23 targeted TS, 193 real PostgreSQL tests and 19 Canary checks passed. Payload/latency overhead is disclosed; default promotion and PostgreSQL service deployment remain unqualified. Maintainer merge required.
huangruiteng
left a comment
There was a problem hiding this comment.
Merge-readiness qualification (exact head; no duplicate fresh audit)
Exact head: b30c42789983c594d29f633ca3527886793a5246
Current origin/main: 09f10c4e37b89c6ed25f2f2354f89d641662e83c
当前 head 已有一份 capability 认可的完整 author-owned APPROVE 结论,因此这次没有重复发布同一审阅;本次只执行队列要求的 exact-head merge-readiness qualification。
结论:not ready。
loopx pr-review --check-merge-readiness 4823@b30c42789983c594d29f633ca3527886793a5246返回ready=false,blocking reasons 为status_checks_failed、status_checks_incomplete、merge_state_requires_update。- 当前有效 checks 为 25 success / 5 failure;失败项是
test-shard、test-shard (2)、stage2c (...)、pytest、merge-gate。 - 我用最新
origin/main做本地 merge-tree:exit 1,唯一实际 content conflict 在loopx/control_plane/todos/quota_selection.ts。冲突点不是纯格式:main 新增了admittedDue/watchOnlyMonitors逻辑,而本分支把activeVisible切换到共享的actionAddressesAgent,rebase 时需要保留两边语义。
最小修复:在最新 main 上 rebase/merge,解决 quota_selection.ts 时同时保留 main 的 monitor admission 变量与本 PR 的共享 Agent-addressing owner;随后重跑本 PR 已声明的 Python/TS scoped-read 回归、真实 PostgreSQL conformance 和 premerge gate。head 会变化,因此旧 exact-head 结论不能直接继承,需重新运行 PR-review capability 和 merge-readiness gate。
English verdict: REQUEST_CHANGES - head b30c427 is not merge-ready against main 09f10c4; resolve the semantic conflict in quota_selection.ts, rerun the scoped-read/real-store validations, then obtain a fresh exact-head review.
Agent-scoped Todo lists ignored retained
claimed_byon User records, so another Agent's gate/action appeared in the current lane while quota correctly scoped it out. Lists now share typed addressing with quota and decision scope, composed into the existing summary batch.Validation at
b30c42789983c594d29f633ca3527886793a5246, integrated onto main0ef7ebd749ec97a698a8fc7f2a29844dd368689b: 121 Python consumer/CLI regressions, 23 targeted TS tests and 193 real isolated PostgreSQL 16 integration cases passed, with no skips. File/SQLite/reference scope conformance passed six native/legacy cases. Canary passed 19 selected checks and five direct checks; typecheck, Ruff, compile, configured mypy and public-boundary scan passed. Change-quality receipt verified, with one efficiency advisory. Required local validation passed; remote CI was not consulted under the resolved review policy.Baseline independently reproduced five scope failures, including actual legacy/File/SQLite CLI paths. A read-only source-snapshot rehearsal covers 1,005 Todos/9 leases and compares immutable baseline/head consumers on real File/SQLite/PostgreSQL. Provider heads agree, reads/source remain unchanged, and full Goal/Agent-work observations retain parity. PostgreSQL qualification exercises the production store/runtime and read consumer, not a deployed HTTP/auth service. Missing display, archived dependency, display limits and malformed/downlevel response paths are covered.
Cost is disclosed: in an eight-sample warm comparison, complete summary plus exact-Todo filtering retained six runtime calls; request bytes increased from 147,838 to 202,692 and median runtime from 390 ms to 419 ms. This is a bounded local observation, not an SLO or performance improvement. The extra scope facts replace Python policy; further bridge retirement belongs with native consumer ownership. Net Python product reduction is 14 lines; this PR retires duplicate decisions rather than claiming wholesale Python removal.
Toward #4574 / shared-authority L5 / TS T2. This does not certify D1 freshness, contributor-owned D2 (#4224), whole-Goal migration (#4799), default onboarding or PostgreSQL service deployment. No active Goal was mutated/promoted. Maintainer merge required.