Repository navigation
fix(source-read): recover GitHub PR diffs within the existing request budget - #6196
Conversation
…ailure Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…blic-source-github-diff-recovery-20261011 Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…blic-source-github-diff-recovery-20261011 Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; runtime_reported; reasoning_effort=xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机
使用已启用匿名来源工具读取 GitHub PR diff 的调用者。 同一个无 query 的 GitHub PR diff 在全部核验地址传输失败时,旧 reader 直接报错,调用者需另给 canonical 地址。 当前 reader 在原 deadline 和六跳限制内重新核验 canonical 地址并读取完整 diff,保留 requested_url 与 observed_url。 本次不增加浏览器、登录态、私有来源或执行权限,不认证安装态 Chat、模型端到端 SLA 或原话题交付。 历史完整套件失败的自然原因、安装态 Chat/Bot 采用及原话题交付未由本轮源码资格证明。
改动思路
只在既有 IO owner 的最后核验地址传输失败处派生 canonical URL,复用原 redirect loop 的 deadline、DNS、TLS、匿名头和 cleanup。 交付有界匿名 GET 的恢复切片;保留原安装/模型/话题验收,独立可回滚,不新增配置或共享决策 owner。
规范依据是冻结基线 509c38c502d3d0b4eafb01550efcdc4b5b5a1d17 的 public_source_reader.py 匿名 HTTP 合同和已读 #6181 的预算/恢复要求,没有独立规格。逐项核对 Bounded anonymous recovery、Budget and policy、Exact URL scope;本次新增 canonical 恢复本身用独立反例和真实后端验证,不以作者声明或新增测试充当验收来源。
已有 operator on/off、source-only worker、DNS pin/SNI、匿名固定头、响应字节限制及六跳 request loop 足够。Python 放置是既有专门网络 IO adapter,不新增 TS/Python 决策副本、capability、设置或 provider 分发。近邻重构已评估:这里再抽一个只服务一个域名的 retry/helper 会增加维护成本,保留现有完整 request owner 更合适。
具体改动
完整 head 8db16a4cc41ad688234a3da288728d527fe4e820:两文件 +137/-0;生产代码 8 行、测试 129 行,无其他产品源改动。
fetch(loopx/extensions/public_source_reader.py:97)仅在最后一个 DNS 核验地址的OSError/IncompleteRead后,对精确github.com/owner/repo/pull/N.diff且无 query 的路径生成 canonical URL。下一轮继续同一个 deadline、六跳计数、地址重新核验和匿名 request;每次 finally 取消/等待 timer、关闭 response/connection。_PinnedHTTPS(同文件:69)仍连接核验 IP,以原 hostname 验证 TLS/SNI;SSL拒绝先于 transport recovery,HTTP/编码/大小/私有 DNS 拒绝不会转入 fallback。article(同文件:222)仍返回 requested/observed URL、内容 digest、truncation 和静态覆盖范围。原入口read_public_url/_observation/main、image 和 host admission 不变。tests/test_public_source_reader.py增加 canonical 成功、七类不匹配 URL、TLS/policy、两端 mixed DNS、deadline、canonical failure 和六跳反例,原真实 socket、残缺响应、隔离解释器和 off/on 用例全部保留。
本轮独立 62 个用例通过(4.42 秒)。另外在真实 DNS 核验后只注入主地址 transport timeout:基线报错,当前 source 通过真实 pinned HTTPS canonical 后端得到完整 8,319 字符,0.856 秒,未截断;随后直接 canonical 读取的完整文本及 SHA-256 一致。请求仅带原两项匿名固定头;该观测证明受控故障恢复,不证明自然故障频率、安装态模型交付或 SLA。
对主干的风险
未发现当前阻塞。最强风险是把 policy 拒绝伪装成可恢复传输错误,或者重设预算/放行 mixed DNS。当前 exception 次序、同一 request loop 和实际负例保住这些边界;失败 partial bytes 不作为结果,timer join 不影响后续地址。默认 off host inventory 和 admission 源完全未改,包安装、MCP 存在或 canonical URL 可达不激活 provider;现有 62 个用例覆盖 off、可信 worker 与各项策略。
原生 premerge 5 direct、10 selected 必需检查通过,保留 1 项已存在 frontier maintainability advisory。相同命令在不可变 509c… 基线与当前 head 都退出 1,完整 stdout(同一 frontier module debt、零 magnitude regression)逐字相等;原 full-tree semantic、Ruff、独立公开边界检查通过,未修改检查或预算,无 manual hold。历史作者 whole-suite 23 failures 与更早失败仍是失败报告,本轮没有独立重跑整个套件,也不将它们改记为通过。按当前配置未读取/轮询/等待 CI。
已有 frontend/Lark/Chat 入口不新增操作或配置;这是原 provider 的恢复,既有界面/原模型采用和话题回传保持单独未验证。回滚只撤销这 8 行及对应测试,无状态迁移、账户或执行权限变化。
我的整体评价
APPROVE。有用的最小完整 IO 恢复由真实 backend 和当前反例建立,复用原 owner,范围与复杂度相称。交付有界匿名 GET 的恢复切片;保留原安装/模型/话题验收,独立可回滚,不新增配置或共享决策 owner。 只在既有 IO owner 的最后核验地址传输失败处派生 canonical URL,复用原 redirect loop 的 deadline、DNS、TLS、匿名头和 cleanup。 后续安装态/模型/原话题及自然全量失败诊断沿原验收处理;本评审不授予 merge/admin bypass。
English verdict: APPROVE — 8db16a4cc41ad688234a3da288728d527fe4e820. Query-free exact GitHub diff transport failure recovers within the original checked HTTPS deadline/hop boundary; 62 source cases and actual canonical content equality pass. The unchanged architecture advisory and historical full-suite failures remain recorded; installed/model adoption is unverified.
Goal And Delivered Outcome
A query-free GitHub PR
.diffcan fail at every checked address while the same PR's canonical public diff endpoint is reachable. The anonymous reader previously returned an error until the caller supplied that second URL. After transport failure it now derives that canonical URL and uses the existing checked HTTPS path, within the original absolute deadline and six-hop limit.TLS/certificate, HTTP-policy and mixed/private-DNS rejections do not activate recovery. Other source paths and query-bearing URLs keep their existing behavior.
requested_urlandobserved_urlretain source provenance.Related to #6181; targets
main. The author implementation and integration are complete and submitted for review. Full-suite qualification, current-head review, CI, installed adoption and original-topic acceptance remain separate outstanding checks.Author Declaration
public_source_reader.fetchScope And Continuation
The net change remains two files: eight provider lines and 129 regression-test lines. Python remains the existing specialized IO provider; no parallel capability, state store, configuration or frontend control is added. Recovery reuses the existing redirect/request owner.
Current head
8db16a4cc41ad688234a3da288728d527fe4e820integratesmainat509c38c502d3d0b4eafb01550efcdc4b5b5a1d17, including the owner-side replay/bounded-drain test-contract clarification in #6326. Both reader file blobs are unchanged from candidate60096027b094e45d95e3df3d19c14192dda273e5; the net reader patch is unchanged. That upstream clarification does not establish the cause of the historical natural full-run failure.The slice is independently reversible. No installed-host adoption, original Lark-topic acceptance, response-time SLA, review approval or merge readiness is claimed.
Validation
8db16a4cc41ad688234a3da288728d527fe4e820against the integrated base above.--dist loadfile, without excluded nodes.main. The existingnpm run build:chatpath rebuilt them; only those same five nodes were rerun, and all five passed. The initial failures remain recorded.Historical failures are retained, not waived:
8db16a4cc41ad688234a3da288728d527fe4e820over exactmainbase509c38c502d3d0b4eafb01550efcdc4b5b5a1d17, the original unfiltered full run returned direct exit 1 with the result above. A bounded replay selected its 23 actual failing nodes on both exact base and unchanged head, using the same Python 3.14.8 interpreter, two workers,--dist loadfileand unchanged test assertions. Both arms returned direct exit 1 with all 23 failures; all 23 assertion messages match after only source/fixture root-path normalization. The canary replay restores the base snapshot's exact tracked-file inventory, which the real canary requires; its complete base/head reports match with onlyrepository_rootomitted. This finds no candidate-only failure in that bounded pair. It does not establish the historical natural-run root cause, make either whole suite pass, waive CI failures, or qualify installed adoption. Original full logs, JUnit SHA-25665a613acb2ff753b41a56abbf293a763b9df170426e110cf25c655d5ea73a63band direct exit remain preserved.5a0be882c1408d941184eb61cf65125fb03a71d7, the original full run reported 20,645 passes, 22 failures, 327 skips, one teardown error and 517 passing subtests. Its pipeline wrapper returned zero and did not retain a direct pytest exit receipt. Matched base/candidate replays reproduced 20 failures and two passes plus the teardown error; the isolated passes did not explain the original failures.60096027b094e45d95e3df3d19c14192dda273e5overc2044e3d0fda34cda73830db4b071dd88b65d844, the later unfiltered full run returned direct pytest exit 1: 20,804 passes, one failure, 343 skips and 517 passing subtests.test_enabled_shadow_ordinary_retry_recovers_one_prepared_batchcommitted source successors but did not immediately expose them through shadow readback. Entire-file matched replays passed 24/24 on both unchanged candidate and exact base; they do not prove the cause or convert the failed full run to a pass. Original logs, JUnit, exit evidence and paired results remain preserved.Earlier exact native candidates verified original-URL recovery with the admitted anonymous tool; those model/transport observations remain scoped to their tested revisions. No private transcripts, raw tool results, credentials or local paths are published.
Frontend / Visual Evidence
Type of Change / LoopX Area
Boundary Checklist