fix(workflow-run): infer interruption only from crash or fork closers

Replace the persisted background marker with a client-only rule. A
foreground run writes run-end before its Tool Step ends and a background
run outlives that Step, so only a Turn closed after a crash or at a fork
boundary shows a run without run-end as interrupted.
This commit is contained in:
Turtle committed 2026-10-03 10:16:11 +08:00
1 parent 34aef8c140
commit d3c2b3e642
19 files changed
+129 -351

No files matched your search

@@ -1,28 +0,0 @@
# Bilingual-pair consistency record for 2026-10-03-workflow-run-background.md (docs/i18n/README.md): per heading
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/persistence-changes/2026-10-03-workflow-run-background.md
/:
en: 3d5a424ae7d7e46b
zh: c22a8e4a62d8cc1a
/2026-10-03-workflow-run-background:
en: 990aebebf4796f71
zh: 9ae52c345e6c5537
/2026-10-03-workflow-run-background/summary:
en: bffd445af628f905
zh: 6207efcc06c2768d
/2026-10-03-workflow-run-background/table-of-contents:
en: 6cf314a069ceb451
zh: 9adff678e9ecab3b
/2026-10-03-workflow-run-background/declaration:
en: 6907136f28e48c90
zh: 02f8298485f3d8e7
/2026-10-03-workflow-run-background/compatibility:
en: cdcfa251bd45ee28
zh: 593c290c4ee9b868
/2026-10-03-workflow-run-background/verification:
en: 0539b2ac90f058bf
zh: 6ead6a707c3b3121
/2026-10-03-workflow-run-background/dev-note:
en: b75c8458928b72b9
zh: 003ba4e17b4b5269
@@ -1,48 +0,0 @@
---
description: "Records a persistence type transition and its compatibility acknowledgement."
kind: persistence-change
---
# 2026-10-03-workflow-run-background
English | [中文](2026-10-03-workflow-run-background.zh.md)
## Summary
Adds an optional background marker to tool-workflow/run-start.
## Table of Contents
- [Declaration](#declaration)
- [Compatibility](#compatibility)
- [Verification](#verification)
- [Dev Note](#dev-note)
<a id="declaration"></a>
## Declaration
```yaml persistence-change
schemaVersion: 1
id: 2026-10-03-workflow-run-background
baseline: false
changes:
- root: "event:tool-workflow/run-start"
previous: "2026-09-11-initial"
after: "0dea366b90e202fdbb1a8d79aef14ffc6716b31000e5116309af6ae65d67cecc"
decision: same-version
```
<a id="compatibility"></a>
## Compatibility
Existing records remain valid. Writers add the marker only from this change onward: in new records, absence means a foreground run, while background runs recorded earlier also lack it and keep their interrupted presentation after the Tool Step closes. The Web workflow node uses the marker to stop inferring interruption from the closed Tool Step of a run that belongs to a background job.
<a id="verification"></a>
## Verification
pnpm exec vitest run packages/workflow/tool-workflow/tests packages/client/ui-workflow-run/tests: 70 tests passed.
<a id="dev-note"></a>
## Dev Note
None.
@@ -1,86 +0,0 @@
{
"formatVersion": 2,
"roots": [
{
"key": "event:tool-workflow/run-start",
"kind": "event",
"event": "tool-workflow/run-start",
"surface": false,
"digest": "0dea366b90e202fdbb1a8d79aef14ffc6716b31000e5116309af6ae65d67cecc",
"schema": {
"root": 0,
"nodes": [
{
"kind": "object",
"properties": [
{
"name": "data",
"type": 1,
"optional": false
},
{
"name": "ignorable",
"type": 2,
"optional": true
},
{
"name": "seq",
"type": 4,
"optional": false
},
{
"name": "time",
"type": 4,
"optional": false
},
{
"name": "type",
"type": 5,
"optional": false
}
],
"indices": []
},
{
"kind": "object",
"properties": [
{
"name": "background",
"type": 2,
"optional": true
},
{
"name": "name",
"type": 3,
"optional": false
},
{
"name": "runId",
"type": 3,
"optional": false
}
],
"indices": []
},
{
"kind": "literal",
"value": true
},
{
"kind": "primitive",
"type": "string"
},
{
"kind": "primitive",
"type": "number"
},
{
"kind": "literal",
"value": "tool-workflow/run-start"
}
]
}
}
],
"types": []
}
@@ -1,48 +0,0 @@
---
description: "记录持久化类型更改及其兼容性确认。"
kind: persistence-change
---
# 2026-10-03-workflow-run-background
[English](2026-10-03-workflow-run-background.md) | 中文
## 概述
为 tool-workflow/run-start 增加可选的后台标记。
## 目录
- [声明](#declaration)
- [兼容性](#compatibility)
- [验证](#verification)
- [开发备注](#dev-note)
<a id="declaration"></a>
## 声明
```yaml persistence-change
schemaVersion: 1
id: 2026-10-03-workflow-run-background
baseline: false
changes:
- root: "event:tool-workflow/run-start"
previous: "2026-09-11-initial"
after: "0dea366b90e202fdbb1a8d79aef14ffc6716b31000e5116309af6ae65d67cecc"
decision: same-version
```
<a id="compatibility"></a>
## 兼容性
已有记录仍然有效。写入方从本变更起才写入该标记:新记录中缺失表示前台运行;此前记录的后台运行同样缺少该标记,工具 Step 关闭后仍显示为已中断。Web 工作流节点使用该标记,不再根据已关闭的工具 Step 推断后台作业所属运行已中断。
<a id="verification"></a>
## 验证
pnpm exec vitest run packages/workflow/tool-workflow/tests packages/client/ui-workflow-run/tests:70 个测试通过。
<a id="dev-note"></a>
## 开发备注
无。