Skip to content

fix(benchmark): authenticate best-only result fetches - #7770

Merged
loopx-agent merged 3 commits into
loopx-project:mainfrom
songoow:codex/edgebench-best-only-result-token
Nov 1, 2026
Merged

loopx-agent merged 3 commits into
loopx-project:mainfrom
songoow:codex/edgebench-best-only-result-token

Conversation

@songoow

@songoow songoow commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The native SForge result endpoint requires the registered run's token.
BestOnlyFeedback already binds that token, but omitted it when fetching a
selected improvement's official result. Valid improvements therefore received
HTTP 401 and could not be published.

Changes

  • Pass the already-bound run token to the selected result GET.
  • Assert the request token while keeping credentials out of disclosed packets
    and host delivery records.
  • Exercise the actual native registration, result, history and admission routes
    with synthetic completed reports and a synthetic worker file transport.
  • Normalize the TestClient response to requests.Response and assert
    requests.HTTPError, matching the production session contract across both
    httpx and httpx2 TestClient backends.

The HTTP regression retains all three authorization cases: successful delivery
for the registered run, HTTP 404 for another run and HTTP 401 for an invalid
token. It also verifies unchanged incumbent/delivery state on rejection,
credential-free output, repeated-poll silence and unchanged native opportunity
state. Native ranking, admission, grading, feedback selection and the default
feedback mode retain their existing owners.

Validation

Tested head: 983a20613a1de71ab04e6acf724c3b0416a25ecf.
Python 3.12.13; native provider:
e278cda3f4d2da3cf06aabf2df4daa99b9749501.

With FastAPI 0.162.0, Starlette 1.7.0, httpx 0.28.1 and httpx2 2.16.0
(the actual TestClient response is httpx2.Response):

LOOPX_USAGE_PING=0 python -m pytest -q \
  benchmark/tests/test_edgebench_feedback.py \
  benchmark/tests/test_edgebench_feedback_http.py \
  benchmark/tests/test_edgebench_online.py \
  benchmark/tests/test_edgebench_feedback_hook.py

123 passed, no skips. This selection covers the publisher, native HTTP
authorization, online admission and the feedback delivery consumer.
The same three HTTP authorization cases also passed with FastAPI 0.115.12,
Starlette 0.46.2 and httpx 0.28.1.

The previous HTTP test was independently reproduced against the current
production code under the newer backend: 1 passed / 2 failed, with the two
rejections raising httpx2.HTTPStatusError outside the old
httpx.HTTPStatusError assertion.

Changed-file Ruff and compilation, the RFC bilingual diff check,
git diff --check and the public boundary scan passed. The scan's only two
warnings concerned the absent local registry. All PR-only commits have valid
DCO trailers, and GitHub's Sign-off check passed for this head. The final DCO
repair changes commit metadata only and preserves the tested tree and parent.

GitHub required checks are separate from these focused results. The previous
head's chat-bundle-browser (1) failure was a timeout in the delegation-search
browser smoke; that failure is not counted as a pass.

Qualification boundary

The HTTP regression uses real native authorization and result serialization
with synthetic completed reports and synthetic worker file transport. It starts
no Docker workload, model or real grading job and makes no claim about solver
uptake or score improvement. Existing Docker/network qualification,
benchmark-sensitive maintainer review and required CI gates remain separate.

Signed-off-by: song <liusongstep@gmail.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T01:59:34.103357Z 348e5bf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Signed-off-by: song <liusongstep@gmail.com>

songoow commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator Author

Integrated main at 2f2c4efadf0c3ac21c51f7fc09f4985c8447642e with a signed merge that preserves the existing PR history. Current head: c9e22190653c151a8fa2b2d0ac520c0ae8a2ebda; tested tree: 6f8735b137dfc8893c15c8591ec454f3b2f7cdd2.

The post-merge publication suite passed 20 tests, and the actual native HTTP feedback path passed 3 tests. This includes the current result-publication contract introduced on main.

The merge was conflict-free. The changed production/test blobs from the prior PR head remain identical; where needed, the documentation merge was inspected separately. RFC bilingual and diff hygiene checks passed. The API-published tree matches the locally tested tree.

