Skip to content

Capture authenticated LoopX receipts for Research attention - #8790

Merged
huangruiteng merged 3 commits into
mainfrom
codex/attention-loopx-receipts
Nov 19, 2026
Merged

huangruiteng merged 3 commits into
mainfrom
codex/attention-loopx-receipts

Conversation

@cocolord

@cocolord cocolord commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Problem boundary

The Research human-attention observer can already read a source-bound capture, but authenticated LoopX operation and team-plan card decisions remain stranded in ChatActionStore. Existing research packs therefore cannot show even the conservative subset of human intervention already recorded by LoopX.

Change boundary

  • Persist explicit actor_class: human and authenticated Lark callback provenance after identity, principal, delivery and membership verification.
  • Add an opt-in trajectory-pack-register bridge that projects only Goal-scoped operation.execute and team.plan decisions inside an explicit UTC window.
  • Write minimal, immutable, digest-named receipt/capture artifacts under the already authorized source root; omit principals, card payloads, transcripts and native traces.
  • Backfill pre-marker receipts only when the complete historical authenticated-card shape and delivery/authority bindings still match, and label that evidence as legacy.
  • Keep the TypeScript trajectory observer as the Attention semantic owner; Python only bridges durable receipts into its existing source contract.

Non-goals and coverage

This does not add Session fields or collect DSH/Codex runtime-native approvals. Dashboard/private-chat actions without authenticated callbacks, pending/expired requests and active attention time remain unobserved. The generated capture is deliberately partial: card delivery to confirmation contributes response waiting, while active attention stays unknown. There is no UI or first-screen change.

Validation

  • 54 passed — trajectory assessment store, including real CLI registration, immutable replay, spoofed-surface rejection, conservative legacy backfill and citation redaction.
  • 61 passed — Chat/Lark operation and team-plan receipt paths.
  • 5 passed — TypeScript human-attention projection semantics.
  • 34 passed, 35 skipped — DSH operation consumers; no runtime-native approval is reclassified.
  • Ruff, Python compile, semantic vocabulary advisory/full-tree smoke and bilingual RFC check passed.
  • Standard premerge selected 9 catalog canaries, 8 risk-profile smokes and the public-boundary scan; all automated checks passed. It correctly retained the repository's benchmark_sensitive maintainer-review hold.
  • A broader operation suite produced 38 passed, 4 failed; all four Goal-activation fixture failures reproduce unchanged on base 74ca883.
  • The existing Research reader browser smoke was attempted with local Chrome but the fixture route timed out before .research-progress; no UI files changed, and producer-to-reader semantics are covered by the real CLI and TypeScript tests above.

Visual evidence

Not applicable: the Research attention presentation and first screen are unchanged.

  • Re-review at b511051 staged attention bytes before publication; the real CLI now proves a bad source leaves source-root/runtime files unchanged, the corrected retry reads back one event, and replay reuses the same artifacts. Standard premerge then completed with 0 check failures and only the repository benchmark-sensitive maintainer-review hold.

@cocolord cocolord left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · GPT-5 · OpenAI · self_reported

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

投研工作台的 pack 注册者需要把 LoopX 已经保存的真实人工确认纳入 Attention,而不是继续手工重录、让这些记录滞留在 ChatActionStore,或把“未采集”误读成零投入。

此前 Research observer 已能读取显式绑定的 trajectory_human_attention_v1 capture,但同一 Goal 中已经完成的 Lark operation confirmation 与 team-plan review confirmation 没有 producer 接到这条来源链。现在操作者在注册目标 pack 时给出成对 UTC 时间窗,系统只投影经过认证、能回绑 Goal、投递和权限的人工决定,生成可引用且不可变的 partial capture。

这项改动让已有 LoopX 回执成为可审计的 Attention 来源,并保持旧输入、旧 pack 和既有 UI 不变。它不采集 Session 字段、DSH/Codex runtime-native approval、未认证 Dashboard/私聊动作,也不估算主动思考时长或介入必要性;这些缺口继续显示为 unknown,而不是零。后续仍需由各 runtime/harness owner 提供自己的 typed human receipt,不能扩大本 adapter 去做角色、文本或 gate 状态推断。

