docs(api): lease/state mutation fallback 入公开文档(task_operation_failed,来源 OV #330 / #334) - #92
Conversation
…_failed) [#330]
来源:OV #330 的 docs 追加件(代码面 = PR #334,已合 squash 8a270026)。真源在 website ⇒ 由本组开 docs PR。
内容(逐字,总指挥 #4585 转交):`## POST /v1/tasks` 段内**紧接既有 Monitoring note 段落之后**追加
「Lease and state mutation fallback」小节——`/v1/tasks/:id/{claim,lease,release,claim-lost,decision,state}`
与控制台 task-mutation 路径在**未映射到域错误**时统一 `502 {error:"task_operation_failed"}`(无 taskId);
这些路径**在写阶段确实会发信**,故 SMTP 失败只是**可能原因之一**(同段代码也覆盖未映射/内部失败,
如 `task_leases_disabled`),旧的 `smtp_error` 标签把二者混为一谈;已映射域错误保留各自码与状态码。
附监控注记:该 fallback **不带 taskId** ⇒ 上面那条 pre/post-create 判别不适用于这些路由,
服务端 mutate 路径的 `console.warn` 是主要归因手段。
i18n-en-baseline.json 同轮重算:**恰 1 行**(docs/reference/api/index.html bodySha256 0ee6108e… → ce1d3b8b…),
按纪律在 worktree 内 `npm ci` 精确装依赖后重建再算(避免工具链漂移造成假漂移)。
本地核:seo-docs/llms-txt/mcp-tools 17 pass·0 fail;astro build OK;postbuild 全绿 + 5-part en-baseline 不变量 PASSED。
|
@coderabbitai review |
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openagentemail/website/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe API reference now documents fallback errors for task mutation routes and console mutations. The English baseline checksum for the generated API reference was updated. ChangesTask mutation error documentation
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~3 minutes Change: Other Merge Risk: ⚪ Minimal · up to This documentation update clarifies mutation fallback responses and monitoring exceptions. No actionable merge risk is established; it appears ready after normal checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ZCode Review Gate:✅ pass
完整审查报告(zcode_pr_review:git diff + mimosa 深扫 + ZCode 只读复核)审查完成。以下为完整审查报告。 PR 安全审查报告PR: base=origin/main → 075a00b(2 个文件: 一、汇总
mimosa findings 核实: 扫描结果为 0 findings、0 业务逻辑假设,无可核实条目(确认漏洞 0 / 误报 0 / 存疑 0)。我按规则对改动文件相关代码做了人工抽查(i18n-check 脚本、i18n 测试、docs 渲染链路),未发现可利用问题。 结论: 本 PR 为纯文档改动 + 对应的 i18n 英文基线哈希同步,未引入任何可执行代码、未泄露敏感信息、未扩大攻击面。可以合并。 二、改动内容定性
安全性判定依据: 改动为 Markdown 文本,经 Starlight 内容集合安全渲染,无原始 HTML、无脚本、无新增外链;不涉及凭证、内部主机名或密钥;公开文档描述错误码语义与监控归因方法属 API 参考文档的正常内容。所有 三、问题清单(均为 P3 提示,不阻断)P3-1|文档完整性 — P3-2|跨仓库一致性 — P3-3|审查惯例提示(存量机制) — P3-4|存量提示(非本 PR 引入) — 四、mimosa findings 核实摘要显示 findings: 0,business-logic hypotheses: 0(scanId VERDICT: P0=0 P1=0 P2=0 P3=4 MERGE=yes 由 zcode-review-gate 自动审查 · 写工具物理禁用 · 同一 head 不重复审 |
Codex Local Review:
|
| 项 | 值 |
|---|---|
| head | 075a00b70afe |
| 严重度分布 | P0 × 0 · P1 × 2 · P2 × 0 · P3 × 0 |
| 结论 | patch is incorrect(置信 0.98)——The fallback response itself is documented correctly, but the patch gives one condition that cannot reach that fallback and overstates the diagnostic information available from two route warnings. Bot |
完整审查报告(本地 codex CLI · 只读沙箱 · 官方 rubric)
P1 · [P1] Remove the unreachable task_leases_disabled fallback example
- 位置:
/home/ops/.local/share/codex-review-gate/crg-wt-b8t1y51y/src/content/docs/docs/reference/api.md:393· 置信 0.99 - When lease support is disabled, all four lease routes return
409 {error:"task_leases_disabled"}before invoking the service (packages/api/src/routes/tasks.ts:364,399,441,476), using the same immutable-at-runtime gate as the sole internal throw;decisionandstatecannot emit this code either. Thus no documented mutation path exposes this condition as502 task_operation_failed, so this example misstates the public error contract.
P1 · [P1] Do not promise causal attribution from every mutation warning
- 位置:
/home/ops/.local/share/codex-review-gate/crg-wt-b8t1y51y/src/content/docs/docs/reference/api.md:395· 置信 0.97 - When an unmapped
/leaseor/releasefailure occurs, the implementation logs only the static messages[task] renew failedand[task] release failed(packages/api/src/routes/tasks.ts:426,468) and discards the exception code. Those warnings cannot distinguish SMTP failures from the internal failures discussed above, so describingconsole.warnas the primary attribution aid is inaccurate for two of the listed routes unless their logging is enhanced.
Codex Local Review Gate(自托管 3+ 加固:严判 verdict · 同轮重试 · 现场诊断;模型线见 ~/.codex-dev/config.toml;in 598469/out 5960 tok,254s)· 同一 head 不重复审 · 云端 connector 延迟时的快速闸
…table (Codex P1×2) Codex 报两条 P1,我**逐条对服务端源码亲核 = 全真**(`openagentemail/openagentemail@8a270026`): 1. **删掉不可达的 `task_leases_disabled` 例子**(置信 0.99):该码在四条 lease 路由上是 `if (!leasesEnabled()) return 409`(`packages/api/src/routes/tasks.ts:364/399/441/476`) —— **在调用 service 之前**的守卫返回,`decision`/`state` 也发不出它 ⇒ 任何已文档化的 mutation 路径都**不可能**以 502 `task_operation_failed` 暴露该条件。原句把它当 fallback 的例子属**误述公开错误契约** ⇒ 改为「also covers unmapped/internal failures.」(去例子)。 2. **不夸大 console.warn 的归因能力**(置信 0.97):`/lease`(renew) 与 `/release` 的未映射失败分支 只打静态文案(`tasks.ts:426` `[task] renew failed` / `:468` `[task] release failed`)并**丢弃异常码** ⇒ 这两条路由上「console.warn 是主要归因手段」不成立 ⇒ 监控注记补限定:**除** `/lease`(renew) 与 `/release` 外可用;那两条路由单凭响应无法区分 SMTP 失败与内部失败。 i18n-en-baseline.json 随同重算:仍**恰 1 行**(bodySha256 ce1d3b8b… → 226db8eb…)。 本地核:astro build OK;源测 17/0;postbuild 全绿 + 5-part 不变量 PASSED。
Codex Local Review:✅ pass
完整审查报告(本地 codex CLI · 只读沙箱 · 官方 rubric)未发现该 PR 新引入的问题。 Codex Local Review Gate(自托管 3+ 加固:严判 verdict · 同轮重试 · 现场诊断;模型线见 ~/.codex-dev/config.toml;in 501470/out 3766 tok,167s)· 同一 head 不重复审 · 云端 connector 延迟时的快速闸 |
ZCode Review Gate:✅ pass
完整审查报告(zcode_pr_review:git diff + mimosa 深扫 + ZCode 只读复核)审查完成。以下是完整报告。 PR 安全审查报告PR: 一、汇总
mimosa findings 核实:扫描报告 0 findings、0 业务逻辑假设,无可逐条核实条目(确认 0 / 误报 0 / 存疑 0)。按任务要求做了抽查:diff 中无密钥/凭证、无可执行内容、无 XSS 注入面(新增内容为 Markdown 表格文本,Starlight 静态渲染会转义,单元格内无 HTML/管道符破坏表格结构); 结论:可以合并。 文档与基线哈希的联动更新符合仓库既定流程,无新增安全风险。 二、逐条详述(P3)P3-1 文档描述的服务端行为在本仓库不可验证,存在跨仓库同步依赖
P3-2
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
终审报 · website#92(
|
| 格 | 结论 | 证据 |
|---|---|---|
CI build |
✅ 26s | run 35794750310 job 106971328584 |
CI guard |
✅ 5s | run 35794750313 job 106971328760 |
CI otp-redirect-smoke |
✅ 33s | run 35794750310 job 106971328925 |
| Codex Local | ✅ pass,P0–P3 全零(置信 0.98) | 绑终头;结论「documented fallback bodies / statuses / affected mutation paths / mail-delivery behavior / logging limitations match the authoritative implementation」 |
| ZCode | ✅ pass | 绑终头 P0=0 · P1=0;「未发现阻断问题,可以合并」 |
| CodeRabbit | ✅ 真审完成 + 零 actionable | 状态 Review completed;摘要「No actionable comments were generated in the recent review」;绑终头("Reviewing files that changed … between 9921293… and 75b8b727…") |
| 未解决 review thread | 0(total=0) | — |
| mergeable | MERGEABLE / CLEAN |
基线 = 本 PR base ⇒ 无需 rebase |
.coderabbit.yaml ⇒ 具备逐行审能力(不是 Free plan 的结构性上限、也不是限流)⇒ 本单不适用任何降链/豁免,CR 为真审零 actionable。
二、闸意见逐条处置(两条 P1 我对服务端源码逐条亲核 = 全真)
| 闸 | 级别 | 报告 | FC 亲核(openagentemail/openagentemail@8a270026) |
处置 |
|---|---|---|---|---|
| Codex | P1 | 「Remove the unreachable task_leases_disabled fallback example」— 租约关闭时四条 lease 路由在调用 service 之前就返回 409 task_leases_disabled,故没有任何已文档化路径会以 502 task_operation_failed 暴露它 |
真:packages/api/src/routes/tasks.ts:364/399/441/476 均为 if (!leasesEnabled()) return c.json({error:'task_leases_disabled'}, 409);decision/state 分支无该码 |
已修:删去该例(改「also covers unmapped/internal failures.」) |
| Codex | P1 | 「Do not promise causal attribution from every mutation warning」— /lease(renew) 与 /release 的未映射失败只打静态文案并丢弃异常码,故「console.warn 是主要归因手段」对这两条路由不成立 |
真::426 console.warn('[task] renew failed')、:468 console.warn('[task] release failed')(其后才 502) |
已修:监控注记补限定「except /lease(renew) 与 /release … 单凭响应无法区分 SMTP 失败与内部失败」 |
| ZCode | P3×3 | 术语/措辞提示 | 认 | 记档(不阻断) |
三、⚠️ 与「逐字件」的偏差声明(请复核;最小可回退)
总指挥给的逐字件里两处与实现不符;我先对源码亲核、再改(改动全在同一表/注记内,回退即一行):
- 删掉不可达的
task_leases_disabled例子(原句把它当 502 fallback 的原因 —— 实为 409 前置守卫)⇒ 会误述公开错误契约; - 监控注记补限定(原句「
console.warn是主要归因手段」对/lease(renew)、/release不成立)。
若你要保留原文,一句话我改回(我判不该保留:两处都有源码实证,且 Codex 判 P1;#4585 你已复核过 website#90 的同款处置)。
四、本地核(FC 亲跑;权威格 = CI)
| 检查 | 结果 |
|---|---|
npm ci(worktree 内精确装依赖)+ npx astro build |
成功 |
node --test tests/{seo-docs,llms-txt,mcp-tools}.test.mjs |
17 pass / 0 fail |
npm run postbuild(全套 rendered) |
全绿 + en-baseline 5-part invariant check PASSED |
i18n-en-baseline.json 同轮重算 |
两轮均恰 1 行(bodySha256:0ee6108e… → ce1d3b8b… → 226db8eb…;其余条目逐字节相同) |
| 范围 | 未动 public/llms.txt(已核无相关串)、未动主仓 docs/api.md 指针 |
纪律留痕:本仓基线是「渲染后 en HTML 逐页 sha256」冻结件 ⇒ 重算必须在锁文件精确重建的环境里做(worktree 内 npm ci 后重建再算);本次一次即恰 1 行(对照 website#90 的教训:拿主 checkout node_modules 软链算出的 97 行是假漂移)。
五、请求
- 准并(你亲核亲合;无需 Closes)。
- §三 两处偏差照准或令回退(我建议照准,理由见上)。
- 顺带一行:CR 于本仓是 Advanced + 仓内配置的逐行真审,与 hosted-ops 侧的 Free plan 形态不同 —— 建议在台账里记一笔,免得后续误套降链口径。
What / why
来源 = OV #330 的 docs 追加件(代码面 = 主仓 PR #334,已合 squash
8a270026);docs 真源在 website 仓 ⇒ 按属主映射由本组开 docs-only PR(总指挥 #4585 转交)。无 Closes(不需要关单)。落点(内容锚定,非行号)
src/content/docs/docs/reference/api.md的## POST /v1/tasks段内:紧接既有 “Monitoring note: …” 段落之后、## GET /v1/tasks?state=之前(真源origin/main = 9921293,插入点落在:387与:389之间)。内容(逐字照贴)
范围
public/llms.txt(已核:不含task_operation_failed/task_leases_disabled等串 ⇒ 无第二面需要同步)。docs/api.md(已声明 moved 的指针)未动。本地核(FC 亲跑;权威格 = CI)
npm ci(worktree 内精确装依赖)+npx astro buildnode --test tests/seo-docs.test.mjs tests/llms-txt.test.mjs tests/mcp-tools.test.mjsnpm run postbuild(compare/jsonld/seo-docs/llms-txt/mcp-tools/i18n-sync 全套 rendered)en-baseline 5-part invariant check PASSEDi18n-en-baseline.json同轮重算docs/reference/api/index.htmlbodySha2560ee6108e…→ce1d3b8b…(其余条目逐字节相同)git diff --shortstatapi.md+9、i18n-en-baseline.json+1/−1)纪律留痕(按 13 号文【已知坑】新立那条):本仓基线是「渲染后 en HTML 逐页 sha256」冻结件 ⇒ 重算必须在锁文件精确重建的环境里做。本卡在 worktree 内
npm ci后重建再算,一次即恰 1 行(对照 website#90 的教训:用主 checkoutnode_modules软链算出的 97 行漂移是假漂移)。Summary by CodeRabbit