Earlier browser CI failures remain recorded as failures; these focused checks do not turn them into passes or establish a new CI result. Required checks and independent review must qualify this new head. No merge was performed.

@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

REQUEST_CHANGES — 完整 head c9e22190653c151a8fa2b2d0ac520c0ae8a2ebda。生产 token 修复有效;新增 HTTP 回归测试在当前依赖组合下有两项失败,需要修正异常类型兼容。

动机 / Motivation

通过 best-only 接收官方评测改进结果的隔离 worker 和其 runner 会遇到这个问题。 runner 已绑定 run token,但旧结果 GET 没有带上它,因此合法改进也收到 401,无法发布完整结果与对应源快照。 当前代码让合法 run 取得结果,同时保留其他 run 的 404 和无效 token 的 401;新增测试却在这两个拒绝分支捕获了错误的异常类型。 本 PR 不改变评分、排序、提交机会、默认反馈模式或实验执行权限,也不认证 Docker、真实模型或科研收益。

这个改进不需要用户重新提交候选、复制 token 或增加授权轮次;runner 已持有正确注册信息,应在原请求中复用。保留失败后的 incumbent、重试资格和凭据隔离同样重要,不能只检查 200。当前代码路径的独立反例成立,但新增测试未能完成拒绝分支后的状态断言,因此验证交付仍有缺口。

改动思路 / Approach

修改位于既有 Python provider IO:_official_result 用现有 bound token 请求已经获准的 submission。原生服务继续按 token 的 run/task 查询结果,sampler 继续限定可发布的 submission 与 source digest。结果取回后仍核对 task、submission、score、pass rate、epoch 和 evaluator,再发布完整官方 body;错误响应不会推进 incumbent。没有新增注册、权限模型或第二份评分规则。

保留 BestOnlyFeedback、原生 result owner 和现有 source/admission 校验,是一行修复的正确范围。 当前 PR 的边界是修复已绑定 run 的结果读取,并为它提供可重复执行的真实 HTTP 授权回归。测试用 TestClient 连接真实 FastAPI route,但它的 response 异常必须与实际 client backend 一致;把 httpx 安装成功当作 TestClient 使用它的证据,会让正确拒绝变成测试失败。无需因此重写 transport 或迁移 TS,只需修复这个真实测试接缝。

独立同源 base/head 复验保留原生 registration、result、history、admission 与序列化;仅以合成 completed grades 和 worker 文件 transport 代替容器/作业。适配实际 TestClient 异常后:合法 run 由 base 的 401 变为本头 200 并发布一次;其他 run 本头 404,无效 token 本头 401;重复轮询静默,注册/提交机会不变。这个辅助复验用于定位,不能替代提交到 PR 的测试。

具体改动 / Changes

全量差异是 3 个文件,+113/-2:生产请求增加 token 参数,已有单元测试核对参数与公开 packet 无凭据,再新增 109 行原生 HTTP 回归。修复沿用已有字段和鉴权 owner,没有新的 API、持久状态、默认值、prompt 或自动执行入口。普通 native/blind 模式不经过这一 publisher,best-only 的排序与 source/evaluator 绑定代码未改。

先于 diff 阅读的规范为 benchmark/edgebench/README.md,spec_revision=2f2c4efadf0c3ac21c51f7fc09f4985c8447642e。按其原有段落映射:selected official result and admitted source identity → 当前绑定 token 的 GET、原生 run/task owner 和既有字段检查成立;unavailable or mismatched response preserves the incumbent for retry → 生产拒绝路径成立,新增测试的拒绝分支仍需修复;strict improvements only and credential-free disclosure → source/结果完整传递、静默 baseline/重复轮询及公开 packet 去凭据由 focused tests 和原生复验覆盖;native scoring and submission opportunity retain authority → 本头没有修改相应 owner,原生 token/机会读回保持不变。

  1. BestOnlyFeedback.bind 原先已绑定 token,并拒绝改绑;本修复复用已有注册,不建立新凭据来源。
  2. BestOnlyFeedback._official_result 的结果 GET 现在传 params={"token": self.token}。服务端决定是否属于该 run;成功后原有 result 与 evaluator 校验继续执行,不能用 token 替代这些约束。
  3. BestOnlyFeedback.update 仍先选 sampler-admitted 的严格改进、核对原 archive,然后取回官方结果,发布后才推进 score/incumbent。结果读取失败时不会发布新的 worker 文件。
  4. test_native_result_authorization_controls_improvement_delivery 在真实原生服务上注册两个 run、注入合成已完成结果,方向正确;第 11 行导入与第 88 行捕获却假设 TestClient 总使用 httpx,导致下述可重现失败。

