fix: close PI core chat review gaps

This commit is contained in:
2026-08-24 01:28:06 +08:00
parent 612135f911
commit bec93d0918
15 changed files with 1094 additions and 122 deletions

View File

@@ -130,24 +130,60 @@
buffers during target recovery, trims Snapshot-covered items and replays only
a strict continuous tail.
- Fixed a supported concurrency defect exposed by the full suite: the Pi
Session Registry now reuses one Conversation store per project, serializing
simultaneous first bindings instead of racing writes to the same metadata
file.
Session Registry and Coding Project Service now receive the same project-
scoped Conversation store provider, so runtime bindings and metadata writes
serialize through one mutation queue instead of racing the same file.
- Closed the first planner review findings after candidate `612135f`: the
authenticated Host server now admits only the exact image-binary upload
exception; empty/invalid/oversize/not-found attachments have stable typed
errors and supported image signatures are checked before disk writes.
- Made active target ownership atomic across Agent switches. An old or archived
Conversation cannot supply the visible draft/timeline/prompt target, and a
slow automatic or explicit create completion only selects when its captured
project and Agent are still active. Submission flights and errors are scoped
per Conversation, so one pending/rejected target does not disable another.
- Bounded each message to 16 local images and four concurrent uploads. A real
Electron image fixture now traverses the Renderer facade, IPC channel and
authenticated Host server, reads the stored bytes back for the optimistic
timeline preview, observes one upload, and verifies the prompt contains only
attachment ids rather than base64.
- Extended target-only gap recovery: when the first recovery Snapshot remains
behind a buffered continuous tail, Renderer requests one fresh target
Snapshot; a repeated identical stale response becomes a retryable error
instead of remaining in an infinite recovering state.
- Synchronized `README.md` with the current Pi core Chat, first-Conversation,
batch and attachment behavior. PI-130 feature controls and PI-140 legacy
removal remain outside this task.
## Verification
- `pnpm exec vitest run tests/unit/coding-workspace-store.test.ts tests/unit/coding-projects-facade.test.ts tests/unit/coding-attachments-facade.test.ts tests/unit/coding-attachments-routes.test.ts tests/unit/coding-chat-panel.test.tsx tests/unit/coding-conversation-timeline.test.tsx tests/unit/coding-conversations-store.test.tsx tests/unit/coding-core-routes.test.ts tests/unit/host-api.test.ts tests/unit/host-api-proxy.test.ts`: passed, 10 files / 68 tests before the final malformed-batch and Session Registry regression additions.
- `pnpm exec vitest run tests/unit/pi-session-registry.test.ts tests/unit/pi-conversation-runtime.test.ts tests/unit/coding-conversations-store.test.tsx tests/unit/coding-chat-panel.test.tsx`: passed, 4 files / 25 tests.
- `pnpm test`: passed, 217 files / 2303 passed / 2 skipped. The final run is green after fixing the same-project parallel Session Registry write race and stabilizing the AI Hardware async query at its actual loading boundary.
- First implementation candidate `612135f` received planner review result
**Standards Needs Fix / Spec Needs Fix**. PI-120 remained the unique Ready
Frontier; the findings above were treated as blocking rather than advancing
PI-130.
- Post-review focused suites passed: attachment Host routes, stale recovery,
shared ProjectService/Registry mutation queue, slow Agent switch, cross-
Conversation submission isolation, attachment count/concurrency and pressure
tests all pass. The consolidated focused run covered 3 files / 30 tests, and
`coding-chat-panel.test.tsx` covered 6/6 behavior tests.
- `REN-008` actual-path fixture passed with 100 runtime patch items, 20 public
patch batches, 21 SSE frames including Snapshot, 20 Renderer transactions,
20 React commits, 131,148 wire bytes, and measured Main-to-React p95
`35.995 ms` against the `<=50 ms` budget. It includes mixed message blocks,
4 KiB tool output and more than 100 KiB of cumulative thinking output.
- `pnpm test`: passed, 218 files / 2316 passed / 2 skipped.
- `pnpm run typecheck`: passed.
- `pnpm run lint:check`: passed with 0 errors and six unchanged warnings in `ExecutionGraphCard`, `Home`, and `Makelore`.
- `pnpm run build:vite`: passed; existing Vite dynamic-import and chunk-size warnings remain.
- `pnpm exec playwright test tests/e2e/pi-coding-first-chat.spec.ts`: passed, 1/1.
- `pnpm exec playwright test tests/e2e/pi-coding-first-chat.spec.ts --repeat-each=20 --workers=1`: passed, 20/20 fresh-userData runs. Every sample asserted Composer editability below 500 ms while runtime Snapshot was held, so the measured sample p95 is below the locked 500 ms budget; the same fixture verifies optimistic prompt visibility and HTTP 202 acceptance without a real Provider.
- `git diff --check`: passed; only repository line-ending conversion notices were printed.
- `pnpm run lint:check`: passed with 0 errors and six unchanged warnings in
`ExecutionGraphCard`, `Home`, and `Makelore`.
- `pnpm run build:vite`: passed; existing Vite dynamic-import and chunk-size
warnings remain.
- `pnpm exec playwright test tests/e2e/pi-coding-first-chat.spec.ts`: passed,
1/1. The post-review real-image fixture also passed 5/5 fresh-userData repeats
with one upload, Host readback preview, optimistic message, HTTP 202 and no
base64 in later payloads. The earlier text-only first-Conversation fixture
passed 20/20 fresh-userData runs below the 500 ms editability budget.
- `git diff --check`: passed; only repository line-ending conversion notices
were printed.
- Real Provider remains **Explicitly Waived / Accepted Risk** with
`realTurnVerified=false`; no Provider Account, credential isolation,
protocol-specific endpoint, rate-limit or real concurrency behavior is