改动思路 / Approach

实现沿用现有 owner 分工:ChatActionStore 继续拥有 durable action receipt;Lark callback 在 identity、principal、delivery、card 与 membership 校验之后写入 actor_class=human 和认证 provenance;Python adapter 只负责 Goal + 显式时间窗筛选、legacy compatibility、脱敏和 create-only artifact;既有 TypeScript projectTrajectoryHumanAttention 仍独占去重、类型计数、主动/等待区间并集及 unknown 语义。

flowchart LR
  A["Authenticated Lark callback"] --> B["ChatActionStore receipt"]
  B --> C{"Goal + UTC window + provenance + one principal"}
  C -->|pass| D["Immutable redacted receipt/capture"]
  C -->|fail| E["Reject or exclude; never infer a human event"]
  D --> F["TypeScript Attention projection"]
  F --> G["Research pack readback"]
Loading

上图是对 exact head d347f27da4cee12b1c56dd9ffc640d643023758a 的源码派生说明,不替代执行证据。当前 PR 边界是显式 opt-in 的 pack-registration bridge,加上 co-deployed Lark producer marker;它不新增调度、权限或 UI authority。最小方案不能只在 reader 里按 provider=lark 猜测,因为那会把自动动作、伪造状态或不完整历史记录误计为人工介入。新 adapter 的主要体积来自 operation/team-plan 两种 persisted shape 的 fail-closed 校验、来源脱敏、引用构造和 immutable replay,而不是第二套 Attention 计算 owner。

具体改动 / Changes

  • ChatActionStore.decide_operation 与 decide_review_card 把人工 actor/provenance 纳入严格 confirmation shape;两个生产 Lark callback 是当前唯一生产调用方,并只在认证完成后写入 marker。marker 本身不授予新的 operation/team-plan 权限。
  • ChatActionService.preview 在 proposal owner 处拒绝 operation.execute 的 context/parameter Goal 不一致;_proposal_goal_id 与 capture 边界再次要求唯一 Goal 且等于输入 scope,旧的矛盾记录不会越 Goal 进入 pack。
  • capture_verified_loopx_human_attention 只读取目标 Goal/window 内的 operation.execute 与 team.plan,要求当前 marker,或完整匹配历史 authenticated-card shape、delivery 与 principal/state binding。它不公开 principal;窗口包含多名 principal 时拒绝整个 capture,避免把不同人员的重叠 waiting union 成单人时间。
  • trajectory-pack-register 新增成对的 --loopx-human-attention-start/end。未提供时沿用原注册路径;提供时生成 digest 命名、create-only 的 receipt JSONL 与 capture,再交给既有 TypeScript prepare/source verification。等待只来自窗口内的 delivery→confirmation,active=null、necessity=unknown、complete=false。
  • 参考文档及中英 RFC 同步声明 partial/legacy/single-human/unknown 边界;测试覆盖真实 CLI、引用脱敏、幂等重放、旧 pack 不变、跨 Goal、多人窗口及 producer 认证路径。

规格依据为 docs/reference/trajectory-assessment.md#human-attention-in-research-optional @ revision 58cc5817e35ea9a0dc4697f7791279c6d80946bc。映射结果:attention-source-bound 由 Goal scope、source digest/citation 和 delivery/authority binding 实现;attention-unknown-not-zero 由 active=null、necessity=unknown、complete=false 实现;attention-single-human 由 multi-principal rejection 实现;attention-separate-unions 继续由既有 TypeScript owner 执行。本 PR 对 RFC 6.4 的更新是已验证 producer 子边界的 checkpoint,不作为独立于实现的规格证明。

对主干的风险 / Risks

