Skip to content

fix(chat): retain first-Goal admission and recovery boundaries - #8792

Merged
cocolord merged 1 commit into
mainfrom
codex/r1-admission-recovery-20261114t183603
Nov 14, 2026
Merged

cocolord merged 1 commit into
mainfrom
codex/r1-admission-recovery-20261114t183603

Conversation

@cocolord

Copy link
Copy Markdown
Member

When first-Goal admission cannot be read or evaluated, creation currently permits model dispatch. This change retains the Goal, initial Tasks and completion requirements, then returns a safe retryable failure before opening a Session or sending work. Creation without an executable Host continues to succeed.

Recovery reads the original Session/client operation through the existing Task-start owner before deciding whether new admission is needed. A confirmed first Turn with a lost submit reply is read back without another admission or dispatch; queued work still needs admission, and foreign or terminated-before-start work remains refused.

This delivers the admission/recovery portion of V2/V4/R1 in the minimal-kernel and distribution RFC, with its Chinese checkpoint in the same diff. It reuses Session, Task and quota owners and aligns with C1 #8266; automatic original-Task adoption and full R1/C1 acceptance remain open.

Validation:

  • Complete creation-completion suite: 36 passed.
  • Existing Session/checkpoint, queued resume, foreign Session and terminal-before-start recovery cases: 11 passed.
  • Exact candidate files on isolated main 58cc5817e35e + C1 C1: unify work sources and validate recovery #8266 b8ac1ec5443b: 22 selected cases passed, with source-byte readback.
  • Two independently reproduced first-candidate recovery defects were repaired and re-reviewed with no remaining actionable finding.
  • Staged bilingual RFC check and changed-file public-boundary scan passed. Exact-head premerge and formal review are recorded separately before merge.

The HTTP/action/store and synthetic Codex protocol exercise the production entrypoint on isolated File/SQLite state. These checks do not qualify native-model context retention, installation closure, full costs or the final original-goal regression.

Signed-off-by: lusendong.6789 <lusendong.6789@bytedance.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>

@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-6; OpenAI; self_reported (runtime observation unavailable).

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

动机 / Motivation

通过对话创建首个 Goal 的用户会遇到准入来源异常和派发响应丢失。
原来准入不可验证仍会发送模型工作;回复丢失后,之后的准入拒绝又可能把已执行结果留在恢复入口之外。
本次使未知准入先停止新派发,并让原操作读回已派发结果,保留要求和单次执行身份。
本次不安装校验器、不自动切换受治理模式,也不宣布最小内核或 C1 全部完成。
自动采用原 Task、安装闭包、原生上下文保留和完整成本仍需后续验收。

这是一项可单独评审和回滚的准入与恢复修复。只改异常分支虽能阻止首次误派发,却不能解决已确认工作的恢复;要求整个 R1 先完成又会让这个真实入口缺陷继续存在。

改动思路 / Approach

准入判断继续属于既有 quota owner,派发与结果属于原 Session/Turn,创建 checkpoint 继续属于 action store。这里复用既有 Task-start reader 和 first-Turn readback 判断,不增加第二套执行或决策 owner。已确认工作先读回,尚需派发的工作再准入;该顺序符合 committed result 与 required admission 的既有边界。

结构判断为 retain:恢复事实来自原 Session/client Turn,新增分支没有手写另一套工作状态;最小当前 PR 边界是“首个 Goal 的未知准入拒绝与原工作恢复”。单独保留显式 firstTurn checkpoint 兼容历史持久化回执;Session-only 恢复补记的是既有 checkpoint 格式。把两者统一时强加新的消息约束会改变历史回执,因此本次保留该区别。下一次同域规则变更仍在既有 readback/Task reader 和 quota owner 修改。

原操作状态 此 head 的行为
需要新派发,准入不可验证 保留 Goal/Task/要求,返回可重试失败;零 Session、零 Host 请求
已派发,submit 回复丢失 核对原请求并读回同 Session/Turn;不重新准入或派发
仍排队、尚未启动 继续要求当前准入
没有可执行 Host 的纯创建 完成创建,不读取工作准入

