@zhuxixi/pi-agent-board 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/README.md +37 -12
- package/docs/SECTION_FOLDING.md +53 -0
- package/docs/superpowers/plans/2026-10-23-issue-222-attach-ready.md +290 -0
- package/docs/superpowers/plans/2026-10-26-issue-245-key-hints-doc-sync.md +244 -0
- package/docs/superpowers/plans/2026-10-27-issue-172-fullscreen-selection-clear.md +344 -0
- package/docs/superpowers/plans/2026-10-27-issue-252-select-key-hints.md +209 -0
- package/docs/superpowers/plans/2026-10-28-issue-255-coordinator-endpoint-zombie.md +442 -0
- package/docs/superpowers/plans/2026-10-28-issue-257-legacy-pty-runner-endpoint-cleanup.md +256 -0
- package/docs/superpowers/plans/2026-11-03-cwd-favorites-full-pool.md +266 -0
- package/docs/superpowers/plans/2026-11-03-issue-266-alt-h-detach.md +467 -0
- package/docs/superpowers/plans/2026-11-04-issue-270-scenario-stdout-flush.md +584 -0
- package/docs/superpowers/plans/2026-11-05-issue-278-ctrl-g-external-editor.md +381 -0
- package/docs/superpowers/plans/2026-11-06-issue-280-frame-witness-delivery.md +430 -0
- package/docs/superpowers/plans/2026-11-07-issue-284-attach-recovery.md +115 -0
- package/docs/superpowers/plans/2026-11-07-issue-284-u1-u2-trial-guide.md +39 -0
- package/docs/superpowers/plans/2026-11-08-host-restart-model-override.md +894 -0
- package/docs/superpowers/plans/2026-11-08-issue-288-cap-floor.md +51 -0
- package/docs/superpowers/plans/2026-11-09-dashboard-fold-flake.md +166 -0
- package/docs/superpowers/plans/2026-11-09-issue-273-harness-console-log-exit.md +369 -0
- package/docs/superpowers/plans/2026-11-10-issue-258-board-selection-settle.md +760 -0
- package/docs/superpowers/plans/2026-11-13-issue-294-snapshot-resize-intent.md +590 -0
- package/docs/superpowers/plans/2026-11-16-greeting-title-poll.md +838 -0
- package/docs/superpowers/plans/2026-11-22-issue-297-compaction-mirror.md +797 -0
- package/docs/superpowers/plans/2026-11-23-issue-254-cursor-keep-position.md +663 -0
- package/docs/superpowers/plans/2026-11-23-issue-95-legacy-quarantine.md +320 -0
- package/docs/superpowers/specs/2026-10-23-issue-222-attach-ready-design.md +204 -0
- package/docs/superpowers/specs/2026-10-26-issue-245-key-hints-doc-sync-design.md +72 -0
- package/docs/superpowers/specs/2026-10-27-issue-172-fullscreen-selection-clear-design.md +248 -0
- package/docs/superpowers/specs/2026-10-27-issue-252-select-key-hints-design.md +95 -0
- package/docs/superpowers/specs/2026-10-28-issue-255-coordinator-endpoint-zombie-design.md +380 -0
- package/docs/superpowers/specs/2026-10-28-issue-257-legacy-pty-runner-endpoint-cleanup-design.md +197 -0
- package/docs/superpowers/specs/2026-11-03-cwd-favorites-full-pool-design.md +106 -0
- package/docs/superpowers/specs/2026-11-03-issue-266-alt-h-detach-design.md +185 -0
- package/docs/superpowers/specs/2026-11-04-issue-270-scenario-stdout-flush-design.md +176 -0
- package/docs/superpowers/specs/2026-11-05-issue-278-ctrl-g-external-editor-design.md +185 -0
- package/docs/superpowers/specs/2026-11-07-issue-284-attach-recovery-design.md +166 -0
- package/docs/superpowers/specs/2026-11-08-host-restart-model-override-design.md +115 -0
- package/docs/superpowers/specs/2026-11-08-issue-288-cap-floor-design.md +86 -0
- package/docs/superpowers/specs/2026-11-09-dashboard-fold-flake-design.md +109 -0
- package/docs/superpowers/specs/2026-11-09-issue-273-harness-console-log-exit-design.md +182 -0
- package/docs/superpowers/specs/2026-11-10-issue-258-board-selection-settle-design.md +109 -0
- package/docs/superpowers/specs/2026-11-13-issue-294-snapshot-resize-intent-design.md +141 -0
- package/docs/superpowers/specs/2026-11-16-greeting-title-poll-design.md +174 -0
- package/docs/superpowers/specs/2026-11-22-issue-297-compaction-mirror-design.md +158 -0
- package/docs/superpowers/specs/2026-11-22-issue-95-legacy-quarantine-design.md +209 -0
- package/docs/superpowers/specs/2026-11-23-issue-254-cursor-keep-position-design.md +201 -0
- package/package.json +1 -1
- package/runner/pty-runner.mjs +526 -63
- package/runner/state-coordinator.mjs +62 -5
- package/runner/title-runner.mjs +33 -24
- package/src/commands/agent-board.ts +5 -1
- package/src/core/attach-detach.mjs +27 -0
- package/src/core/attach-frame-proof.mjs +897 -0
- package/src/core/attach-frame-reporter.mjs +738 -0
- package/src/core/attach-frame-stream.mjs +266 -0
- package/src/core/attach-pr-label.mjs +12 -0
- package/src/core/attach-recovery.mjs +239 -0
- package/src/core/attach-screen-owner.mjs +55 -0
- package/src/core/attach-view-proof.mjs +709 -0
- package/src/core/auto-state.mjs +6 -1
- package/src/core/cwd-stats.mjs +3 -1
- package/src/core/dashboard-prefs.mjs +31 -0
- package/src/core/derive.mjs +8 -1
- package/src/core/events.mjs +127 -1
- package/src/core/foreground-projection-cache.mjs +1 -0
- package/src/core/frame-witness-update.mjs +35 -0
- package/src/core/fullscreen-selection.mjs +60 -0
- package/src/core/host-coordination.mjs +48 -0
- package/src/core/host-protocol.mjs +13 -2
- package/src/core/hosted-frame-witness.mjs +60 -0
- package/src/core/paths.mjs +10 -3
- package/src/core/pty-attach-render.mjs +239 -0
- package/src/core/pty-kitty-images.mjs +237 -0
- package/src/core/pty-scroll.mjs +8 -8
- package/src/core/rows.mjs +43 -7
- package/src/core/session-entries.mjs +82 -0
- package/src/core/session-launch-prefs.mjs +45 -0
- package/src/core/session-view.mjs +3 -63
- package/src/core/store.mjs +1 -0
- package/src/core/terminal-attach-client.mjs +199 -20
- package/src/core/terminal-attach-protocol.mjs +221 -7
- package/src/core/terminal-model.mjs +24 -3
- package/src/core/terminal-snapshot.mjs +10 -0
- package/src/core/title-flow.mjs +66 -0
- package/src/core/title.mjs +101 -0
- package/src/core/types.mjs +17 -0
- package/src/index.ts +85 -0
- package/src/runtime/service.mjs +87 -18
- package/src/ui/dashboard.ts +206 -49
- package/src/ui/pty-attach.ts +1472 -99
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
# Issue #280 — frame-witness 终止交付修复实施计划
|
|
2
|
+
|
|
3
|
+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
4
|
+
|
|
5
|
+
**Goal:** 修复 frame-witness 候选终止消息交付缺陷,消除协议失步根因。
|
|
6
|
+
|
|
7
|
+
**Architecture:** evaluator 暴露带绝对单调序号的决定日志;reporter 统一 drain F/A,S 保留 write 内联发出但立即 markEmitted。新增共享宿主连接 helper 处理 onUnavailable → socket.destroy。
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** Node.js ESM, node:test, 现有 pi-agent-board 测试框架。
|
|
10
|
+
|
|
11
|
+
**Spec:** `/home/elling/.github-issue-driven/zhuxixi/pi-agent-board/issue-280/spec.md` (v3, SHA-256 `d1b3afff8f3739d9b9f9e485dcbd9fa021f1183f5f5d6b2896f01383f4ba085a`)
|
|
12
|
+
|
|
13
|
+
## Global Constraints
|
|
14
|
+
|
|
15
|
+
- 不改 UI 的 2500ms cap、settle、committed view、重评
|
|
16
|
+
- 不新增 250ms 恢复预算
|
|
17
|
+
- 不做 renderer/resize/parser 重写
|
|
18
|
+
- 所有编辑路径以 `$WT` 开头:`/home/elling/.pi/agent/worktrees/issue-280-frame-witness-delivery`
|
|
19
|
+
- Tabs for indentation, English comments and commit messages
|
|
20
|
+
- Conventional commit subjects: `feat`/`fix`/`perf`/`refactor`/`docs`/`test`/`chore`
|
|
21
|
+
|
|
22
|
+
## Review Focus
|
|
23
|
+
|
|
24
|
+
1. **重复 marker 发出** — S 内联发出后未 markEmitted,drain 再次发出 → A01/A03 的 parser 串联断言
|
|
25
|
+
2. **孤立 A** — 未写出 S 的候选被取消时发送 A → A01/A02 的 #writtenFrames 门控断言
|
|
26
|
+
3. **时序丢失** — setMode/dispose 的 drain 在 evaluator 替换/state 翻转之后 → A02 的 resample/mode-change/dispose 断言
|
|
27
|
+
4. **跨 write 控制序列截断** — A 插入半个 CSI/OSC 中 → A03 的跨 write 撕裂序列断言
|
|
28
|
+
5. **能力假存活** — reporter failed 但 runner 仍 enabled:true → A04/A05 的 onUnavailable→socket.destroy→enabled:false 断言
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Task 1: evaluator 消费记账机制
|
|
33
|
+
|
|
34
|
+
**Files:**
|
|
35
|
+
- Modify: `$WT/src/core/attach-frame-proof.mjs` (FrameCandidateEvaluator)
|
|
36
|
+
- Test: `$WT/test/attach-frame-proof.test.mjs`
|
|
37
|
+
|
|
38
|
+
**Interfaces:**
|
|
39
|
+
- Produces: `collectTerminalDecisions()` → `Array<{seq, kind, frameId, reason?, ...}>`, `markEmitted(seq)` → void
|
|
40
|
+
- Consumes: 现有 `decisions` getter、`#push()` 内部方法
|
|
41
|
+
|
|
42
|
+
- [ ] **Step 1: 写失败测试**
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
test("collectTerminalDecisions returns decisions after lastCollectedSeq", () => {
|
|
46
|
+
const e = new FrameCandidateEvaluator({ mode: "fullscreen" });
|
|
47
|
+
// Trigger a size pair to create a candidate
|
|
48
|
+
e.sizeRead("columns", 80);
|
|
49
|
+
e.sizeRead("rows", 24);
|
|
50
|
+
const decisions = e.collectTerminalDecisions();
|
|
51
|
+
assert(decisions.length > 0);
|
|
52
|
+
assert(decisions.every(d => typeof d.seq === "number"));
|
|
53
|
+
// Second collect returns empty (already collected)
|
|
54
|
+
assert.deepEqual(e.collectTerminalDecisions(), []);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("markEmitted prevents re-collection", () => {
|
|
58
|
+
const e = new FrameCandidateEvaluator({ mode: "fullscreen" });
|
|
59
|
+
e.sizeRead("columns", 80);
|
|
60
|
+
e.sizeRead("rows", 24);
|
|
61
|
+
const decisions = e.collectTerminalDecisions();
|
|
62
|
+
const firstSeq = decisions[0].seq;
|
|
63
|
+
e.markEmitted(firstSeq);
|
|
64
|
+
// Even if we collect again, the marked decision is excluded
|
|
65
|
+
const again = e.collectTerminalDecisions();
|
|
66
|
+
assert(!again.some(d => d.seq === firstSeq));
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- [ ] **Step 2: 运行测试确认失败**
|
|
71
|
+
|
|
72
|
+
Run: `cd $WT && node --test test/attach-frame-proof.test.mjs -v`
|
|
73
|
+
Expected: FAIL — `collectTerminalDecisions is not a function`
|
|
74
|
+
|
|
75
|
+
- [ ] **Step 3: 实现 evaluator 消费记账**
|
|
76
|
+
|
|
77
|
+
在 `FrameCandidateEvaluator` 中新增:
|
|
78
|
+
```javascript
|
|
79
|
+
#lastCollectedSeq = 0;
|
|
80
|
+
#nextSeq = 0;
|
|
81
|
+
|
|
82
|
+
#push(decision) {
|
|
83
|
+
// 现有逻辑 + 分配绝对单调序号
|
|
84
|
+
decision.seq = ++this.#nextSeq;
|
|
85
|
+
this.#decisions.push(decision);
|
|
86
|
+
// ... existing MAX_DECISION_LOG splice ...
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
collectTerminalDecisions() {
|
|
90
|
+
const result = this.#decisions.filter(d => d.seq > this.#lastCollectedSeq);
|
|
91
|
+
if (result.length > 0) {
|
|
92
|
+
this.#lastCollectedSeq = Math.max(...result.map(d => d.seq));
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
markEmitted(seq) {
|
|
98
|
+
// 标记为已消费:从 decisions 中移除或标记为已发出
|
|
99
|
+
const idx = this.#decisions.findIndex(d => d.seq === seq);
|
|
100
|
+
if (idx >= 0) this.#decisions[idx].emitted = true;
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- [ ] **Step 4: 运行测试确认通过**
|
|
105
|
+
|
|
106
|
+
Run: `cd $WT && node --test test/attach-frame-proof.test.mjs -v`
|
|
107
|
+
Expected: PASS
|
|
108
|
+
|
|
109
|
+
- [ ] **Step 5: Commit**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
cd $WT && git add src/core/attach-frame-proof.mjs test/attach-frame-proof.test.mjs
|
|
113
|
+
git commit -m "feat: add collectTerminalDecisions and markEmitted to evaluator (#280)"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Task 2: reporter 统一 drain 路径
|
|
119
|
+
|
|
120
|
+
**Files:**
|
|
121
|
+
- Modify: `$WT/src/core/attach-frame-reporter.mjs` (AttachFrameReporter)
|
|
122
|
+
- Test: `$WT/test/attach-frame-reporter.test.mjs`
|
|
123
|
+
|
|
124
|
+
**Interfaces:**
|
|
125
|
+
- Consumes: `evaluator.collectTerminalDecisions()`, `evaluator.markEmitted(seq)`
|
|
126
|
+
- Produces: `#drainTerminalDecisions()`, `#writtenFrames` Set
|
|
127
|
+
|
|
128
|
+
- [ ] **Step 1: 写失败测试**
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
test("drainTerminalDecisions emits A for written frames only", () => {
|
|
132
|
+
const { reporter, terminal, written, renderPass } = enabledReporter();
|
|
133
|
+
renderPass(); // opens candidate
|
|
134
|
+
terminal.write(FULL); // writes S + F inline, S is marked emitted
|
|
135
|
+
// Now trigger an abort via applyIntent
|
|
136
|
+
reporter.applyIntent({ type: "frame_witness_intent", instanceId: "test", requestId: "fw-1", geometryRevision: 1, cols: 80, rows: 24 });
|
|
137
|
+
// The old candidate should be aborted and A emitted via drain
|
|
138
|
+
const markers = written.map(decodeFrameMarker).filter(Boolean);
|
|
139
|
+
assert(markers.some(m => m.kind === "A"));
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
- [ ] **Step 2: 运行测试确认失败**
|
|
144
|
+
|
|
145
|
+
Run: `cd $WT && node --test test/attach-frame-reporter.test.mjs -v`
|
|
146
|
+
Expected: FAIL — A not emitted after applyIntent
|
|
147
|
+
|
|
148
|
+
- [ ] **Step 3: 实现 reporter drain**
|
|
149
|
+
|
|
150
|
+
在 `AttachFrameReporter` 中新增:
|
|
151
|
+
```javascript
|
|
152
|
+
#writtenFrames = new Set(); // frameId where S was successfully written
|
|
153
|
+
|
|
154
|
+
#drainTerminalDecisions() {
|
|
155
|
+
const decisions = this.#evaluator.collectTerminalDecisions();
|
|
156
|
+
for (const decision of decisions) {
|
|
157
|
+
if (decision.kind === "S") {
|
|
158
|
+
throw new Error("S decision in drain: programming error");
|
|
159
|
+
} else if (decision.kind === "F") {
|
|
160
|
+
this.#emitF(decision);
|
|
161
|
+
} else if (decision.kind === "A") {
|
|
162
|
+
if (this.#writtenFrames.has(decision.frameId)) {
|
|
163
|
+
this.#emitA(decision.frameId, decision.reason);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
修改 `#emitS`:成功写出后调用 `this.#evaluator.markEmitted(decision.seq)` 并 `this.#writtenFrames.add(frameId)`。
|
|
171
|
+
|
|
172
|
+
修改 `write-failed` 路径:不再内联 `#emitA`,改为只记录决定,由 drain 发出。
|
|
173
|
+
|
|
174
|
+
修改 `finishWrite` 路径:不再内联 `#emitF`/`#emitA`,改为只记录决定,由 drain 发出。
|
|
175
|
+
|
|
176
|
+
- [ ] **Step 4: 运行测试确认通过**
|
|
177
|
+
|
|
178
|
+
Run: `cd $WT && node --test test/attach-frame-reporter.test.mjs -v`
|
|
179
|
+
Expected: PASS
|
|
180
|
+
|
|
181
|
+
- [ ] **Step 5: Commit**
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
cd $WT && git add src/core/attach-frame-reporter.mjs test/attach-frame-reporter.test.mjs
|
|
185
|
+
git commit -m "feat: unify F/A delivery through drainTerminalDecisions (#280)"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Task 3: 覆盖所有取消路径
|
|
191
|
+
|
|
192
|
+
**Files:**
|
|
193
|
+
- Modify: `$WT/src/core/attach-frame-reporter.mjs` (applyIntent, sizeRead, setMode, terminal-start/stop, sentinel dispose, dispose)
|
|
194
|
+
- Test: `$WT/test/attach-frame-reporter.test.mjs`
|
|
195
|
+
|
|
196
|
+
**Interfaces:**
|
|
197
|
+
- Consumes: `#drainTerminalDecisions()`
|
|
198
|
+
- Produces: 所有取消路径都调用 drain
|
|
199
|
+
|
|
200
|
+
- [ ] **Step 1: 写失败测试**
|
|
201
|
+
|
|
202
|
+
```javascript
|
|
203
|
+
test("sizeRead resample aborts previous candidate via drain", () => {
|
|
204
|
+
const { reporter, terminal, written, renderPass } = enabledReporter();
|
|
205
|
+
renderPass();
|
|
206
|
+
terminal.write(FULL);
|
|
207
|
+
// Trigger resample via size read
|
|
208
|
+
terminal.columns; // triggers sizeRead
|
|
209
|
+
terminal.rows; // triggers sizeRead -> resample abort
|
|
210
|
+
// New candidate opens
|
|
211
|
+
renderPass();
|
|
212
|
+
terminal.write(FULL);
|
|
213
|
+
const markers = written.map(decodeFrameMarker).filter(Boolean);
|
|
214
|
+
// Should have S(1), A(1), S(2), F(2) in order
|
|
215
|
+
const kinds = markers.map(m => m.kind);
|
|
216
|
+
assert.deepEqual(kinds, ["S", "F", "A", "S", "F"]);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
test("setMode mode-changed aborts via drain before evaluator replacement", () => {
|
|
220
|
+
const { reporter, terminal, written, renderPass, tui } = enabledReporter();
|
|
221
|
+
renderPass();
|
|
222
|
+
terminal.write(FULL);
|
|
223
|
+
// Change mode via sentinel
|
|
224
|
+
tui.mode = "regular";
|
|
225
|
+
renderPass(); // triggers setMode
|
|
226
|
+
const markers = written.map(decodeFrameMarker).filter(Boolean);
|
|
227
|
+
assert(markers.some(m => m.kind === "A" && m.reason === "mode-changed"));
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
- [ ] **Step 2: 运行测试确认失败**
|
|
232
|
+
|
|
233
|
+
Run: `cd $WT && node --test test/attach-frame-reporter.test.mjs -v`
|
|
234
|
+
Expected: FAIL — A not emitted for resample/mode-change
|
|
235
|
+
|
|
236
|
+
- [ ] **Step 3: 在所有取消路径调用 drain**
|
|
237
|
+
|
|
238
|
+
修改以下方法,在适当位置调用 `#drainTerminalDecisions()`:
|
|
239
|
+
|
|
240
|
+
1. `applyIntent()` — 在 `setIntent()` 后调用
|
|
241
|
+
2. `sizeRead()` — 在 size pair 完成后调用(通过 getter 或显式调用)
|
|
242
|
+
3. `setMode()` — 在替换 evaluator **之前**对旧实例调用 drain
|
|
243
|
+
4. `terminal-start`/`terminal-stop` wrapper — 在 `abort()` 后、恢复原方法前调用
|
|
244
|
+
5. `sentinel dispose()` — 在 `abort()` 后、恢复 shadows 前调用
|
|
245
|
+
6. `dispose()` — 在 `stop()` 后、state 翻为 disposed **之前**调用
|
|
246
|
+
|
|
247
|
+
- [ ] **Step 4: 运行测试确认通过**
|
|
248
|
+
|
|
249
|
+
Run: `cd $WT && node --test test/attach-frame-reporter.test.mjs -v`
|
|
250
|
+
Expected: PASS
|
|
251
|
+
|
|
252
|
+
- [ ] **Step 5: Commit**
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
cd $WT && git add src/core/attach-frame-reporter.mjs test/attach-frame-reporter.test.mjs
|
|
256
|
+
git commit -m "fix: cover all cancellation paths with drainTerminalDecisions (#280)"
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Task 4: onUnavailable 失效撤销
|
|
262
|
+
|
|
263
|
+
**Files:**
|
|
264
|
+
- Modify: `$WT/src/core/attach-frame-reporter.mjs` (constructor, #failCapability)
|
|
265
|
+
- Create: `$WT/src/core/hosted-frame-witness.mjs` (shared helper)
|
|
266
|
+
- Modify: `$WT/src/index.ts` (startHostedFrameWitness)
|
|
267
|
+
- Test: `$WT/test/attach-frame-reporter.test.mjs`
|
|
268
|
+
|
|
269
|
+
**Interfaces:**
|
|
270
|
+
- Consumes: `#drainTerminalDecisions()`
|
|
271
|
+
- Produces: `onUnavailable` 回调、共享 helper
|
|
272
|
+
|
|
273
|
+
- [ ] **Step 1: 写失败测试**
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
test("onUnavailable is called on marker failure", () => {
|
|
277
|
+
const onUnavailable = mock.fn();
|
|
278
|
+
const { reporter, terminal, written, renderPass } = enabledReporter({ onUnavailable });
|
|
279
|
+
renderPass();
|
|
280
|
+
// Trigger marker failure
|
|
281
|
+
terminal.write(FULL); // this will fail on marker write
|
|
282
|
+
assert.equal(reporter.state, "failed");
|
|
283
|
+
assert.equal(onUnavailable.mock.calls.length, 1);
|
|
284
|
+
});
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
- [ ] **Step 2: 运行测试确认失败**
|
|
288
|
+
|
|
289
|
+
Run: `cd $WT && node --test test/attach-frame-reporter.test.mjs -v`
|
|
290
|
+
Expected: FAIL — onUnavailable not called
|
|
291
|
+
|
|
292
|
+
- [ ] **Step 3: 实现 onUnavailable**
|
|
293
|
+
|
|
294
|
+
修改 `AttachFrameReporter` constructor:
|
|
295
|
+
```javascript
|
|
296
|
+
constructor({ ui, send, mode, sessionEpoch, onUnavailable = () => {}, ... }) {
|
|
297
|
+
// ...
|
|
298
|
+
this.#onUnavailable = onUnavailable;
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
修改 `#failCapability`:
|
|
303
|
+
```javascript
|
|
304
|
+
#failCapability(reason) {
|
|
305
|
+
this.#state = "failed";
|
|
306
|
+
this.#onUnavailable(reason);
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
创建 `$WT/src/core/hosted-frame-witness.mjs`:
|
|
311
|
+
```javascript
|
|
312
|
+
// Shared helper for hosted frame witness socket/reporter management
|
|
313
|
+
export function createHostedFrameWitness({ ctx, root, hostedViewId, hostedSessionEpoch, onUnavailable }) {
|
|
314
|
+
// socket/reporter 所有权、协商、幂等清理、onUnavailable → socket.destroy 绑定
|
|
315
|
+
// ...
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
修改 `src/index.ts:startHostedFrameWitness()` 使用共享 helper。
|
|
320
|
+
|
|
321
|
+
- [ ] **Step 4: 运行测试确认通过**
|
|
322
|
+
|
|
323
|
+
Run: `cd $WT && node --test test/attach-frame-reporter.test.mjs -v`
|
|
324
|
+
Expected: PASS
|
|
325
|
+
|
|
326
|
+
- [ ] **Step 5: Commit**
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
cd $WT && git add src/core/attach-frame-reporter.mjs src/core/hosted-frame-witness.mjs src/index.ts test/attach-frame-reporter.test.mjs
|
|
330
|
+
git commit -m "feat: add onUnavailable callback and shared hosted-frame-witness helper (#280)"
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Task 5: A04/A05 集成测试
|
|
336
|
+
|
|
337
|
+
**Files:**
|
|
338
|
+
- Create: `$WT/test-support/attach-frame-failure-child.mjs`
|
|
339
|
+
- Modify: `$WT/test/attach-frame-witness.integration.test.mjs`
|
|
340
|
+
|
|
341
|
+
**Interfaces:**
|
|
342
|
+
- Consumes: 共享 helper、真实 runner harness
|
|
343
|
+
- Produces: A04/A05 验收
|
|
344
|
+
|
|
345
|
+
- [ ] **Step 1: 写失败测试**
|
|
346
|
+
|
|
347
|
+
在 `test/attach-frame-witness.integration.test.mjs` 中新增:
|
|
348
|
+
```javascript
|
|
349
|
+
test("internal marker failure revokes capability via onUnavailable", async (t) => {
|
|
350
|
+
// 使用现有 harness,加载 attach-frame-failure-child.mjs
|
|
351
|
+
// 验证:marker 失败 → onUnavailable → socket.destroy → runner enabled=false
|
|
352
|
+
// 两种 main 都要跑
|
|
353
|
+
});
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
- [ ] **Step 2: 运行测试确认失败**
|
|
357
|
+
|
|
358
|
+
Run: `cd $WT && node --test test/attach-frame-witness.integration.test.mjs -v`
|
|
359
|
+
Expected: FAIL — new test fails
|
|
360
|
+
|
|
361
|
+
- [ ] **Step 3: 创建 child fixture**
|
|
362
|
+
|
|
363
|
+
创建 `$WT/test-support/attach-frame-failure-child.mjs`:
|
|
364
|
+
```javascript
|
|
365
|
+
// 真实 child 中使用共享 helper 和 FakeTerminal
|
|
366
|
+
// 注入 marker 写入失败,验证 onUnavailable → socket.destroy → runner cleanup
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
- [ ] **Step 4: 运行测试确认通过**
|
|
370
|
+
|
|
371
|
+
Run: `cd $WT && node --test test/attach-frame-witness.integration.test.mjs -v`
|
|
372
|
+
Expected: PASS
|
|
373
|
+
|
|
374
|
+
- [ ] **Step 5: Commit**
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
cd $WT && git add test-support/attach-frame-failure-child.mjs test/attach-frame-witness.integration.test.mjs
|
|
378
|
+
git commit -m "test: add integration tests for internal failure revocation (#280)"
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## Task 6: 全套验收
|
|
384
|
+
|
|
385
|
+
**Files:**
|
|
386
|
+
- 所有修改文件
|
|
387
|
+
|
|
388
|
+
- [ ] **Step 1: 运行定向测试**
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
cd $WT && node --test test/attach-frame-proof.test.mjs test/attach-frame-reporter.test.mjs test/attach-frame-stream.test.mjs
|
|
392
|
+
cd $WT && node --test test/attach-frame-witness.integration.test.mjs
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
- [ ] **Step 2: 运行全套验证**
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
cd $WT && npm run verify
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
- [ ] **Step 3: 确认全部通过**
|
|
402
|
+
|
|
403
|
+
Expected: typecheck、perf gate、tests、coverage、pack:dry 全部通过
|
|
404
|
+
|
|
405
|
+
- [ ] **Step 4: 本地 CR**
|
|
406
|
+
|
|
407
|
+
使用 `requesting-code-review` 或 `workflow` 的 `code-review` 模式做本地快速 CR。
|
|
408
|
+
|
|
409
|
+
- [ ] **Step 5: 最终 commit**
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
cd $WT && git add -A
|
|
413
|
+
git commit -m "fix: frame-witness candidate termination delivery (#280)"
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
## 验收追踪
|
|
419
|
+
|
|
420
|
+
| Spec ID | 实施 Task | 验证方式 |
|
|
421
|
+
|---------|----------|----------|
|
|
422
|
+
| A01 | Task 1, 2, 3 | 单元测试 + parser 串联 |
|
|
423
|
+
| A02 | Task 3 | 单元测试(stop/rearm/dispose/resample/mode-change) |
|
|
424
|
+
| A03 | Task 2, 3 | 单元测试(跨 write、重入、原 write throw) |
|
|
425
|
+
| A04 | Task 4, 5 | 集成测试(真实 runner + child fixture) |
|
|
426
|
+
| A05 | Task 4, 5 | 集成测试(重复清理、split marker) |
|
|
427
|
+
|
|
428
|
+
## 与 #267 的关系
|
|
429
|
+
|
|
430
|
+
本计划是 #267 路径 A 的实施。完整设计见 #267 spec v4;本计划只实施 D1/D2(A01–A05),UI 改动留待后续 issue。
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Implementation Plan — Issue #284: attach UI 恢复预算与安全重评
|
|
2
|
+
|
|
3
|
+
Work from: /home/elling/work/git-repo/pi-agent-board/.pi/worktrees/issue-284-attach-recovery-budget
|
|
4
|
+
Spec: docs/superpowers/specs/2026-11-07-issue-284-attach-recovery-design.md(v4-final, SHA-256 90a72c27…)
|
|
5
|
+
Base: main @ 6f7b2dc · branch issue-284-attach-recovery-budget
|
|
6
|
+
Conventions: tabs for indentation; node:test + assert/strict; conventional commits; TDD (red → green per task); never `git add -A`.
|
|
7
|
+
|
|
8
|
+
## 验收 ID ↔ Task 双向追溯
|
|
9
|
+
|
|
10
|
+
| 验收 ID | Tasks |
|
|
11
|
+
|---|---|
|
|
12
|
+
| A06(策略 unit) | T1(归纳表)、T2(谓词链) |
|
|
13
|
+
| A07(组件行为/预算) | T3(harness 骨架)、T4(预算 timer/fence) |
|
|
14
|
+
| A08(组件反例/锁存/sticky) | T5(锁存)、T6(装配与 wiring)、T3–T6 共用 harness |
|
|
15
|
+
| A09(geometry) | T8(integration 扩充) |
|
|
16
|
+
| A10(生命周期) | T4、T5 |
|
|
17
|
+
| A11(端到端/诊断) | T7(readyReason/诊断)、T8 |
|
|
18
|
+
| A12(verify 总量) | T9 |
|
|
19
|
+
| U1/U2(用户实测) | T10(试点准备,post-implementation pending) |
|
|
20
|
+
|
|
21
|
+
## T1 — `classifyProofStatus` 纯函数(A06:3.1.1 归纳表)
|
|
22
|
+
|
|
23
|
+
**Files**: new `src/core/attach-recovery.mjs`;new `test/attach-recovery.test.mjs`
|
|
24
|
+
**Steps**:
|
|
25
|
+
1. RED: `test/attach-recovery.test.mjs` 按 spec §3.1.1 逐行写断言——14 行基础表(unavailable/unknown 双形状 candidate-*、no-proof、no-output、trailing-*、output-gap 系、校验失败系、UI invalidateViewProof 系、未识别值);sticky 优先规则(sticky=true 时除 covered 外全部 invalid:含 live S/A、no-proof、null、未识别);null×sticky 两态;covered 清除 sticky。
|
|
26
|
+
2. GREEN: 实现 `classifyProofStatus(viewProof, stickyInvalid)`——签名 `(latestViewProof: object|null, stickyInvalid: boolean) => "none"|"missing"|"invalid"|"covered"`;sticky 优先判断在最前(除 `status==="covered"` 外一律 invalid);reason 匹配用精确字符串表,任何未命中 → invalid(fail-closed)。
|
|
27
|
+
3. 导出 JSDoc(枚举来源锚定 attach-view-proof.mjs coverageFor 与 terminal-attach-client.mjs 校验 reason)。
|
|
28
|
+
**Verify**: `node --test test/attach-recovery.test.mjs`
|
|
29
|
+
**Refs**: A06(归纳表部分)
|
|
30
|
+
|
|
31
|
+
## T2 — `decideAttachPresentation` 降级链扩展(A06:谓词链)
|
|
32
|
+
|
|
33
|
+
**Files**: `src/core/pty-attach-render.mjs`;`test/attach-recovery.test.mjs`
|
|
34
|
+
**Steps**:
|
|
35
|
+
1. RED: 断言七条谓词各自反例(witnessLatched=false / baselineState 非 valid-content / frameState 非 complete 或 openSyncBlock / committedViewValid=false / 尺寸不匹配或 resizeIntentRequired / proofStatus=invalid / budgetElapsed=false / committedContentKind∈{boot,raw,partial,unknown})→ 各自 wait 且 reason 命名谓词;candidate-open/aborted 双形状(经 proofStatus=missing)正向 → `publish-degraded/"committed-degraded"`;F 路径全过 → `publish/"complete"` 不等预算;proofStatus=covered 但其他门禁不满足 → wait 不降级;A/unavailable 不变为 covered(covered 只来自真实 F);I1 独立断言(策略不写 proof——纯函数无副作用,断言返回值不含改写指令)。
|
|
36
|
+
2. GREEN: 新增输入 `witnessLatched/committedViewValid/committedViewSource/committedViewCols/Rows/committedContentKind/proofStatus/budgetElapsed`;在既有 F 链后加降级链;新 action `publish-degraded`;wait reason 沿用谓词命名。既有 F 路径行为与既有测试(`test/pty-attach-render-decision.test.mjs`)不变。
|
|
37
|
+
**Verify**: `node --test test/attach-recovery.test.mjs test/pty-attach-render-decision.test.mjs`
|
|
38
|
+
**Refs**: A06(谓词部分)
|
|
39
|
+
|
|
40
|
+
## T3 — 组件 harness 骨架(A07/A08/A10 测试载体)
|
|
41
|
+
|
|
42
|
+
**Files**: new `test-support/attach-recovery-scenario.ts`;new `test/attach-recovery-component.test.mjs`
|
|
43
|
+
**Steps**:
|
|
44
|
+
1. 参照 `test-support/pty-attach-parser-replacement-scenario.ts` 的 `--experimental-transform-types` 子进程模式:真实 xterm headless + PtyAttachComponent 私有状态驱动 + **注入 now()/scheduler**(构造器新接缝按 T4 落地,此处先定义协议:scenario 通过工厂参数传入 fake clock 与 timer 队列)。
|
|
45
|
+
2. scenario 提供事件原语:connect/hello/snapshotReady(含 viewProof 形状参数:unavailable/unknown 双形状)、output chunk(seq 递增)、S/A/F record(真实 `viewProofRecord` 路径)、capability enable/disable(enabled:true/false)、geometry、reconnect(connectionToken 递增 + startAttachSettle 重入)、advanceClock(ms)(推进 fake timer 队列)。
|
|
46
|
+
3. RED→GREEN: harness 冒烟用例——注入 clock 下 legacy settle 行为不变(对照基线);`npm test` 能枚举新文件(run-tests.mjs 自动发现)。
|
|
47
|
+
**Verify**: `node --test test/attach-recovery-component.test.mjs`;`npm test` 枚举确认
|
|
48
|
+
**Refs**: A07/A08/A10(载体)
|
|
49
|
+
|
|
50
|
+
## T4 — 预算 timer、独立 fence、注入接缝(A07 预算生命周期 + A10)
|
|
51
|
+
|
|
52
|
+
**Files**: `src/ui/pty-attach.ts`;`test/attach-recovery-component.test.mjs`
|
|
53
|
+
**Steps**:
|
|
54
|
+
1. 组件构造器增加可注入 `now()`(默认 Date.now)与 scheduler(默认全局 setTimeout/clearTimeout);`ATTACH_RECOVERY_BUDGET_MS = 250` 常量。
|
|
55
|
+
2. attach 首次启动时 arm 预算一次(按 attachStartedAt remaining);**独立 fence**:回调只校验 `attaching && !closed && budgetArmed`,不用 attachWaitToken;`finishAttachTransition`/detach/dispose 清理;重连/`startAttachSettle` 重入不重 arm 不延长。
|
|
56
|
+
3. RED→GREEN(harness,注入 clock): quiet 场景 249ms 不发布、250ms 到期回调置 budgetElapsed 并 evaluateAttachReady → committed-degraded 发布;t<250ms 重连后预算仍在原 deadline 到期(不延长);重连后旧连接回调不能发布(I3 身份防栏)。每 25ms 完整帧持续输出不重置预算、预算后下一 sync close 发布最近已提交帧;预算后才提交快照 → commitCommittedView 钩子立即重评。
|
|
57
|
+
**Verify**: `node --test test/attach-recovery-component.test.mjs`
|
|
58
|
+
**Refs**: A07(预算生命周期全部)、A10(armed-once、清理)
|
|
59
|
+
|
|
60
|
+
## T5 — witnessLatched 与三层失效(A08/A10:锁存层)
|
|
61
|
+
|
|
62
|
+
**Files**: `src/ui/pty-attach.ts`;`test/attach-recovery-component.test.mjs`
|
|
63
|
+
**Steps**:
|
|
64
|
+
1. `witnessLatched`:本次 attach 首次 `frameWitnessAvailable=true` 置位;已锁存时 capability loss(enabled:false)**不**调 `restoreLegacyDeadlines()`、不清锁存、不清 `deadlineState` 语义(committed 路径继续);未锁存(legacy/无 witness)行为完全不变。
|
|
65
|
+
2. 三层失效:同组件 reconnect 保留锁存、旧 view/proof 失效需新快照;resnapshot/reset/baseline 更换只失效旧 view/proof(凭新身份重建)不清锁存;detach/dispose 清理。
|
|
66
|
+
3. RED→GREEN: loss 后仍 committed 路径;loss → resnapshot → 新身份快照/合法闭合帧 → 继续 committed 更新(成对);loss 后无闭合帧保留旧提交(成对);reconnect 保留锁存(A10);legacy 分支不受锁存影响;降级后 selection/copy 与显示来源一致、childInputReady 不被提前放行、首次副作用至多一次。
|
|
67
|
+
**Verify**: `node --test test/attach-recovery-component.test.mjs`
|
|
68
|
+
**Refs**: A08(锁存序列)、A10(同组件重连)
|
|
69
|
+
|
|
70
|
+
## T6 — proofStatus/sticky/committedContentKind 装配与 evaluateAttachReady wiring(A08:失败事实层 + 汇合点)
|
|
71
|
+
|
|
72
|
+
**Files**: `src/ui/pty-attach.ts`;`test/attach-recovery-component.test.mjs`
|
|
73
|
+
**Steps**:
|
|
74
|
+
1. `proofInvalidatedThisBaseline` sticky 事实:classifyProofStatus 结果为 invalid 时置位(绑当前 baseline/视图身份);清除仅凭当前 baseline covered 或 baseline 身份更换。capability loss 置空 latestViewProof 不清除。
|
|
75
|
+
2. `commitCommittedView` 记录 `source`("snapshot" | "sync-close")与来源尺寸(committedViewCols/Rows);`committedContentKind` 装配:校验完整非空快照或本地完整解析闭合 → "complete",否则 "unknown"(不产出 boot/raw/partial)。
|
|
76
|
+
3. `evaluateAttachReady` 装配新输入(witnessLatched/committedViewValid/source/尺寸/committedContentKind/proofStatus/classify 结果/budgetElapsed)并调扩展后策略;**删除 `handleAttachHardTimeout` 的 idle-downgrade 特判块**(cap 只置 deadlineState=expired 诊断后 evaluateAttachReady);`commitCommittedView` 成功后的重评钩子。
|
|
77
|
+
4. RED→GREEN: 同 baseline invalid→live S/A 到达、invalid→no-proof 到达、invalid→loss(null)三种清洗反例均不发布(预算与 cap 都到也不发);随后 covered 或 baseline 更换才恢复;empty/占位 baseline → wait;covered 又失效不绕过;producer 未完但合成 snapshot 闭合 → 只 committed-degraded 非 proof-ready,后续完成可更新。
|
|
78
|
+
**Verify**: `node --test test/attach-recovery.test.mjs test/attach-recovery-component.test.mjs`
|
|
79
|
+
**Refs**: A08(sticky/装配/反例)
|
|
80
|
+
|
|
81
|
+
## T7 — readyReason 与诊断扩充(A11 诊断部分)
|
|
82
|
+
|
|
83
|
+
**Files**: `src/ui/pty-attach.ts`;`test/attach-recovery-component.test.mjs`
|
|
84
|
+
**Steps**:
|
|
85
|
+
1. `finishAttachTransition` 增加来源参数;`readyReason: complete|committed-degraded|legacy-settle|legacy-cap` 记录;`notReadyReason` 语义不变。
|
|
86
|
+
2. 诊断记录新增 `budgetDeadline`、`readyReason`、`witnessLatched`、committedView 身份/实际尺寸/来源、proofStatus 与 sticky-invalid(只记数值与有限枚举)。
|
|
87
|
+
3. RED→GREEN: 各 readyReason 值在对应路径记录正确(F 路径 complete、降级 committed-degraded、legacy 两分支);诊断不含 token/屏幕文本/密钥。
|
|
88
|
+
**Verify**: `node --test test/attach-recovery-component.test.mjs`
|
|
89
|
+
**Refs**: A11(诊断)、D5
|
|
90
|
+
|
|
91
|
+
## T8 — 集成:A09 geometry + A11 端到端 + 改写 legacy-cap 用例
|
|
92
|
+
|
|
93
|
+
**Files**: `test/attach-frame-witness.integration.test.mjs`;`test-support/attach-idle-socket-driver.ts`;`test/attach-recovery-component.test.mjs`(A09 组件侧)
|
|
94
|
+
**Steps**:
|
|
95
|
+
1. **改写** `:306`「S-then-idle … at the legacy cap」为预算断言:真实双 main、受控 S 后 quiet(真实 coverage 即 live unknown+candidate-open)→ 首屏 <1500ms(外部 wall-clock settledMs,不注入时钟不放宽容差;flaky 靠确定性等待条件 poll 至 settle)、readyReason=committed-degraded、断言未等 2500ms(hard timeout 未触发即已 settle);healthy F 用例在预算前完成且 readyReason=complete。至少一条经真实 viewProofRecord S 驱动。
|
|
96
|
+
2. 扩充 `attach-idle-socket-driver.ts`:记录各层状态、时间与 readyReason;持续完整帧无 F 场景(预算后下一闭合帧发布)。
|
|
97
|
+
3. A09:same-size 零 resize/新 intent;错尺寸/错 intent/revision 的 F、A、loss、全部 timer 不解除 gate;真实 target F 才解除;源快照旧尺寸而 identity 已标当前 target 的反例不发布。
|
|
98
|
+
4. empty/错代/解析未完等既有反例**保留**(按新语义核对断言文案)。
|
|
99
|
+
**Verify**: `node --test test/attach-frame-witness.integration.test.mjs test/pty-attach-parser-replacement.test.mjs test/attach-recovery-component.test.mjs`
|
|
100
|
+
**Refs**: A09、A11(全部)
|
|
101
|
+
|
|
102
|
+
## T9 — 回归总量(A12)
|
|
103
|
+
|
|
104
|
+
**Steps**: 在 worktree 执行 `npm run verify`(typecheck、perf gate、tests、coverage lines85/funcs80/branches70、pack:dry);检查 legacy 无 witness/无协议、observer 不支持、no-resize、host/runner generation、leaked coordinators 既有断言仍在;#227 Kitty 回归与 #275 快速路径不回归;`attach-entry-22.test.mjs`(忙场景)确认不受影响(如受影响按 spec §6 原则改写并在 PR 说明)。
|
|
105
|
+
**Verify**: `npm run verify` 全绿
|
|
106
|
+
**Refs**: A12
|
|
107
|
+
|
|
108
|
+
## T10 — U1/U2 试点准备(post-implementation,pending)
|
|
109
|
+
|
|
110
|
+
**Steps**: 产出试点脚本/说明(worktree 绝对路径 extensionEntry/runner、隔离 PI_CODING_AGENT_DIR/board root/socket、三类样本采集:新建首次 attach / 同尺寸 reattach / 不同尺寸首次 attach,≥10+10 样本、P50/P95、readyReason 分布);U1/U2 标记 **pending** 直至用户执行——自动化绿灯与 U1/U2 互不替代。
|
|
111
|
+
**Refs**: U1、U2
|
|
112
|
+
|
|
113
|
+
## Task 顺序与提交粒度
|
|
114
|
+
|
|
115
|
+
T1 → T2 →(T3 → T4 → T5 → T6 → T7 组件线,其中 T3 先行)→ T8 → T9 → T10。每 task 一个 conventional commit(`test:`/`feat:`/`fix:` 前缀 + `(#284)` 尾缀留待 PR squash 前统一处理——按仓例 commit message 不带 issue 号,PR 标题带)。中途 `git status --short` 检查无意外文件;只 `git add <明确文件>`。
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Issue #284 — U1/U2 用户实测试点指南(post-implementation,状态:pending)
|
|
2
|
+
|
|
3
|
+
自动化验收(A06–A12)已全绿;U1/U2 是**用户实测项**,与自动化绿灯互不替代(spec §5/§6)。执行时机:任何时刻(本 worktree 的 `npm run verify` 已全过;PR 合并非前置)。未执行前,U1/U2 报告状态保持 pending。
|
|
4
|
+
|
|
5
|
+
## 隔离拓扑(防误用全局安装)
|
|
6
|
+
|
|
7
|
+
所有路径固定到本 worktree(SHA 以实际执行时 `git -C <worktree> rev-parse HEAD` 打印为准):
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
WT=/home/elling/work/git-repo/pi-agent-board/.pi/worktrees/issue-284-attach-recovery-budget
|
|
11
|
+
ENTRY="$WT/index.ts" # extensionEntry(绝对路径)
|
|
12
|
+
RUNNER="$WT/runner/pty-runner.mjs" # runner(绝对路径)
|
|
13
|
+
export PI_CODING_AGENT_DIR="$WT/.u1-dir" # 独立 agent dir
|
|
14
|
+
# board root、socket 均落在该隔离目录下;操作者的 attach UI 必须由同一 entry 加载:
|
|
15
|
+
pi --no-extensions --no-mcp --extension "$ENTRY"
|
|
16
|
+
# runner 与受管 child 固定同一 worktree;不复用现有 dashboard、不 reload 在跑会话
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
执行前打印并记录三条路径与 SHA(ENTRY/RUNNER/WT + HEAD SHA)到样本日志。
|
|
20
|
+
|
|
21
|
+
## U1 — 全新 fullscreen 会话首次 attach(目标:回答「300ms 内能不能做到」)
|
|
22
|
+
|
|
23
|
+
基线对照:main `6f7b2dc`(#284 之前)与修复分支各跑一轮,相同几何/模式/输出脚本。
|
|
24
|
+
|
|
25
|
+
1. 在受管 child 里进入真实 fullscreen TUI(vim/nvim 或等价),**新建会话**后第一次 attach;记录首个非 loading 内容的延迟、readyReason、实际来源尺寸。
|
|
26
|
+
2. detach 后**同尺寸**再 attach;对比 quiet 与持续输出两种形态。
|
|
27
|
+
3. 每形态 ≥10 次首 attach + 10 次 reattach 原始样本;登记 P50/P95、快照可用时间、首次呈现时间、readyReason 分布(complete / committed-degraded / legacy-*)。
|
|
28
|
+
4. 每条样本四问:是否正确显示当前会话?是否 <1500ms(受控)/<300ms(产品目标,仅 committed-degraded 形态)?是否满足 D3 七谓词语义(>预算样本注明阻塞门禁)?最终 F 是否恢复(readyReason 翻转 complete)?
|
|
29
|
+
5. 成功率按父 spec §4.1 分子/分母报告;不同尺寸与 empty 样本保留在全部尝试中,不混入快速路径分母。
|
|
30
|
+
|
|
31
|
+
## U2 — 不同尺寸、版本组合与故障恢复
|
|
32
|
+
|
|
33
|
+
1. attach 期间改变 rows/cols:旧尺寸 view 不得提前 ready;target F 到达后显示正常;capability loss 不伪造 geometry proof。
|
|
34
|
+
2. 隔离旧 runner(main `6f7b2dc` 的 pty-runner.mjs)+ 新 UI:可协商组合不无限依赖新私有消息(本设计零 wire 变更);全旧/无 witness 组合走 legacy 策略不作为 250ms 目标。
|
|
35
|
+
3. 锁存序列确认(#284 核心行为变更):witness 启用后触发 reporter 失效(如杀掉控制 socket)→ UI 停留在 committed 呈现(不闪 loading、不回 legacy)→ resnapshot/新闭合帧到达后画面继续更新;无新闭合帧时旧画面保留(已知限制,预期行为非缺陷)。
|
|
36
|
+
|
|
37
|
+
## 结果记录
|
|
38
|
+
|
|
39
|
+
样本与结论评论回 issue #284;若真实 provider 条件不可用,如实登记「U1/U2 未验收 + 已有自动化证据 + 缺失环境 + 下一步」,不得以 A 修复或更快出现内容推断原始 #267 现场已解决。
|