我检查的最强回归场景是:普通 operation/team-plan 确认因新增字段而失败,跨 Goal/伪造回执被错误投影,认证发生被误写成“必要”,或者不同人员的重叠等待被合并后低估人工成本。旧 head 的自审确实发现了后三项问题,因此没有发布旧 APPROVE;新 head 分别通过 proposal/capture 双层 Goal 校验、necessity=unknown 和 multi-principal fail-closed 修复,并补了反例。

exact-head 验证结果:6 个直接覆盖新增/修改行为的 Python 用例通过;TypeScript Attention owner 5/5 通过;Ruff、RFC bilingual、Python compile、semantic vocabulary、9 个 catalog canary、8 个 risk-profile smoke 与 public-boundary scan 通过。扩大 Python 套件为 154 passed / 4 failed;4 个失败都是现有 Goal activation metadata upgrade fixture,已在 merge-base 74ca883d5bd3e4bc64671bac54210eac9e97ed05 原样复现,且该 causal path 到当前 main 未变化。standard premerge 没有自动检查失败,只保留仓库对 benchmark_sensitive surface 的显式 maintainer-review hold。

剩余风险是 live Lark 网络边界由 fixture 覆盖、远端 CI 仍在排队,以及本地 dashboard smoke 因 worktree 缺少 vite/client 未重跑;本 PR 没有 UI diff,TypeScript source-bound observer 的 5 个语义用例已在当前 head 通过。回滚可移除 opt-in bridge/producer marker;已生成 artifact 是 source-root 内的内容寻址证据,不会改写历史 pack。上述 CI/manual hold 属于 merge readiness,不被本次 COMMENTED 自审绕过。

我的整体评价 / Verdict

未发现新 head 的阻断性问题。该 PR 是与原问题成比例、可独立交付的增量:它把已有但孤立的 authenticated LoopX receipt 接到投研 Attention,同时保留 Goal/时间窗、权限、脱敏、不可变、single-human 与 unknown-not-zero 边界;也明确没有宣称覆盖全部人工介入或证明可避免成本。

长程效果上,重复注册稳定复用内容摘要,旧 pack 与权限状态不变;用户体验上没有首屏或交互改动,新增能力只在 pack 操作者显式提供成对时间窗时启用,普通注册保持原语义。该变更复用现有 Attention vocabulary,新增的 actor/provenance 与 local receipt schema 被限制在其真实 producer/adapter 边界。残余风险主要是 partial coverage、主动时间未知、live provider 未在本地联调以及远端 CI/maintainer hold,均已公开,不能被解释为零成本或 merge authority。

因此我对 8790@d347f27da4cee12b1c56dd9ffc640d643023758a 的代码结论是 APPROVE;由于这是作者自有 PR,GitHub 不允许正式 self-approval,本评审按仓库契约发布为 COMMENTED,且不授予合并权限。

English verdict: APPROVE - Exact-head review found no blocking defect after Goal, unknown-necessity, and single-human fixes; authenticated receipts remain partial, immutable, redacted, and opt-in, while pending CI and the benchmark-sensitive maintainer hold remain separate merge-readiness gates.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max

评审提交 d347f27da4cee12b1c56dd9ffc640d643023758a,目标主干 58cc5817e35ea9a0dc4697f7791279c6d80946bc。

[P2] 注册拒绝后仍写入人工介入证据文件。 用真实 CLI、真实动作存储和一条合成确认记录复现。两次注册都返回 source_changed,旧索引没有改变;带归集参数的失败调用额外留下一份回执 JSONL 和一份 capture JSON,确实包含该条确认的投影。修复来源字节后,原输入可注册并读到一条事件。 先用既有准备与来源校验拒绝确定无效的输入,再生成或发布最小回执。把尚未成功绑定到评估包的生成物暂存在私有区,或在事务失败时只撤销本次创建且尚未被引用的文件。保持摘要文件的幂等复用。 发生位置

动机 / Motivation