该表解释 72b95373a489d11c5b0f7c88cd4077922d53110c 的源码分支;执行证据是下列 HTTP/真实 store 测试。

具体改动 / Changes

评审基准为 docs/architecture/rfcs/monorepo-distribution-split-v0.md,spec_revision 为 58cc5817e35ea9a0dc4697f7791279c6d80946bc。依据改动之前的 RFC 判断:Section 10 的“不确定效果与当前准入区分、观察失败不改写已提交结果”边界在本入口得到 implemented 验证。V2 的完整双 preset 权限一致性、V4 的完整真实 managed 任务及成本、R1 的全部 V1–V5/V10 出口均为 deferred;本轮仅交付它们需要的入口修复,后续仍由既有 Session/Task/C1 组合及 R1 验收承担。双语 checkpoint 保留这些缺口,没有改写原要求来适配测试。

关键代码讲解

  1. ChatActionService._apply_goal_create 先持久化原 Goal、初始 Task 与完成要求。882 行的准入仅对有 Agent、有 Runtime Controller 且无读回结果的请求生效;读取或判断异常抛固定安全文本,经既有 HTTP owner 返回 invalid_action_apply,原 operation 可恢复。
  2. 同一函数的 Session-only 恢复分支 调用 ChatTodoActionMixin._read_task_start。reader 核验 Goal、Agent、channel 和原 client;创建路径再核对原消息。已派发或合法终态补记现有 firstTurn checkpoint,排队状态继续走准入。
  3. 既有 require_first_turn_readback 复用 typed action review plan,拒绝启动前终止的 Turn。历史显式 firstTurn 回执路径保持原检查,未对旧记录附加新消息条件。
  4. test_managed_creation_retains_requirements_before_one_host_dispatch 在 File/SQLite 真实 HTTP/action/store 与合成 Codex 协议下覆盖六种故障,独立断言持久化合同、零提前派发、恢复身份和一次 turn/start。纯创建测试另证实没有执行器时的准入隔离。

生产改动为 +68/-45;测试为 +54/-7;双语文档 +51。大部分生产行数来自把原准入包进准确的条件边界,新增实际机制只有既有 reader 的恢复调用和复用的 kickoff 字符串。没有新增 module、schema、枚举值、CLI 或迁移机制。

对主干的风险 / Risks

没有剩余阻塞 finding。最强反例是“submit 已完成但回复丢失,重试时准入源失败或否定”,以及“没有 controller 的纯创建”。第一版修复虽有八项通过,这两类仍使六项独立断言失败;最终候选修复了过度阻断,36 项完整创建测试与 11 项既有 checkpoint/queued/foreign/terminal 恢复测试通过。不能把早期通过记录当作最终完整证据。 同一最终测试输入覆盖旧主干的 22 项对照中,12 项保持通过、10 项按独立断言失败:4 项未知准入误派发,4 项已确认回复被后续准入读取或否定阻断,2 项纯创建多余地读取工作准入。最终候选同组全部通过;原运行时 1,963 个文件与 base Git blobs 一致,测试、合成 Host 和活跃 fixture 来源已核对。

已固定的 C1 #8266 b8ac1ec5443b985b34e978cea1ce4b38197ccb5b 与 main 58cc5817e35ea9a0dc4697f7791279c6d80946bc 的隔离组合使用逐字节一致的最终运行时与测试文件,22 项选定案例通过。保留组合环境首次缺少临时目录的 22 项 setup 错误;它们发生在产品断言之前。合成 Host 证明协议与 store 路径,不证明真实原生模型的上下文保留或完整成本。 评审期间 C1 更新到 71ccd34c39ca5777b9de9cadc07afd5239e5324c;另建的新隔离组合通过同一组 22 项案例,运行时、fixture 和最终候选的前后字节一致。该次 C1 运行时差异仅为 CLI quota 的完整契约续行,Chat owner 未变;本次仍重新验证入口,保留之前 b8ac 和旧主干两组证据。

PASS:准确 head 的 premerge 6 项直接检查和 11 项选定检查,含双语 RFC、编译、maintainability、语义词汇和公共边界。第一次 premerge 因缺少 TypeScript 开发依赖未能执行语义扫描;安装该 checkout 的锁定依赖后完整重跑通过,未改断言、扫描源码范围或预算。change-quality policy 当前 disabled,未制造该策略的通过回执。

语义与 CI 对齐

首轮工作仍依据精确 should_run is True 准入,未知来源由 fail-open 改为拒绝新派发,行为已在双语 checkpoint 和 PR 说明披露。生产状态使用既有 TERMINAL_TURN_STATES 与 typed review plan,没有用文本 substring 分类。抽出的 kickoff 字符串与原表达式相同;新错误只说明原 Goal 准入不可验证、保留创建并等待来源恢复,没有增加授权或自动重试义务。正常配置与历史回执路径保留。

CI 按 Goal 当前 wait_for_ci=true 观察;远端检查和 merge readiness 单独读回。已有本地证据足以判断本次源码,但不替代 GitHub 的合入检查、未解决 threads 或变动 head 的复审。

我的整体评价 / Verdict

APPROVE,属于 justified_increment。long_horizon=improved:已派发工作在响应丢失后保留原身份并恢复,未知准入不再引入额外工作;user_experience=improved:纯创建继续可用,恢复无需重新填写已知请求或新增确认。visual_review=not_applicable,因为所查 loopx/chat_actions.py 与既有 Chat HTTP error/retry consumer 没有改变页面结构或渲染代码;该边界的未验证视觉范围为 none。实际原生模型采用和完整任务交付仍明确未验收。

复用与规模判断均支持 retain;准确 head 没有引入默认关闭的新功能或额外权限,default_off_isolation 在无 opt-in 声明的本修复中不适用。源码恢复复用已有 vocabulary 和 owner,结构改动与错误严重度相称。残余风险是超出限定案例的真实原生模型与完整 R1 组合,需后续当前来源的真实任务、恢复、上下文和成本验收;本次批准不关闭该目标、不批准 C1 切换。合入依当前授权、准确 head 的 published review 与 readiness 另行执行。

English verdict: APPROVE — head 72b95373a489d11c5b0f7c88cd4077922d53110c; no blocking finding after reproduced recovery fixes. Creation 36, legacy recovery 11, current C1 combination 22 and exact-head premerge passed. Full R1/native-model qualification remains open.

@cocolord

Copy link
Copy Markdown
Member Author

Authorized merge decision for exact head 72b95373a489d11c5b0f7c88cd4077922d53110c.

The exact-head COMMENTED approval is published and read back at review 5906686427, with a passing capability result check and clear approval closeout. The required local production-entrypoint validation passed: complete creation36, legacy recovery11, two independently built C1 combination cohorts of22, same-harness BASE counterfactual22 (12 parity passes and10 expected old-runtime assertion failures), and exact-head premerge6 direct +11 selected checks. The bilingual diff and public-boundary checks pass. The initial development dependency failure and first-candidate recovery defects remain preserved with their repairs and evidence.

The runtime/test files are unchanged from the qualified candidate. Latest qualified C1 is 71ccd34c39ca5777b9de9cadc07afd5239e5324c; the combined tree is conflict-free and its selected Chat admission/recovery tests pass. The PR changes no frontend rendering, independent validation installation, schema, composition activation or competing decision owner.

GitHub readiness currently holds for pending/incomplete status checks. Its review conclusion is valid, the exact head is open and mergeable, and all review threads are resolved (zero threads). Remote pending CI remains unverified; no cause or success is inferred. Under the maintainer's existing authorization to merge positively reviewed work, use the repository-permitted admin bypass for this readiness/GitHub policy hold after one final unchanged-head readiness check. This does not waive a required local validator or unresolved finding. Full R1/native-model/context/closure/cost acceptance and original-objective completion regression remain open.

@cocolord
cocolord merged commit 48dbebb into main Nov 14, 2026
17 of 18 checks passed
@cocolord
cocolord deleted the codex/r1-admission-recovery-20261114t183603 branch November 14, 2026 19:26
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.

1 participant