fix(coding): keep optimistic identity across snapshots

This commit is contained in:
2026-08-23 22:39:34 +08:00
parent 1abb2fff36
commit 934ba02718
3 changed files with 77 additions and 9 deletions

View File

@@ -107,7 +107,10 @@
and replayed in generation/sequence order after a valid Snapshot; unresolved
pending/accepted/uncertain prompt requests re-overlay their local optimistic
nodes after snapshot-first reconnect until a durable `clientRequestId`
reconciliation arrives. Neither mechanism replays a mutation.
reconciliation arrives. If the reconnect Snapshot already contains that
durable message, its message id is first reconciled to the local request's
stable UI node id before the request is removed. Neither mechanism replays a
mutation.
- Added optimistic user nodes keyed by `clientRequestId`. Durable upsert keeps
the optimistic UI node id; definite rejection restores an untouched draft
and marks the node failed; uncertain delivery restores the draft while
@@ -129,11 +132,16 @@
- `pnpm exec vitest run tests/unit/coding-conversations-facade.test.ts tests/unit/coding-conversations-store.test.tsx`:
initial implementation 2 files / 12 tests passed; after review fixes, 2 files
/ 13 tests passed, including delayed gap GET + concurrent patch replay and
reconnect Snapshot optimistic-node continuity.
/ 14 tests passed, including delayed gap GET + concurrent patch replay,
reconnect Snapshot optimistic-node continuity, and a reconnect Snapshot that
already contains the durable user message while preserving `node-1`.
- `pnpm exec vitest run` for the two PI-110 tests plus PI-010 contracts,
coding core routes, event projector, Conversation runtime, product tools,
and subagent suites: 8 files / 75 tests passed.
and subagent suites: initial 8 files / 75 tests; final review-fix range 8
files / 77 tests passed. One intervening parallel run hit a non-reproducible
`CODING_STORAGE_WRITE_FAILED` in the unrelated Conversation runtime temp
persistence test; that file passed alone immediately afterward and the same
8-file command then passed in full.
- `pnpm run typecheck`: passed after the shared product seam removed the clean
Renderer -> composite Electron declaration dependency.
- `pnpm run lint:check`: passed with zero errors and the same six unrelated
@@ -150,9 +158,12 @@
PI-150. Neither is recorded as Pass.
- Planner review of `a072257...36626c8`: Standards PASS / 0 findings; Spec
Needs Fix with two P1 findings for recovery-window patch loss and reconnect
Snapshot optimistic-node loss. Both independent reproductions were accepted
and fixed locally with the focused regressions above; fixed-range re-review
remains required before PI-110 can be marked Done.
Snapshot optimistic-node loss. The first fixed-range re-review accepted gap
replay and missing-durable-node overlay, then found one remaining P1 where a
Snapshot already containing the durable node adopted the server id. That
reproduction is now fixed by `clientRequestId` id reconciliation before
request cleanup, with the focused regression above. Final fixed-range
re-review remains required before PI-110 can be marked Done.
## Follow-ups