对主干的风险 / Risks

[P2] 捕获 TestClient 实际使用的异常类型。 在依赖约束允许的 FastAPI 0.162.0、Starlette 1.7.0、httpx 0.28.1、httpx2 2.16.0 下,Starlette TestClient 实际使用 httpx2。当前测试从 httpx 导入 HTTPStatusError,两个类不是同一类型。原样执行新增文件得到 1 passed / 2 failed:other-run 正确返回 404、invalid 正确返回 401,但 pytest.raises(HTTPStatusError) 没有捕获 httpx2.HTTPStatusError。因而文件、incumbent 和 opportunity 的后续断言都未运行。importorskip("httpx") 不能保证 client 的实际 backend。

最小修复是让 fixture 的异常契约与实际 response backend 一致,或把适配层转换为生产 requests 的 response/error 契约;保留 200、404、401 和无状态推进断言,在当前允许的 client 组合重跑。无需改动服务端鉴权。仅在私有独立探针改用 TestClient 的实际异常类后,本头 3 项全通过,而相同 base 仍不能完成合法读取;这证明一行生产修复有效,也证明原测试失败不能归为服务端拒绝错误。

其他验证:已有 feedback/hook/online 组合 75 passed / 40 skipped / 5 failed;5 项都因缺少可选 Harbor,base 用相同选择也重现这些错误,未计为通过。3 个改动文件 Ruff、配置 mypy 17 个源、premerge 的 5 直接和 6 catalog 检查通过;benchmark-sensitive 的 manual merge hold 保留。原生服务源码固定为 SForge e278cda3f4d2da3cf06aabf2df4daa99b9749501;默认 source compatibility patch 另遇既有 preimage 不匹配,保留该环境限制,改用显式、未打补丁的同一 integration source 做本次 bounded HTTP 检验,没有启动作业、容器或模型。

语义与 CI 对齐

此修复只补齐既有 run 身份,不扩大权限;其他 run 仍由原生 result owner 隔离。token 和 admin secret 不进入 worker packet 或 host delivered.jsonl,循环错误仅记录异常类,未因新增 query 参数输出完整 URL。特征关闭与其他反馈模式不创建本 publisher,也不添加配置、用户义务、提交机会或评估。它是强制授权请求,不是建议文本。按当前 wait_for_ci=false 未读取或等待 GitHub CI;本地新增测试失败独立构成变更请求。

我的整体评价 / Verdict

生产改动小、必要,复用现有专用 provider 和 native authority,未发现评分或权限语义偏移。局部同域简化已足够;进一步新建 transport 框架、通用 capability 或迁移第二个 owner 均无当前理由。原始请求到有效反馈的路径无需新增用户轮次。长程价值限于避免合法改进被 401 阻断,尚未测模型采用、完整成本或实验效果;仓库 experience 建议落实为原生 registration→result→反馈/重试的真实路径验证,不把单元数量视为成果。

problem_context=not_yet_proven 指的是这份完整提案仍缺少可重复通过的新增 HTTP 回归,最小剩余工作就是修复异常兼容并提交新 head;不是要求扩展到 Docker 或新的实验。视觉检查不适用:完整差异仅在 benchmark Python 请求与测试,没有页面、布局、首屏或产品文案变化。未验证范围:真实 Docker worker 文件权限/网络、安装 Host、模型/评分任务及全仓 CI;HTTP 授权检查使用真实原生后端,已完成 grade 和 worker transport 为明确的合成边界。