原注册通过 TypeScript 准备数据并校验源文件摘要。确定性校验失败不写评估包、也不生成新的源文件。 从受授权来源登记研究评估包、需要核对已认证卡片决策的操作者。 来源文件在准备输入后发生变化。操作者使用相同输入和已授权来源目录登记评估包,并显式开启人工介入归集。 用真实 CLI、真实动作存储和一条合成确认记录复现。两次注册都返回 source_changed,旧索引没有改变;带归集参数的失败调用额外留下一份回执 JSONL 和一份 capture JSON,确实包含该条确认的投影。修复来源字节后,原输入可注册并读到一条事件。 失败的命令产生了没有评估包引用的记录。操作者需要额外区分这些字节是失败残留还是待用来源,也很难依赖原有失败行为复跑批量登记。 用隔离的真实命令、真实文件与本地动作存储验证。未发送真实卡片,未读取实际个人决策,也没有把片段视作完整人工成本。

改动思路 / Approach

两条 Lark 卡片路径记录经过核验的来源和 actor_class。显式窗口适配器从 ChatActionStore 筛出单一人的决策并去掉 principal;现有 TS 观察器继续决定统计和缺失语义。 限定已认证的操作与团队方案决策。已记录的等待和未知的主动投入分开,不归因到某一 Turn,不追加 UI、权限、原生宿主数据或模型支出。 先用既有准备与来源校验拒绝确定无效的输入,再生成或发布最小回执。把尚未成功绑定到评估包的生成物暂存在私有区,或在事务失败时只撤销本次创建且尚未被引用的文件。保持摘要文件的幂等复用。

具体改动 / Changes

完整差异 16 文件,新增 862 行、删除 11 行。核心是 415 行的可选适配器,其余覆盖存储、CLI、两路卡片入口、测试及三份文档。

关键代码讲解

  • register_pack。组织现有准备、来源校验和包持久化。 新适配器在现有校验之前执行真实来源目录写入。 失败命令可以留下没有包引用的资料,重试不易区分。 源码
  • capture_verified_loopx_human_attention。归集限定来源与时间的卡片证据,并两次按摘要写入。 核验重复 ID 与产物字节,单人之外拒绝,未测量时间保持未知。 真实拒绝复现中两份产物已存在。 源码
  • handle_goal_channel_operation_callback。在已核 Lark 身份和送达绑定后把来源标记保存进操作回执。 不把受保护操作、只读统计和权限来源合并。 同类团队方案另由现有 review-card owner 记录。 源码

验收沿用 原有契约。结果由本地真实入口读回。

  • original-boundary。沿原读写 owner,真实可验证的来源与响应。独立 CLI 正例修复来源字节后返回一条已验证事件;残留摘要名可正确复用。默认路径对同一坏来源无副作用。
  • boundary-negative。注册拒绝后仍写入人工介入证据文件。用真实 CLI、真实动作存储和一条合成确认记录复现。两次注册都返回 source_changed,旧索引没有改变;带归集参数的失败调用额外留下一份回执 JSONL 和一份 capture JSON,确实包含该条确认的投影。修复来源字节后,原输入可注册并读到一条事件。 对真实轨迹包 CLI 并排覆盖坏来源、可重试失败和正确来源。坏来源返回 source_changed,索引与源目录均不变化;恢复文件后得到一条已验证事件,再重跑复用同一组产物。

对主干的风险 / Risks

独立 CLI 正例修复来源字节后返回一条已验证事件;残留摘要名可正确复用。默认路径对同一坏来源无副作用。 不加两个 UTC 参数时仍走原评估包注册路径,坏来源不生成文件。两条认证卡片写入默认增加来源字段,Operation 预览还显式检查 Goal 上下文;这些共享变化不由归集开关关闭。

回归验证:对真实轨迹包 CLI 并排覆盖坏来源、可重试失败和正确来源。坏来源返回 source_changed,索引与源目录均不变化;恢复文件后得到一条已验证事件,再重跑复用同一组产物。 托管 CI 未查询。

我的整体评价 / Verdict

