Skip to content

fix(cli): preserve canonical recovery and monitor refusal context - #7483

Merged
loopx-agent merged 3 commits into
mainfrom
codex/fix-shared-alignment-canonical-error-20261027
Oct 27, 2026
Merged

loopx-agent merged 3 commits into
mainfrom
codex/fix-shared-alignment-canonical-error-20261027

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Canonical authority refusals reached shared-goal-alignment as prose only, dropping the machine error code and recovery route. Early Monitor writeback rejection also reported the inner Todo read instead of the requested monitor_poll operation. Preserve the existing typed refusal payload at the CLI boundary and rethrow the existing subtype with the outer operation context; neither path grants writes or retries.

Validation at e622bba0549409934915edd8f55682af252a7c11: all 87 alignment, split-root, native Monitor, transaction-recovery and unavailable-source tests pass across real File/SQLite fixtures. Both CLI aliases failed the new structured-recovery test before the fix; the existing split-root Monitor test reproduced the wrong operation before the fix. Updated stale display tests preserve real canonical readback and reject foreign working-directory data; uninitialized authority still refuses with no source mutation. Exact-head premerge, public boundary and review qualification follow before merge. Native Windows and whole-release qualification remain separate.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
…ation

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent 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)

Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max

动机 / Motivation

需要处理未迁移Goal或Monitor拒绝的CLI调用方与维护者。 alignment CLI只返回异常文案,丢失canonical错误码和迁移恢复字段;Monitor写回的早期拒绝则错误标记为内部todo_read。 两个alignment命令保留已有结构化拒绝和恢复指引,Monitor拒绝标记请求的monitor_poll,仍拒绝写入和隐式迁移。 不授予执行或写入权限,不增加重试、迁移入口、错误类、协议词汇或新页面。 审阅绑定e622bba0549409934915edd8f55682af252a7c11。恢复信息丢失会让已有控制面反馈无法被机器可靠消费;当前证据只证明这个缺口得到修复,不推断模型效果或长期成本收益。

改动思路 / Approach

在现有CLI边界保留CanonicalAuthorityRequired,并用同一子类型重抛Monitor操作上下文;复用已有错误与恢复owner。 现有typed异常和恢复owner足够,修复停留在两个既有异常边界。 三个既有文件保留canonical拒绝的机器字段和Monitor请求上下文。 CanonicalAuthorityRequired原本已经携带goal_id、operation、三个否定的authority字段和迁移恢复指引。新错误类、字符串匹配或重复迁移检查都会增加第二个owner。alignment只需在generic Exception之前接住已知子类型;Monitor只需在原来的拒绝条件里保留payload并重抛请求上下文。成功分支、原业务回执恢复条件和真实事务owner不需要改变。

没有新增caller能力、设置、CLI参数或页面。既有存储恢复消费者已经认识canonical_authority_required;错误码让它选择已有恢复路径,不代表Agent能自动重试或迁移。JSON错误出口仍返回失败;界面渲染、布局和首屏组成未改,因此视觉审阅不适用。打包后的完整产品旅程继续由发布门单独验证。

具体改动 / Changes

规范是docs/reference/local-authority-provider-selection.md,spec_revision=8acdb88d32b6cad5b43670c99647341545f435cd:固定合同。NO-FALLBACK implemented:选中来源失败不回退旧展示或其他authority;TYPED-RECOVERY implemented:两个真实CLI别名保留错误码、原有否定权限字段与恢复指引,不自动迁移;REQUEST-CONTEXT implemented:Monitor早期拒绝标记已有monitor_poll操作。三项都有当前head的真实后端证据,文档中的历史provider发布范围不用于扩大本次资格声明。

关键代码讲解

  • alignment exception boundary:Specific canonical refusal retains machine fields; generic fallback remains for other errors.
  • Monitor early refusal:Keep original payload,force existing requested monitor_poll context and preserve exception chaining.
  • Both alias regressions:Actual uninitialized native read refuses with complete recovery and no state/registry mutation.
  • Foreign display isolation:Existing canonical work remains readable without adopting a different working directory source.

alignment handler在已有异常边界增加专门catch,保留原payload并明确ok=false、error_code和原有公开错误文案。其他异常继续走原fail-safe,不按子串或文案猜测是否需要迁移。它不增加canonical查询,不改project路由,不写入registry、state或provider。

Monitor的改变只发生在原canonical读取拒绝后:当execute、原effect identity或lease条件不满足原恢复要求时,仍然拒绝。重抛沿用同一CanonicalAuthorityRequired,保留原payload和异常链,只把operation绑定为本次monitor_poll。可恢复的原业务回执仍走原分支;新操作、缺失回执或不匹配的租约不能借此获得写入权限。没有新增状态、词汇、重试或receipt。

测试同时区分缺失展示与缺失authority:已有canonical状态可以在展示文档丢失时只读回读,这不是unpromoted fallback。外部工作目录中加入独有todo_foreign_only后,CLI仍回读原canonical basis、保持原frontier数量,并且不采用、不改写外部文档。File/SQLite两种真实provider和完整source digest的既有案例继续保留。新unmigrated案例在两个别名上断言完整恢复字段、false权限标志和源文件不变。

对主干的风险 / Risks

87项真实alignment、split-root、native Monitor、事务恢复和不可用来源测试通过,零skip;新两个CLI反例和原Monitor操作反例在修复前均失败;6direct+18selected premerge、Ruff、配置mypy、公开边界与严格CQR通过。 原两个alias测试因error_code缺失失败;原Monitor断言因operation错误失败。最终五个完整模块覆盖正常读取、split-root、native Monitor、事务恢复和不可用来源,不能拿单一happy path代替这些反例。首次after命令引用了不存在的测试文件,未执行测试,未计为通过;之后按仓库实际模块重新完成87项验证。没有查询、轮询或等待PR CI。

最强风险是把拒绝包装成可执行恢复,或者在改上下文时放宽原回执资格。本diff没有触碰原资格条件;新的实际CLI断言和既有原操作恢复、租约及重复事务检查继续防守。异常payload只由已知canonical子类型提供,顶层结果强制失败;未引入通用任意异常payload外发路径。回滚只需撤回两个handler变化,没有存储迁移。运行成本不增加额外查询或IO,也不声明性能提升。本切片不替代最终完整发布、打包页面和原生Windows资格。

我的整体评价 / Verdict

APPROVE,goal_achieved,仅指既有canonical拒绝反馈的修复。long_horizon improved是恢复可靠的机器恢复信息;user_experience improved是现有调用方无需猜测文案或错误操作。实际Agent采用、完整任务效果和整版发布仍分别验证。bounded refactor unnecessary:两个既有边界已最小,不再引入共享translator或新错误层。不存在独立阻塞发现。作者自审采用COMMENTED记录,合并仍须当前head的readiness和维护者授权。

English verdict: APPROVE — e622bba0549409934915edd8f55682af252a7c11. Preserves typed canonical recovery for both alignment aliases and reports the requested Monitor operation without admitting writes,retries or migration. All87 real cases,6direct+18selected premerge,Ruff,configured mypy,boundary and CQR pass. Whole-release,packaged UI and native Windows qualification remain separate.

@loopx-agent
loopx-agent merged commit d60b1f9 into main Oct 27, 2026
5 of 7 checks passed
@loopx-agent
loopx-agent deleted the codex/fix-shared-alignment-canonical-error-20261027 branch October 27, 2026 09:49
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