English verdict: REQUEST_CHANGES — exact head c9e2219. The token fix works against the native result owner, but the new negative HTTP tests fail with current supported dependencies because TestClient raises httpx2.HTTPStatusError while the test catches httpx.HTTPStatusError. Repair that test contract and rerun the three authorization cases; retain the correct server-side 401/404 behavior.

@mergify

mergify Bot commented Nov 1, 2026

Copy link
Copy Markdown

Hi @songoow, the DCO Sign-off check did not pass. Please inspect
its details first: checkout, fetch, timeout or infrastructure errors
need their own recovery, not a rewrite of otherwise signed commits.

If the log confirms a missing Signed-off-by trailer, amend the
affected commit with git commit --amend -s; for multiple commits,
use an interactive rebase against the current base from the correct
base-repository remote and sign off each affected commit. Push the
rewritten PR branch with git push --force-with-lease origin HEAD.

@songoow
songoow force-pushed the codex/edgebench-best-only-result-token branch from b291fbc to 983a206 Compare November 1, 2026 07:41

@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; model=gpt-6.1-sol; provider=OpenAI; runtime_reported; reasoning_effort=max

动机 / Motivation

显式选择 best-only 反馈模式、等待已完成评测结果的任务运行者。

已有严格更优的正式结果时,旧代码读取受保护结果接口却没有携带已绑定凭据,因而收到 401,工作者一直看不到改进;本提交使用同一原生注册 token 完成读取,并继续拒绝无效或其他运行的凭据。

真实原生 HTTP 路由中的合法结果可交付;401、跨运行 404、身份不匹配及无新增改进时不交付,随后合法结果仍能继续交付。

本 PR 不修改计分、评测次数或默认反馈模式;合成 HTTP 与工作者传输验证不证明真实 Docker 部署、模型采纳或长期得分收益。

改动思路 / Approach

运行入口只有在显式 best-only 模式下创建发布器,原生注册经 RecordingDockerBackend 绑定一次凭据。采样器先决定哪个已完成快照有资格进入反馈,发布器再读取正式完整报告、核对身份与对应源码,最后沿既有通道交给工作者。此次修复只为已有 GET 添加 token query 参数,保持 requests 超时、raise_for_status、身份验证与失败所有者。换成新认证层、放宽原生接口或从工作者环境取凭据,都会扩大这个修复所需的边界。

复用已有注册凭据和结果身份检查,只修复 provider IO;评测策略、采样准入与工作者投递继续由原 owner 负责。

当前边界是已准入更优结果的授权读取、完整投递和失败后继续投递,不增加评测或运行权限。

具体改动 / Changes

审查完整 head 983a20613a1de71ab04e6acf724c3b0416a25ecf,基于不可变 merge base 2f2c4efadf0c3ac21c51f7fc09f4985c8447642e。先读取该基线的既有规范,再检查全部生产、测试和文档改动;当前作者修改后的说明不充当独立验收依据。此前 REQUEST_CHANGES 的完整 review 与测试异常反例均重新核验,没有沿用旧结论。

规范映射:strict improvement → implemented:Only an admitted strict improvement publishes full official feedback and matching source.(123 focused tests + independent native HTTP scope probe);run/task → implemented:Result identity and authorization remain bound to the original native run/task.(native 401/404 + rebind/mismatched history counterfactuals);native → implemented:Native feedback remains the default; best-only is explicitly selected.(32 paired base/head mode and prompt tests)。

关键代码讲解

  1. BestOnlyFeedback.bind:绑定由生产后端的 host registration callback 或既有容器注册路径触发,缺失或再次换绑会被拒绝;新增读取直接复用这个 host 凭据,没有引入第二个凭据来源。

  2. BestOnlyFeedback.update:该入口仍先筛选严格改进,再验证原生结果与归档源码。基线、平局、退步、失败或身份不符不会变成 worker 反馈;成功与失败都没有新评测授权。

  3. BestOnlyFeedback._official_result:关键差异是 GET 携带 params={"token": self.token},超时仍为 (3,5),随后调用 raise_for_status。原生服务决定 token 的运行/任务归属;合法完整响应才返回给 update,拒绝沿原有异常监督路径处理。