失败的命令产生了没有评估包引用的记录。操作者需要额外区分这些字节是失败残留还是待用来源,也很难依赖原有失败行为复跑批量登记。 最小修复见上。用隔离的真实命令、真实文件与本地动作存储验证。未发送真实卡片,未读取实际个人决策,也没有把片段视作完整人工成本。

English verdict: REQUEST_CHANGES at d347f27da4cee12b1c56dd9ffc640d643023758a. A changed input source makes real registration return source_changed, yet the enabled path has created two unreferenced decision artifacts. Validate or stage before publishing, and preserve deterministic retry.

cocolord and others added 2 commits November 19, 2026 15:48
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
@huangruiteng
huangruiteng force-pushed the codex/attention-loopx-receipts branch from d347f27 to 6c0f8d4 Compare November 19, 2026 07:48
Signed-off-by: huangruiteng <huangrt01@163.com>

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · GPT-5 · OpenAI · self_reported

动机 / Motivation

复审精确 head 8790@b51105196c29afc302e358793e1fe5da8c4be338。投研 pack 操作者注册目标输入时,如果指定成对的 UTC 时间窗,就能把 LoopX 已认证的 operation.execute 与 team.plan 卡片决定纳入 Research attention,而不必手工重录,也不会把“未采集”误读为零。

旧 head 的最强失败场景是:来源在准备后已经变化,CLI 返回 source_changed,但 attention 回执和 capture 已经先写进 source_root,留下没有 pack 引用的文件。新 head 先组合并校验 staged bytes,只有通过后才发布。本地真实 CLI 反向用例证明失败时 source-root 与 runtime 文件逐字节不变;修正来源后,同一命令成功读回一条 approval,并再次证明 replay 复用相同摘要命名产物。

这次范围仍然是有意的 partial capture:只覆盖经过认证的 Lark operation/team-plan 卡片,主动投入、必要性、pending 请求、非认证 Dashboard/私聊动作和 runtime-native approval 都保持 unknown 或 out of scope。

A Research pack operator registers an existing Goal input with an explicit UTC window of authenticated LoopX card decisions.

Before this head, a changed source returned source_changed but could leave a receipt JSONL and capture JSON behind. At this head, validation uses the staged bytes first; failure changes neither source-root nor runtime files, while the corrected input registers the same one-event partial capture.

Valid registration reads back one approval event and reports partial coverage, unknown active attention and unknown necessity; replay reuses the same digest-named artifacts.

This does not collect runtime-native approvals, Dashboard/private-chat actions without authenticated callbacks, pending requests, active attention time or completed-cost claims.

改动思路 / Approach

数据流保持原 owner:ChatActionStore 持久化认证回执,可选 Python adapter 仅在 Goal + UTC 窗口内组合脱敏 source,既有 TypeScript projectTrajectoryHumanAttention 继续拥有去重、区间并集和 unknown 语义。

flowchart LR
  A["Authenticated Lark callback"] --> B["ChatActionStore receipt"]
  B --> C["Compose staged receipt + capture"]
  C --> DExact source hash/excerpt valid?
  D -->|no| E["Return source_changed; publish nothing"]
  D -->|yes| F["Create-only digest artifacts"]
  F --> G["Existing pack registration/readback"]
  G --> H["TypeScript attention projection"]
Loading

上图依据 exact head 源码绘制,是行为说明,不替代执行证据。修复没有引入第二套事务框架:现有 _verify_sources 接受 staged bytes,register_pack 在 pack owner 锁内调用发布函数;摘要文件仍按内容寻址、create-only,并保持幂等复用。

The repair strengthens the existing source verification boundary and keeps provider IO separate from projection policy.

Authenticated operation and team-plan receipts through an explicit single-principal UTC window; runtime-native and private/non-authenticated actions remain outside.

具体改动 / Changes

相对 main,整体为 16 文件、+948/-15。上次 review 的 6c0f8d43da2c 到当前 head 只改三个文件、+96/-14:把 capture 的“组合”和“发布”拆开,允许 source verifier 校验尚未落盘的字节,并在完整注册验证之后发布;新增真实 CLI 快照断言,比较拒绝前后的 source-root 与 runtime 文件。

