Repository navigation
Description
English
What happens. If the Host gets SIGTERM while a model stream is in progress, the Run fails on the next start. A SIGKILL at the same point, with the same parts already on disk, recovers and completes. So a normal stop loses the in-progress Run, and a crash does not.
During the normal stop the interrupted attempt ends with a non-provider error. For that case recovery_for_failure (plugins/agent/native/src/owner/driver_model.rs:5517) returns blocked ("original adapter supplied no safe replay or prefix continuation proof", line 5541). The partial output is captured (model_private_partial_captured is in the chain) but recovery does not use it.
Measurements. Release build, macOS arm64. Mock Responses server (WebSocket). One message. The model sends one text part, then one Shell tool call whose arguments stream for 4 s, one event every 40 ms (so the text part is on disk after about 85 ms, see #7477). Signal to the Host 2 s after the text event, then start the Host again on the same root.
| Build | Signal | Result |
|---|---|---|
| main 7382635 | SIGKILL | project_prefix_safe, model asked again, Run completed |
| main 7382635 | SIGTERM | Run failed |
| main 3586151 | SIGTERM | Run failed |
Fact chain of the SIGTERM case:
run_admitted > step_prepared > model_attempt_prepared > model_attempt_admitted > model_first_token_observed
> model_observed > model_private_partial_captured > model_cleanup_observed
> attempt_recovery_recorded(blocked: "original adapter supplied no safe replay or prefix continuation proof")
> model_interrupted("Original transport ended; upstream completion is not known")
> blocked(unsupported_protocol) > run_terminated(failed: "Recovery is unavailable for adapter supplied no safe interrupted-attempt recovery evidence (version 1).")
Chat completions also fails after SIGTERM, but it fails after SIGKILL too, because it writes no part before the stream ends. From reading the code, the SIGTERM path does not depend on the protocol.
I only tested SIGTERM to maka host serve. I did not check which other ways of stopping the Host (desktop quit, system shutdown, maka host commands) go through the same shutdown path.
Reproduce. Same setup as #7477 with "gap":40, and kill -TERM instead of kill -9.
简体中文
现象。 模型流进行中 Host 收到 SIGTERM,下次启动后运行失败。同一位置、磁盘上有同样已写入部分时发 SIGKILL,运行能恢复并完成。也就是说,正常停止会丢掉进行中的运行,崩溃反而不会。
正常停止时,被中断的请求以非服务商错误结束。对这种情况,recovery_for_failure(plugins/agent/native/src/owner/driver_model.rs:5517)返回 blocked("original adapter supplied no safe replay or prefix continuation proof",第 5541 行)。部分输出已经保存(事实链里有 model_private_partial_captured),但恢复没有用到它。
测量。 release 构建,macOS arm64。模拟 Responses 服务(WebSocket)。一条消息。模型先发一段文字,再发一个 Shell 工具调用,参数流持续 4 秒,每 40 ms 一个事件(所以文字约 85 ms 后已写入,见 #7477)。文字事件后 2 秒给 Host 发信号,再用同一个 root 启动 Host。
| 版本 | 信号 | 结果 |
|---|---|---|
| main 7382635 | SIGKILL | project_prefix_safe,重新请求,运行完成 |
| main 7382635 | SIGTERM | 运行失败 |
| main 3586151 | SIGTERM | 运行失败 |
SIGTERM 的事实链见英文部分。
chat completions 在 SIGTERM 后也失败,但它在 SIGKILL 后同样失败,因为流结束前不写入任何部分。读代码看,SIGTERM 这条路径和协议无关。
我只测了对 maka host serve 发 SIGTERM,没有核对其他停止 Host 的方式(桌面端退出、系统关机、maka host 命令)是否走同一条关闭路径。
复现:与 #7477 相同,"gap":40,用 kill -TERM 代替 kill -9。
Posted by Claude Opus 5.5 (AI).
Activity
garvit-arora commentedon Dec 3, 2026
I opened #7558. A cancelled attempt now projects its recorded parts under the existing cold-item contract, the same prefix a crash uses, both when the cancellation is observed and when recovery is assessed on the next start. The unit test covers the decision; the mock Responses SIGTERM run and the other Host stop paths still need verification.