Skip to content

Commit 9dbe0f2

Browse files
cocolordTRAE CLIhuangruiteng
authored
Capture authenticated LoopX receipts for Research attention (#8790)
* feat(research): capture authenticated LoopX attention receipts Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * fix(research): tighten attention receipt provenance Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> * fix(research): publish attention captures after source validation Signed-off-by: huangruiteng <huangrt01@163.com> --------- Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com> Signed-off-by: huangruiteng <huangrt01@163.com> Co-authored-by: TRAE CLI <traecli@bytedance.com> Co-authored-by: huangruiteng <huangrt01@163.com>
1 parent 39f37bf commit 9dbe0f2

16 files changed

Lines changed: 948 additions & 15 deletions

‎docs/architecture/rfcs/long-horizon-harness-benchmark-research-program-v0.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,14 @@ The [Research human-attention observer](../../reference/trajectory-assessment.md
937937
now reads source-bound human inputs, separate active/wait interval unions and
938938
recorded avoidable-input candidates through the existing pack and citation owner.
939939
Recorder classifications, partial timing and historical sources remain explicit.
940-
Synthetic packaged-reader checks qualify this reading path; live capture coverage,
941-
calibrated necessity and lower attention for equal accepted quality remain unqualified.
940+
Synthetic packaged-reader checks qualify this reading path. The live producer
941+
boundary is now qualified only for authenticated LoopX Lark `operation.execute`
942+
and `team.plan` card decisions, explicitly bound to a Goal pack and UTC window.
943+
It preserves partial coverage, treats delivery-to-confirmation as waiting, leaves
944+
active attention and necessity unknown, rejects multi-principal windows to retain
945+
the single-human contract, and labels conservative pre-marker backfill as legacy.
946+
Unauthenticated, pending/expired and runtime-native approval capture, calibrated
947+
necessity and lower attention for equal accepted quality remain unqualified.
942948

943949
### 6.5 Benchmark integrity and anti-cheating
944950

‎docs/architecture/rfcs/long-horizon-harness-benchmark-research-program-v0.zh-CN.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,12 @@ replan 前 checkpoint、恢复、接收者读回及下一次可观察动作的
729729
[研究页人工注意力 observer](../../reference/trajectory-assessment.md#human-attention-in-research-optional)
730730
现在通过既有 pack 与引用 owner 读取有来源的人工介入、分别取并集的主动/等待时间
731731
及标记可避免的介入候选。记录方分类、部分时间覆盖和历史来源保持明确。
732-
合成打包阅读检查只验收此读取路径;真实采集覆盖、必要性校准及同等验收质量下的
733-
注意力降低仍未验收。
732+
合成打包阅读检查验收此读取路径。真实 producer 当前仅验收经过认证、由目标 Goal
733+
pack 与 UTC 时间窗显式绑定的 LoopX Lark `operation.execute` 与 `team.plan` 卡片决定。
734+
该边界保留部分覆盖,把投递到确认记为等待,主动投入和必要性保持未知;为保留单人
735+
记录契约,它拒绝包含多个 principal 的窗口,并将 marker 引入前的保守回填标为 legacy。
736+
未认证、pending/expired、runtime-native approval 的采集,必要性校准及同等验收质量下
737+
的注意力降低仍未验收。
734738

735739
### 6.5 Benchmark integrity 与反作弊
736740

‎docs/reference/trajectory-assessment.md‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,40 @@ and full JSON text; set `human_attention_source_id` to that source's ID. Registe
769769
through the existing `benchmark trajectory-pack-register` command. No new
770770
permission, capability activation, scheduler or UI form is required.
771771

772+
For existing LoopX receipts, pass both `--loopx-human-attention-start` and
773+
`--loopx-human-attention-end` as UTC `Z` timestamps to that registration command.
774+
This explicit bridge reads only authenticated Lark card decisions for
775+
`operation.execute` and `team.plan` in the input Goal, writes immutable
776+
digest-named receipt/capture artifacts inside the already authorized
777+
`--source-root`, and binds the copied registration input to them. Because Chat
778+
action receipts do not identify a benchmark case, run or revision, the target
779+
pack plus explicit window provides that binding; the original input and earlier
780+
packs remain unchanged. New receipts require `actor_class: human` and
781+
`verification_kind: lark_authenticated_card_callback_v1`. Pre-marker receipts
782+
are backfilled only when their complete historical authenticated-card shape and
783+
delivery/authority bindings match, and their evidence is labelled
784+
`legacy_lark_authenticated_card_callback_v0`.
785+
786+
The generated capture is always partial: card delivery to confirmation supplies
787+
response waiting, while active attention and necessity remain unknown. Because
788+
the format is single-human, the bridge rejects a selected window containing
789+
decisions from more than one principal without publishing those principals.
790+
Dashboard/private-chat actions without an authenticated callback, pending or
791+
expired requests, and runtime-native DSH/Codex approvals are excluded. The
792+
bridge does not infer human action from a user role, text, pending state or
793+
automatic gate outcome.
794+
795+
既有 LoopX 回执可在注册时同时传入 UTC `Z` 格式的
796+
`--loopx-human-attention-start` 与 `--loopx-human-attention-end`。该桥接仅投影
797+
目标 Goal 内经过认证的 Lark operation/team-plan 卡片决定,并在已授权
798+
`--source-root` 中生成不可变的摘要命名证据;目标 pack 与显式时间窗负责绑定
799+
case/run/revision,原输入和旧 pack 不会被改写。新回执必须显式声明人工 actor;旧回执
800+
仅在历史认证卡片字段、投递和权限绑定完整匹配时保守回填,并标注 legacy。生成记录
801+
始终是部分覆盖:只观测等待时间,主动投入和必要性保持未知;该格式只记录单一人员,
802+
窗口中出现多个 principal 时桥接拒绝生成 capture,且不会公开 principal。未认证动作、
803+
pending/expired 请求以及 DSH/Codex runtime-native approval 均不纳入,也不会从 user
804+
role、文本或 gate 状态推断人工介入。
805+
772806
```json
773807
{
774808
"schema_version": "trajectory_human_attention_v1",

‎examples/operation_action_fixtures.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
import json
1313
from pathlib import Path
1414

15-
from loopx.chat_action_store import ChatActionStore
15+
from loopx.chat_action_store import (
16+
AUTHENTICATED_LARK_CARD_CALLBACK,
17+
HUMAN_ACTOR_CLASS,
18+
ChatActionStore,
19+
)
1620
from loopx.chat_actions import ChatActionService
1721

1822
GOAL_ID = "goal-operation-fixture"
@@ -184,6 +188,8 @@ def confirmation(
184188
"confirmation_digest": str(operation["confirmation_digest"]),
185189
"card_digest": str(delivered["card_digest"]),
186190
"confirmed_at": datetime.now(timezone.utc).isoformat(),
191+
"actor_class": HUMAN_ACTOR_CLASS,
192+
"verification_kind": AUTHENTICATED_LARK_CARD_CALLBACK,
187193
}
188194

189195

‎loopx/capabilities/benchmark_toolkit/trajectory_assessment_store.py‎

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,27 @@ def _prepared(record: dict, output_language: str | None = None) -> dict:
7272
)
7373

7474

75-
def _verify_sources(record: dict) -> None:
75+
def _verify_sources(
76+
record: dict,
77+
*,
78+
staged_sources: dict[str, bytes] | None = None,
79+
) -> None:
7680
# One byte observation per declared artifact in this verification only.
7781
# Check every digest/excerpt; later calls still read and verify fresh bytes.
82+
staged_sources = staged_sources or {}
7883
artifacts: dict[str, list[dict]] = {}
7984
for source in record["input"]["sources"]:
8085
artifacts.setdefault(source["artifact"], []).append(source)
8186
for artifact, sources in artifacts.items():
82-
path = _source_path(Path(record["source_root"]), artifact)
83-
data = path.read_bytes()
87+
if artifact in staged_sources:
88+
relative = PurePosixPath(artifact)
89+
if relative.is_absolute() or ".." in relative.parts or "\\" in artifact:
90+
raise PackUnavailable("invalid_source_path")
91+
Path(record["source_root"]).resolve(strict=True)
92+
data = staged_sources[artifact]
93+
else:
94+
path = _source_path(Path(record["source_root"]), artifact)
95+
data = path.read_bytes()
8496
digest = hashlib.sha256(data).hexdigest()
8597
lines = None
8698
for source in sources:
@@ -391,17 +403,38 @@ def register_pack(
391403
include_tool_context: bool = False,
392404
loopx_input_json: str | None = None,
393405
native_outcomes_json: str | None = None,
406+
loopx_human_attention_start: str | None = None,
407+
loopx_human_attention_end: str | None = None,
394408
base_pack_id: str | None = None,
395409
case_study_json: Path | None = None,
396410
select_default: bool = True,
397411
) -> dict:
398412
"""Trusted operator only; no HTTP/renderer path-registration endpoint."""
399413
if not title.strip():
400414
raise ValueError("A case/window title is required")
415+
input_value = json.loads(input_path.read_text(encoding="utf-8"))
416+
if (loopx_human_attention_start is None) != (loopx_human_attention_end is None):
417+
raise ValueError(
418+
"LoopX human attention start and end must be supplied together"
419+
)
420+
if loopx_human_attention_start is not None:
421+
from .trajectory_human_attention_capture import (
422+
prepare_verified_loopx_human_attention,
423+
)
424+
425+
input_value, staged_attention = prepare_verified_loopx_human_attention(
426+
runtime_root=runtime_root,
427+
input_value=input_value,
428+
source_root=source_root,
429+
start=loopx_human_attention_start,
430+
end=loopx_human_attention_end,
431+
)
432+
else:
433+
staged_attention = {}
401434
prepared = effect_runtime_result(
402435
"benchmark.trajectory.prepare",
403436
{
404-
"input": json.loads(input_path.read_text(encoding="utf-8")),
437+
"input": input_value,
405438
"config": config or DEFAULT_CONFIG,
406439
"generation_defaults": not config,
407440
**({"case_study": json.loads(case_study_json.read_text(encoding="utf-8"))}
@@ -417,7 +450,13 @@ def register_pack(
417450
for k in ("input", "config", "analysis_key", "method_version")
418451
},
419452
}
420-
_verify_sources(record)
453+
_verify_sources(
454+
record,
455+
staged_sources={
456+
artifact: text.encode("utf-8")
457+
for artifact, text in staged_attention.items()
458+
},
459+
)
421460
if "human_attention" in prepared:
422461
record["human_attention"] = prepared["human_attention"]
423462
if "case_study" in prepared:
@@ -463,6 +502,15 @@ def register_pack(
463502
(owner / "packs").mkdir(parents=True, exist_ok=True, mode=0o700)
464503
pack_id = _pack_id(owner_goal_id, record)
465504
with exclusive_file_lock(owner / "packs.lock"):
505+
if staged_attention:
506+
from .trajectory_human_attention_capture import (
507+
publish_verified_loopx_human_attention,
508+
)
509+
510+
publish_verified_loopx_human_attention(
511+
source_root=source_root,
512+
artifacts=staged_attention,
513+
)
466514
index = _index(owner)
467515
path = owner / "packs" / f"{pack_id}.json"
468516
if path.exists():

0 commit comments

Comments
 (0)