规格依据为 docs/reference/trajectory-assessment.md#human-attention-in-research-optional @ revision aa720f72866a03a1e9382a9636abf4be1bbef38a。attention-source-bound 由 Goal scope、source digest/citation 和 delivery/authority binding 实现;attention-unknown-not-zero 由 active=null、necessity unknown、complete=false 实现;attention-single-human 由 mixed-principal fail-closed 实现;attention-separate-unions 继续由既有 TypeScript owner 执行。

关键代码讲解

  • register_pack 先调用 prepare_verified_loopx_human_attention 得到 input 和 staged 文本,再通过扩展后的 _verify_sources 校验同一批 hash/excerpt;只有 source_changed/其他验证都通过后,才在 pack 锁内发布。
  • prepare_verified_loopx_human_attention 只读取 ChatActionStore 并返回 bytes,不触碰 source root;principal 和 payload 不进入 projection。
  • publish_verified_loopx_human_attention 只接受单级安全文件名,并复用 _publish 的 atomic create-only IO。相同内容并发/重放幂等,冲突内容 fail closed。
  • 两处 Lark callback 仍只在身份、principal、delivery 和卡片绑定通过后写 actor_class=human 与认证 provenance;marker 不授予新的执行权限。

对主干的风险 / Risks

最强回归是“注册失败产生无引用文件”,已由新真实 CLI 用例闭合;检查同时覆盖没有增加 index/runtime 状态。另一个关键风险是错误地把自动动作或跨 Goal 记录当作人工决定,现有 spoofed-surface、cross-Goal、mixed-principal、legacy-shape 和 citation-redaction 用例继续通过。

验证结果:PASS trajectory assessment store 54/54;PASS attention TypeScript 5/5;PASS Ruff、Python compile、RFC bilingual、diff check 和 semantic vocabulary smoke;PASS standard premerge 的 direct checks、catalog canaries、risk-profile smokes 与 public-boundary scan。预合并仍明确保留仓库的 benchmark_sensitive maintainer-review hold。扩展 Chat/Lark 套件为 100 passed / 4 failed,4 个失败仍是 PR 正文已披露、在基线复现的 Goal activation metadata upgrade fixture,位于本 bridge 因果路径之外。

未查询或等待远端 CI。真实 Lark 网络投递仍由确定性认证 fixture 覆盖;此评审不把 fixture 成功扩大成线上 provider 保证。

我的整体评价 / Verdict

原 source_changed 残留 finding 在当前 head 已被代码顺序和真实 CLI 回归共同解决,未发现新的阻断问题。长程效果上,失败重试不再积累孤儿证据,成功路径和 replay 保持内容摘要稳定;CLI 体验也更可信,因为失败只返回原诊断且没有隐式副作用。设计上继续复用 ChatActionStore、source verifier、pack store 和 TypeScript attention owner,没有引入重复决策权威。视觉表现不适用:本 PR 不改变 Research 首屏,检查对象是 CLI 与 source/readback 语义。

English verdict: APPROVE - Exact head 8790@b51105196c29afc302e358793e1fe5da8c4be338 closes the prior orphan-artifact defect by validating staged bytes before create-only publication; real CLI tests prove rejection has no source/runtime residue, corrected retry succeeds, and replay remains idempotent.

@huangruiteng
huangruiteng dismissed loopx-agent’s stale review November 19, 2026 08:06

Resolved at b511051: attention sources are now composed in memory, checked by _verify_sources using staged bytes, and only then published under the pack lock. The real CLI regression injects a changed source, observes source_changed with byte-identical source-root/runtime snapshots, then proves corrected registration and idempotent replay. Standard premerge passed all automated checks; the benchmark-sensitive maintainer hold remains separate.

@huangruiteng
huangruiteng merged commit 9dbe0f2 into main Nov 19, 2026
37 of 53 checks passed
@huangruiteng
huangruiteng deleted the codex/attention-loopx-receipts branch November 19, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants