Skip to content

fix(replan): preserve goal fidelity and audit completion evidence - #5132

Merged
huangruiteng merged 1 commit into
mainfrom
codex/replan-goal-fidelity
Sep 27, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/replan-goal-fidelity

Conversation

@huangruiteng

Copy link
Copy Markdown
Collaborator

Replan action packets emphasize producing a typed outcome but omit the goal-fidelity and completion-evidence reminders present in the broader vision contract. A successful replan or a small passing slice can therefore be mistaken for achieving the requested goal.

Add two shared instructions (294 characters total): preserve requested goals and unmet requirements, and prove every requirement with current authoritative evidence before claiming achievement. Preserve them intact through CLI compaction and the host Turn envelope. Empty Todos, replan closure, blocked/exhausted/superseded states remain distinct from achievement.

The existing TypeScript replan owner supplies the guidance; Python only transports it through the existing requirements call. This applies by default to replan packets. It adds no acceptance gate, permission, setting or provider, and leaves typed discharge rules and non-replan behavior unchanged. CLI and host packet delivery are covered; no frontend/Lark configuration editor changes are needed because there is no new configuration contract. This supports the roadmap S3 Goal Vision/replan boundary without claiming broader S3 completion.

Validation:

  • 112 Python tests passed: replan host delivery, novelty, writeback, completion validation, the full real-CLI output-budget suite, and Turn envelopes.
  • 25 TypeScript replan/Turn tests passed; control-plane typecheck and focused Ruff passed.
  • Public boundary scan clean for all six files; git diff --check passed. Contract check had no errors and two unrelated existing registry-projection warnings.

The initial longer draft exceeded a CLI ceiling; the final guidance fits existing budgets without raising them. The required-vision fixture already exceeds the 8,192-byte envelope soft target: 11,992 → 12,314 bytes with guidance; its warning remains visible. Tests prove transport and unchanged authority/semantic gates, not model-behavior improvement; no live model comparison was run.

Future-facing pass: reuse the established typed owner and projection call; no parallel Python rule, new module or speculative abstraction. Scope is three product files, two durable regression files and one protocol document; no local/private artifacts. Maintainer merge required.

Signed-off-by: huangruiteng <14976749+huangruiteng@users.noreply.github.com>

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact-head self-review: 5132@1e5387641d893022601dd29a31cbb620fbb560a7
Approval conclusion: APPROVE. Author-owned PR; recorded as a COMMENTED review.

动机

本 slice 要解决的是 replan 上下文在到达 Agent 时缺少两个明确提醒:不能为了更容易通过测试缩小目标,也不能把 Todo 清空或 replan 收尾等同于目标实现。我核对了现有 typed replan owner、Python bridge 和真实 quota/turn CLI。目标是交付这些限定明确的规划提示,而不是证明语言模型从此会遵守,或新建一套完成判定权限。

改动思路

两条提示由现有 TypeScript replan 语义所有者产生,Python 只转运 requirements 返回值,Turn 的紧凑投影保留整个数组。现有 qualify 分支、typed triggers、允许的 semantic outcomes 和 evidence-linked vision authoring 不变。这样下一次修改仍落在原有 owner,不需要 Python 再实现一份规则,也没有重复手写或持续同步的 Goal 状态。非 replan 路径不产生这个字段,默认执行选择仍由原有 obligation 决定。

具体改动

完整 diff 为 6 个文件、+109/-3:三处生产路径、协议说明和两处测试。新增的是有界提示字段,不是 CLI 开关、provider、schema-required 输入或新的 persisted receipt。文档明确区分传递成功与模型行为效果,并保留用户 scope、authority、budget 和 stop 限定。

关键代码讲解

  • projectReplanSemantics(replan_semantics.ts:109)在 requirements 分支返回两条 planning_guidance。qualify 仍只依据 typed obligation、observation delta 和 vision evidence;提示本身不能 discharge obligation,也不扩大终止状态。
  • build_replan_action_packet(progress_observation.py:521)复用一次 requirements 调用,同时取 planning_guidance 与 writeback_contract。它没有解析英文提示或自己判断 achieved,避免出现第二个 policy owner。
  • replanActionPacket(turn_envelope.ts:253)在 whitelist compact 后保留数组,防止通用诊断截断吞掉 authority/stop 限定。其余 packet 字段和签名覆盖仍保留,提示作为上下文进入签名,不被误当作新增执行权限。

对主干的风险

最强反例是“提示在 bridge/compact 中丢失”或“仅凭提示文字便接受完成”。使用同一合成 registry 和 SQLite/file authority 工作负载在 immutable base/head 执行真实 quota should-run 与 turn plan:普通 run 两边没有 replan packet,输出大小相同;vision-gap/replan 路径 base 缺少两条提示,head 在 CLI 和 host packet 中完整保留。独立提示交付 oracle 在 base 不满足、head 满足;在实际 host 投影边界移除提示也会被 oracle 检出。

现有 typed 语义 suite 还验证五类 trigger、缺失 evidence、显式 outcome 限制、terminal path 不一致与重放,提示不能使无 semantic delta 的 qualifier 通过。没有新授权选择器、共享数据库迁移或跨 Agent 写权限,因此无需 PostgreSQL 或另一个 session 验证。用户 scope/stop 仍由原有契约保留;没有把硬 obligation 改称建议。

语义与 CI 对齐

本 PR 在已有 replan vocabulary 中添加 advisory 字段,不改 required_any_of、allowed_terminal、action、boundary 或 settlement 条件。同一 base/head 回放仅规范化合成临时路径、时间戳并移除这项已声明的 advisory 增量后,quota 与 host 的完整 authority 文档及 replan packet 相等。非 replan 字节增量为零,replan 的格式化 CLI/host 输出分别增加 347/356 字节;原有 soft-budget warning 保留,未抬高任何上限或删除判定字段。远程 CI 未查询、未等待;审查通过不代表 merge readiness 已满足。

我的整体评价

这是完成的上下文交付修复,而不是整个目标收敛能力完成。长期推进维度保留原有可执行义务、重放拒绝与 evidence authority;用户体验改善在于两个规划提醒真实到达当前入口,不需新增配置或人工介入。head/base 聚焦 Python 测试分别 112/110 通过,TypeScript 测试分别 25/24 通过,两边 control-plane typecheck 和相关 lint 通过。原生 CLI output budget 测试也在这组 Python 验证内通过,public boundary 扫描通过。

未来变化的有界整理已体现在复用 requirements 一次返回和统一 TS owner;没有必要为了两条字符串增加模块或兼容分支。该字段是 co-deployed 的追加式投影,旧消费者不要求它,历史 receipts 不改写。未验证真实模型的遵守率,不把它当作阻挡当前运输修复的假定义务。结论 APPROVE;作为 runtime/control-plane 修改仍由 maintainer 合并,本次没有自行合并。

English verdict: APPROVE

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Exact-head self-review: 5132@1e5387641d893022601dd29a31cbb620fbb560a7
Approval conclusion: APPROVE. Author-owned PR; recorded as a COMMENTED review.

动机

本 slice 要解决的是 replan 上下文在到达 Agent 时缺少两个明确提醒:不能为了更容易通过测试缩小目标,也不能把 Todo 清空或 replan 收尾等同于目标实现。我核对了现有 typed replan owner、Python bridge 和真实 quota/turn CLI。目标是交付这些限定明确的规划提示,而不是证明语言模型从此会遵守,或新建一套完成判定权限。

改动思路

两条提示由现有 TypeScript replan 语义所有者产生,Python 只转运 requirements 返回值,Turn 的紧凑投影保留整个数组。现有 qualify 分支、typed triggers、允许的 semantic outcomes 和 evidence-linked vision authoring 不变。这样下一次修改仍落在原有 owner,不需要 Python 再实现一份规则,也没有重复手写或持续同步的 Goal 状态。非 replan 路径不产生这个字段,默认执行选择仍由原有 obligation 决定。

具体改动

完整 diff 为 6 个文件、+109/-3:三处生产路径、协议说明和两处测试。新增的是有界提示字段,不是 CLI 开关、provider、schema-required 输入或新的 persisted receipt。文档明确区分传递成功与模型行为效果,并保留用户 scope、authority、budget 和 stop 限定。

关键代码讲解

  • projectReplanSemantics(replan_semantics.ts:109)在 requirements 分支返回两条 planning_guidance。qualify 仍只依据 typed obligation、observation delta 和 vision evidence;提示本身不能 discharge obligation,也不扩大终止状态。
  • build_replan_action_packet(progress_observation.py:521)复用一次 requirements 调用,同时取 planning_guidance 与 writeback_contract。它没有解析英文提示或自己判断 achieved,避免出现第二个 policy owner。
  • replanActionPacket(turn_envelope.ts:253)在 whitelist compact 后保留数组,防止通用诊断截断吞掉 authority/stop 限定。其余 packet 字段和签名覆盖仍保留,提示作为上下文进入签名,不被误当作新增执行权限。

对主干的风险

最强反例是“提示在 bridge/compact 中丢失”或“仅凭提示文字便接受完成”。使用同一合成 registry 和 file-registry authority 工作负载在 immutable base/head 执行真实 quota should-run 与 turn plan:普通 run 两边没有 replan packet,输出大小相同;vision-gap/replan 路径 base 缺少两条提示,head 在 CLI 和 host packet 中完整保留。独立提示交付 oracle 在 base 不满足、head 满足;在实际 host 投影边界移除提示也会被 oracle 检出。

现有 typed 语义 suite 还验证五类 trigger、缺失 evidence、显式 outcome 限制、terminal path 不一致与重放,提示不能使无 semantic delta 的 qualifier 通过。没有新授权选择器、共享数据库迁移或跨 Agent 写权限,因此无需 PostgreSQL 或另一个 session 验证。用户 scope/stop 仍由原有契约保留;没有把硬 obligation 改称建议。

语义与 CI 对齐

本 PR 在已有 replan vocabulary 中添加 advisory 字段,不改 required_any_of、allowed_terminal、action、boundary 或 settlement 条件。同一 base/head 回放仅规范化合成临时路径、时间戳并移除这项已声明的 advisory 增量后,quota 与 host 的完整 authority 文档及 replan packet 相等。非 replan 字节增量为零,replan 的格式化 CLI/host 输出分别增加 347/356 字节;原有 soft-budget warning 保留,未抬高任何上限或删除判定字段。远程 CI 未查询、未等待;审查通过不代表 merge readiness 已满足。

我的整体评价

这是完成的上下文交付修复,而不是整个目标收敛能力完成。长期推进维度保留原有可执行义务、重放拒绝与 evidence authority;用户体验改善在于两个规划提醒真实到达当前入口,不需新增配置或人工介入。head/base 聚焦 Python 测试分别 112/110 通过,TypeScript 测试分别 25/24 通过,两边 control-plane typecheck 和相关 lint 通过。原生 CLI output budget 测试也在这组 Python 验证内通过,public boundary 扫描通过。

未来变化的有界整理已体现在复用 requirements 一次返回和统一 TS owner;没有必要为了两条字符串增加模块或兼容分支。该字段是 co-deployed 的追加式投影,旧消费者不要求它,历史 receipts 不改写。未验证真实模型的遵守率,不把它当作阻挡当前运输修复的假定义务。结论 APPROVE;作为 runtime/control-plane 修改仍由 maintainer 合并,本次没有自行合并。

本次重新核对:head 与 immutable baseline 未变化,当前主干未改变三处相关 owner/caller 或 Node 依赖。复用上轮明确绑定修订的 TypeScript/typecheck/lint 证据;本轮重新执行 base/head 真实 CLI 回放及聚焦 Python suite,交付 oracle 和非 replan/authority parity 结论一致。本记录补正上次遗漏的作者自评标题,不扩大验收或合并权限。

English verdict: APPROVE

@huangruiteng
huangruiteng merged commit e4b8d59 into main Sep 27, 2026
25 of 34 checks passed
@huangruiteng
huangruiteng deleted the codex/replan-goal-fidelity branch September 27, 2026 03:10
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