对主干的风险 / Risks

最强反例是:合法访问恢复后,错误运行的 token 也能读报告,或者取反馈顺便触发额外评测。我在未修改的原生 SForge 1.1.0 服务路由上验证合法结果、无效 token 的 401、其他运行 token 的 404,并核对 worker 文件和通知均不含 token。独立探针进一步在一次成功后尝试换绑 token、篡改 history.run_id;均被拒绝且工作者状态不变。只移除 GET 凭据会得到 401 且无通知,恢复正确凭据后可交付,再新增同一运行的已完成更优结果仍可继续交付。发布器自身没有消耗新增评测机会。

PASS:四个反馈、HTTP、online 和 hook 模块共 123 项;额外来源范围及后续交付探针 3 项。标准 premerge 的 5 个直接检查和 6 个选中检查全部通过,仍保留 benchmark_sensitive 的人工合并门。Ruff、diff、编译和双语 RFC diff 检查通过;语义 advisory 没有发现其支持形式中的新增候选,这不等于不存在任何语义。

基线反证采用相同 HTTP 测试与依赖:旧代码 2 失败、1 通过,当前 3 通过。此前 review 的 httpx2 异常类型问题也独立复现为旧测试 2 失败、1 通过;当前测试把 TestClient 响应转换为生产使用的 requests.Response,两个负例在 FastAPI 0.162.0、Starlette 1.7.0、httpx2 2.16.0 下通过。没有把历史失败重新描述成未发生。

默认关闭边界另以原有 runtime/prompt 测试做基线与 head 成对验证:native、blind 和显式 best-only 的工作者提示、凭据过滤、网络隔离、注册与安装行为各 32 项通过。首次运行两边各有 15 项因 Harbor/LiteLLM 导入时在线成本元数据读取遇到缺少 socksio 而失败,另外 17 项通过;使用该依赖提供的本地元数据模式后,同一断言集全部通过。这里没有删除断言、改变生产逻辑或将失败归咎于当前 GET 修复。真实 Docker 启动、兼容补丁应用和模型采纳未在本轮执行。

语义与 CI 对齐

认证参数属于现有原生 provider 的外部输入,未创建共享状态词汇;沿用既有严格改进、结果来源和 token 范围约束。本轮只使用仓库原生本地验证,没有获取、轮询或等待远端 CI;未从已有 CI 提示推断通过、失败原因或合并权限。

我的整体评价 / Verdict

对这个授权读取缺陷,交付判断为 goal_achieved:完整三文件 scope 已复核,此前阻塞项已由相同依赖条件下的反证消除,未发现新的可操作阻塞。长期工作能力与用户体验均为 improved,限于已验证的反馈恢复和后续交付:不据此声称长期得分增长、实际模型采纳或整项研究验收。生产改动为一个认证参数,新增 HTTP 回归覆盖真实服务边界;保留测试响应桥接比新增客户端抽象更直接。现有本机/容器注册兼容分支没有被改动,独立 provider 的升级边界仍需保留。

合法结果在拒绝后可恢复交付,并能继续交付下一项改进;不增加评测次数。 已有授权与任务身份可直接复用,不增加确认、导航或重复输入;失败与取消后的读回可核验。

已检查 benchmark/edgebench/feedback.py、run.py 及 worker 传输调用:没有渲染界面或布局修改,变化为现有反馈报告的授权读取。

benchmark 人工检查门仍保留。本次没有修改作者代码、合并或撤销旧 review;发布本结论不授予合并、付费执行、安装或 Goal 完成权限。若 head、来源边界或相关依赖改变,需要复核该新提交。

English verdict: APPROVE for exact head 983a20613a1de71ab04e6acf724c3b0416a25ecf; no blocking finding in the reviewed scope. Native Docker/model adoption and the benchmark merge hold remain separate.

@loopx-agent
loopx-agent merged commit 0d3717c into loopx-project:main Nov 1, 2026
25 of 35 checks passed
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.

2 participants