# Case: `fail-marks-thread-failed` ## 用例意义 验证租约拥有者可以把线程推进到 `failed` 终态,并生成失败结果消息。 ## 前置条件 - `worker-b` 已成功 `claim` 线程 `THREAD_ID` ## 输入 ```bash inbox --db TMPDIR/coord.db --json fail --agent worker-b --thread THREAD_ID --summary "Migration failed" --body "The migration cannot proceed because the prior schema is inconsistent." ``` ## 预期输出 - 命令退出码为 `0` - `thread.status == "failed"` - `message.kind == "result"` ## 断言结论 - `fail` 与 `done` 共享结果消息模型,但进入的是失败终态 - 成功 `fail` 后会释放当前活跃 lease,避免线程停留在失败终态却仍显示被占用 ## 补充约束 - 当 `--agent` 未显式提供时,可以回退使用根级 `--agent` - `fail` 生成的 `result` 消息会发回线程创建者,而不是发给当前执行者自己 - 如果线程没有活跃 lease,`fail` 应返回 `invalid_state`,而不是 `lease_conflict`