Repository navigation
Defer PR wait provider loading until permission is checked - #8821
Conversation
Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]>
cocolord
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; GPT-6; OpenAI; self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
现有 native Turn 和 heartbeat 在组合 PR 等待观察时会经过这条路径,包括没有外部观察权限的任务。
旧路径在读取权限前导入 PR provider,provider 缺失会中断本来无须使用它的任务;新路径在两次权限检查成功后才加载 provider,并保留原失败结果。
已验证的局部结果是未授权、撤销和权限源不可用时不加载 PR provider;获权后的成功、未知效果和独立 Todo 回读保留现有语义。
本 PR 不完成完整 D2/D5 闭包、真实模型或上下文采用、完整成本改善、原十项验收、C1 默认切换或 split-package 发布。
完整 R1、实际模型恢复与上下文连续性、完整成本和原目标回归仍待原有 owner 验证。
这个问题影响普通执行入口的可用性:用户没有选择 PR 观察,仍可能因为该 provider 的导入失败而无法继续自己的任务。此次改动将可选代码的加载放回实际使用边界,无须用户增加配置、重复表达目标或确认。所确认的价值是隔离这条无关依赖;真实冷加载收益和长期任务收益仍需独立测量。
改动思路 / Approach
现有 scoped capability resolver 持有权限,reconciler 持有 GitHub 观察,typed dispatcher 持有结果校验;把导入放在既有获权 provider try 内即可隔离可选代码,无需新增 owner 或 wrapper。
本次边界仅是 executing Turn 的可选 PR provider 加载及故障隔离;权限、cadence、原完整来源、capture、admission 和 settlement 都保留既有 owner。
既有 extend_turn_start_dispatch 会收集 capability 的观察注册,typed dispatcher 校验注册和结果。turn_start_hook 先读取当前 Goal/Agent 的权限,producer 调用时再读一次,避免注册后的撤销失效。只有第二次检查成功,才导入原 reconciler,并继续原 PR facts、cadence 和完整 canonical Todo 来源流程。注册校验、必要的工作义务及结果结算继续由现有控制面持有。
不改动会保留每次冷组合对可选代码的依赖。只在注册后导入仍跨过调用时撤销边界;增加缓存、skip flag 或第二个 dispatcher 会扩大状态和维护面。移动现有 import 到现有 provider try 内是足以修复这条路径的最小改动。原 Python 模块继续承担专门的 GitHub provider/transport,未新增 Python 决策 owner。
下表是固定 head 76502e5d18b46958a70a8cfed2218ddf3c0e2f3d 的源码分支说明,不能替代执行证据。
| 场景 | provider 加载/调用 | 既有结果 |
|---|---|---|
| 注册时无权限 | 不加载、不调用 | 无 registration |
| 注册后撤销 | 不加载、不调用 | not_applicable |
| 权限来源不可用 | 不加载、不调用 | capability_source_unavailable,已知零读取/效果 |
| 调用获权、provider 成功 | 延迟加载并调用原 owner | empty / observed / partial |
| 调用获权、导入或响应失败 | 进入原 provider 失败边界 | failed,未知读取/状态效果保留 null |
具体改动 / Changes
评审基准为修改前已接受的 small-kernel RFC,spec_revision 为 2b156284c4f44995797251dcc80b659ab1d673ac,重点对照其第 5、9、11 节。此次增加的 checkpoint 是交付记录,不是重新定义验收。最终 head 为 76502e5d18b46958a70a8cfed2218ddf3c0e2f3d:5 个路径,+136/-10;生产改动只有 import 的位置变化,另外两处已有测试将 fault injection 从 hook 内部 alias 迁到真正的 reconciler owner,原断言保持。两份 RFC 同时说明局部增量与计时边界。
关键代码讲解
_availability,第 42 行:先成功读取 scoped capability state,再显式交给原 resolver。Todo requirement、模块存在或 inherited hint 不能自行替代 provider IO 的权限来源。这条逻辑没有变化,负例验证权限来源不可用时没有读取或写入。turn_start_hook,第 56 行:注册检查和 producer 内的 invocation 检查都保留。第 94 行才导入 provider,随后调用原 reconciler。导入失败进入原except Exception,保留dependency_observation_failed以及未知效果;typed dispatcher 能识别该结果并维持原刷新语义。_bounded_readback,第 21 行:继续在完整来源规划和效果完成后裁剪诊断展示。它不决定 PR target、工作选择或 cadence。已有大来源、响应丢失和 concurrent caller 用例检查这条边界,不能用 bounded view 的缺项推断 canonical source 不存在。
| RFC criterion_id | 本 head 的结论 |
|---|---|
| I1 | implemented:单一仓库、PR 和 CI 提案边界。 |
| I2 | implemented:权限、PR facts、typed result、canonical Todo/effect 继续复用原 owner。 |
| I3 | implemented:公开 hook contract 保留;非公开测试 alias 的调用方迁到原 owner。 |
| I4 | implemented:未授权或不可用的可选 provider 与核心执行隔离,无替代实现。 |
| I5 | out_of_scope:不改 Node 安装、缺失诊断或其资格。 |
| I6 | implemented:无新 schema、license 或公开/私有边界变化。 |
| I7 | implemented:未选 provider 不在权限检查前加载;无不受治理的执行 fallback。 |
| I8 | implemented:本局部路径保留原完整来源、要求、诊断与 replay;未据此完成整体 context 验收。 |
| I9 | implemented:记录准确 composition、冻结时钟和真实计时未资格化的范围。 |
| V1 | deferred:完整 presets 的 import/process/network 闭包仍待验证。 |
| V2 | deferred:完整 Minimal/Standard transition corpus 仍待验证。 |
| V3 | deferred:所有 supported commands、平台和 missing provider/runtime 仍待验证。 |
| V4 | deferred:真实模型任务的中断、重启和独立成果回读仍待验证。 |
| V5 | deferred:完整 initial/revised/compacted/lost-ACK host 场景仍待验证。 |
| V10 | deferred:重复配对的完整成本仍待验证。 |
| R1 | deferred:本 PR 的可选加载切片不完成 executable minimal 的所有退出项。 |
| M3 | deferred:split-package 发布与独立 clean-install journey 未交付。 |
对主干的风险 / Risks
最强反例是 warm 或预先导入的测试可以通过,冷进程仍可能在权限检查之前失败。此次 fresh-process negatives 在不可变 BASE 上保留 eager-import 失败,在最终 head 上通过;Root 也分别执行权限/CLI 9 个场景和 facade 1 个场景。八组 hook JSON 的完整内容相等,但脚本预先导入 provider,并冻结 monotonic_ns,所以它只证明确定性返回、权限检查与 provider 调用一致。首次获权调用的延迟导入现已纳入 duration_ms;真实计时等价与性能收益未验证。
主干原 74-case 命令在不可变 BASE 与候选均为 70 PASS / 4 FAIL。四个完整 case id 与 AttributeError: turn.build_turn_envelope 消息一致,失败发生在未改的 helper setup,尚未进入 Host adoption。该结果保留,不能写成 74 PASS。独立当前 carrier fixture 在每侧通过 4 个场景,28 个 Python assert 和 7 条 scripted-host assert 保持;另核对八份完整 saved source、journal、原 required marker、精确 PR provenance、artifact 和 replay。task_context 是投影,省略 CLI/control 字段,不能宣称它等于完整 raw work_contract 或证明真实模型采用。
两侧 standalone Core wheel 的 1,902 个产品文件与固定 Git、源码快照、wheel、installed bytes 和 RECORD 一致,ordinary/editable distribution 缺席。Root 再经原 provider 脚本仅追加 observation retention,独立执行 File/SQLite 各两侧:留下完整 hook、Todo CLI、事件和隔离状态,确认原 title/text/claim、精确 repository PR 和时间、一次 PR merge,以及零业务 quota spend/Todo complete。每个私有 fixture 内执行原 runtime owner shutdown;这不证明自然 process drain、所有 descendants 退出或完整进程成本。初次 Root replay 传入不含 tests 的打包源码目录而失败,改用不变的测试 fixture owner 后通过,旧失败保留。
最新 C1 为 #8266 的 1a3740cf9e6ebad337f17967452693a9050edc81。两份精确 source composition 的原 74-case 命令均通过,其 consumer fixture 的 22 行变化属于 C1 自身:改读 journal 保存的完整来源,并使用原 host-task-context owner。不能把这个通过结果归为本 PR 修复主干 setup。当前组合 candidate 的独立 Core 再通过 File/SQLite provider→事实→原 Todo CLI 回读;1,903 个产品文件与当前 composition/RECORD 一致。这里只资格化受影响的组合路径,未批准整个 C1 或默认切换。
语义与 CI 对齐
复用现有 typed status、null unknown-effect、scoped permission、source reader 和 PR cadence vocabulary;没有新 closed set、substring classifier、checked cache 或公共 skip flag。PR-specific 文案留在 provider 层,generic admission/settlement 义务不变,optional observer 不能把 must_attempt_work 变成建议。Root 还在当前 C1 Core 记录了实际 serving PID、redacted runtime locator 和 ps/lsof executable mapping,确认 Node v26.0.0 与 installed TS source 对应。该局部真实来源证据不认证自然 process drain。Root 最终标准 premerge 的 6 项 direct 与 15 项 selected 检查 PASS,包括双语、编译、maintainability、vocabulary 和公开边界。Goal change-quality policy 当前为 disabled,没有伪造 receipt。CI 的当前失败/未完成原因若未知,仍作为独立 diagnostic UNVERIFIED 保留;APPROVE 不代表所有 CI 绿,也不替代立即 merge-readiness。
我的整体评价 / Verdict
没有发现阻断本切片的生产问题。problem_context 为 justified_increment:普通任务免于加载无关 provider 的可用性依赖,现有权限、work/cadence、原来源与结果继续由同一 owner 持有。long_horizon 结论为 preserved,依据是 scoped source/requirement/replay 和 once-only effect/settlement 路径;user_experience 在这条 unavailable-provider 路径为 improved,未新增交互轮次。完整长期效果、产品旅程和性能不由这批局部证据推定。
现有 scoped capability resolver 持有权限,reconciler 持有 GitHub 观察,typed dispatcher 持有结果校验;把导入放在既有获权 provider try 内即可隔离可选代码,无需新增 owner 或 wrapper。
本次边界仅是 executing Turn 的可选 PR provider 加载及故障隔离;权限、cadence、原完整来源、capture、admission 和 settlement 都保留既有 owner。
已检查 hook、turn_start composition、quota/native callers 和 RFC append;此次内部加载修改没有改变 rendered presentation。
所触及范围无视觉呈现待验;真实模型、完整 Settings/产品旅程和平台资格不在本局部结论中。
同域的有界整理已体现为删除 eager internal alias,并让测试使用原 reconciler owner;没有保留需要维护的第二套 adapter。当前 exact-head、完整来源/负例、installed Core 与 C1 affected-path 证据支持此实现边界。合入仍须独立读回 review、thread closeout、未变 head 和 readiness,并在已给出的 maintainer 授权下处理相应 CI/policy hold。完整原目标和原十项保持开放,完成前仍需完整回归。
English verdict: APPROVE
The exact head 76502e5d18b46958a70a8cfed2218ddf3c0e2f3d isolates optional PR-provider loading behind the existing invocation-time permission check and failure owner. Source, negative, real File/SQLite, installed Core and current-C1 affected-path evidence support this bounded increment. Historical setup failures and diagnostic CI limits remain visible; full R1, actual-model adoption, total-cost improvement and C1 default cutover are not qualified.
|
Merge decision for exact head The complete author-owned COMMENTED approval conclusion was published and read back at this head: #8821 (review) . Current policy26 result/body verification passes all19 required evidence items. Approval closeout is clear, with no blocking reviews or unresolved review threads; COMMENTED is not formal GitHub self-approval. Required local validation passed: standard premerge6direct/15selected, final-head bilingual gate, cold provider/permission negatives, source File/SQLite observation/cadence/response-loss/full-source cases, independently installed Core execution/recovery/refusal and full Todo CLI/facts retention, and the current-C1 affected source/Core path. The immutable main original74 retains70PASS/4unchanged setupFAIL; the current carrier fixture preserves its original assertions. Current-C174/74 uses its own committed fixture correction and does not repair those main failures. CQQ is disabled for this Goal; no receipt is claimed. Immediate readiness is Under the existing maintainer authorization for independently reviewed positive changes, use admin bypass for this CI/GitHub policy hold. This bypass does not replace review, bilingual/required local checks, thread resolution or exact-head validation. No unresolved finding or conflict is bypassed. Read back the merge commit, source tree, sign-off and main before continuing #8822. Full D2/D5, original-ten acceptance, full regression, actual-model adoption, complete cost and C1 default cutover remain open. |
An executing Turn currently imports PR reconciliation and its metadata/content providers while composing the hook, before observation permission is resolved. An unavailable optional provider can therefore fail a path that has no permission to use it.
Move the reconciler import into the existing producer provider
try, after the invocation-time permission recheck. Both permission checks, revocation, provider ownership, cadence, result/error shape and unknown-read handling stay with their existing owners. The two internal test injection sites now patch the real reconciler owner; all their assertions and response-loss behavior remain intact.This is a bounded default-closure increment in the small-kernel RFC. The paired checkpoint records the delta and its limits.
Validation:
turn.build_turn_envelopealias. These failures are retained.Observation window: the first granted invocation now includes deferred imports in the existing
duration_mswindow. The frozen-clock comparison proves deterministic semantics; real timing equivalence and performance gains are unqualified.The current C1 head is #8266 at 1a3740cf9e6e. Its issue-fix provider modules do not overlap this change; the shared dispatcher remains its existing owner. This proposal does not certify the entire C1 composition, full D2/D5 closure, actual-model/context adoption, complete-cost improvement or the original ten acceptance requirements. Formal exact-head review, required validation and merge remain maintainer gates.