Skip to content

refactor(harness): isolate tool failures and allow empty timelines - #158

Merged
nanzhi84 merged 1 commit into
mainfrom
codex/issue-157-pr1-independent-failures
Aug 2, 2026
Merged

nanzhi84 merged 1 commit into
mainfrom
codex/issue-157-pr1-independent-failures

Conversation

@nanzhi84

@nanzhi84 nanzhi84 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

目标

这是 #157 推荐拆分中的 PR 1/7:移除跨工具调用的失败记忆与局部 repair/exhaustion 预算,让每次模型工具调用独立进入 executor;同时允许合法的完整区间删除落为 canonical empty timeline。

Refs #157

改动

  • 删除 failedCalls / pendingFailures / duplicate admission / repair exhaustion 状态机与对应指标、错误码和过时测试。
  • 保留单次只读瞬时失败自动重试,以及全局 turn/tool round 安全上限。
  • 工具失败统一向模型暴露 error_code、message、invalid_fields、current_state、recovery;持久化 data 仍保留同样信息。
  • 只有未完成的破坏性操作确认继续阻止终态回复;历史业务失败不再污染后续无关调用。
  • timeline.delete [0,duration) 现在合法并持久化 duration=0 的 canonical empty 文档;越界返回稳定的 timeline_range_out_of_bounds 与精确字段。
  • 修复一个并发队列测试的同步竞态:等待 FIFO 第二项实际启动后再断言 busy。
  • 精简旧 recovery 测试与死代码,净删除 398 行。

验收证据

  • 相同失败参数连续调用:每次都真实进入 executor。
  • 无关工具调用:不受先前失败阻断。
  • [0,1441):返回精确 end_frame 约束且不产生新版本。
  • [0,1440):成功持久化 v2,duration_frames=0。
  • 全局 40 tool-round 上限仍能终止无限失败循环。
  • 未解决的 destructive confirmation 仍会阻止虚假成功终态。

本地门禁

  • make contracts
  • make test
  • make coverage — Rushes Go handwritten coverage 90.4%
  • make lint
  • make web — 27 files / 231 tests,build 与 bundle budget 通过
  • make e2e — 9 Playwright tests 通过
  • flaky queue 覆盖场景额外重复 100 次通过

PR 保持 draft,待 GitHub CI 与内置浏览器真实草稿/API/SQLite/log 验收通过后再转 ready 并合并。

nanzhi84 commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

PR1 内置浏览器验收(2026-08-02)

验收 worktree:codex/issue-157-pr1-independent-failures@30a6b52
独立端口:Web 15273 / API 18100 / Worker metrics 18102
真实草稿:draft_bca9ab982401508ab3494f13

UI → API → SQLite → log 证据

  1. 在 Codex 内置浏览器创建草稿;公开材料 API 导入 2 秒 fixture,worker ingest 成功。
  2. 通过公开 timeline patch API 建立 v1:60 帧、主视觉 1 段。内置浏览器刷新后显示:
    • 素材 issue157-pr1.mp4;
    • 2.00 秒预览;
    • 时间线主视频 1 段;
    • 导出 v1。
  3. 提交越界 delete_range [0,61):
    • HTTP 400 / timeline_patch_validation_failed;
    • GET timeline 仍为 v1 / 60 帧;
    • SQLite drafts.timeline_current_version=1,timeline_versions 仍只有 1 行。
  4. 提交完整合法 delete_range [0,60):
    • 成功生成 v2;
    • duration_frames=0;
    • 7 条必需轨道全部保留且 clip 数均为 0;
    • edit lease 为 inactive。
  5. SQLite 事实:
    • v1:60 帧、主视觉 1 段;
    • v2:0 帧、主视觉 0 段;
    • timeline_edit_batches 明确记录 manual delete 由 before_version=1 到 after_version=2;
    • TimelineValidated 事件对 v2 给出 structural/content contract valid,issues 为空。
  6. 内置浏览器刷新后的最终画面显示 0.00 秒空时间线,素材仍保留;浏览器 console warning/error 为 0。

动态工具面观察(不混入 PR1)

真实模型第一轮只绑定了 timeline.check;模型随后请求未注册的 timeline.delete 时,现有 terminal guard 拒绝了未执行调用,没有伪造成功。第二轮真实执行 timeline.check 后,模型诚实报告当前工具面没有 delete/inspect。

因此 PR1 的完整删除产品态由公开 API + UI + SQLite + event log 验收;“相同失败调用均真实进入 executor / 无关调用不受污染 / 失败信封精确字段”由本 PR 的 agentexec 与 service 行为测试覆盖。动态工具面扩展留在 #157 后续推荐 PR,避免把不同阶段揉进 PR1。

@nanzhi84
nanzhi84 marked this pull request as ready for review August 2, 2026 15:25
@nanzhi84
nanzhi84 merged commit dc8d286 into main Aug 2, 2026
5 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30a6b5288b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
primary, exists := tracks["visual_base"]
if !exists || len(primary.Clips) == 0 {
if document.DurationFrames == 0 && exists && len(primary.Clips) == 0 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject empty timelines before queuing renders

After a full-range delete, this makes timeline.Validate report the zero-duration document as valid, but both enqueuePreviewRender and validateUserExportTimeline use that result as their renderability gate. Consequently, preview generation or a user export for this new canonical-empty version is accepted and queued, only for the worker's media.RenderTimeline to deterministically fail with 时间线没有主视觉 clip; add a render-specific empty-timeline check so these requests return validation failure before creating doomed jobs.

Useful? React with 👍 / 👎.

@nanzhi84
nanzhi84 deleted the codex/issue-157-pr1-independent-failures branch August 9, 2026 17:24
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