fix(pi): exclude root bookkeeping from WebSocket chain identity

Merged
RI
5h ago
+106-12

Refs #921

Change

Share the existing LKG provider-input projection with the Responses WebSocket chain guard. Only root completedAt and contextSnapshot are omitted from prepared-history identity. Nested tool arguments, actual wire messages, and the existing text/role/native-response/delta checks are unchanged. LKG API/transport eligibility is unchanged.

Harness coverage (required)

  • OpenCode 1: not applicable — this Pi/OMP AgentMessage projection and chained dispatch path do not exist in its message/parts hook; shared OpenCode LKG code is unchanged.
  • OpenCode 2: not applicable — its context/system/checkpoint replay path is separate from the Pi/OMP chained-dispatch projection.
  • Pi: covered — existing LKG/converter regressions preserve the extracted helper's behavior; unproved APIs and transport overrides retain the full content fence.
  • OMP: covered — guarded previous_response_id frame regressions admit root bookkeeping changes and reject identically named nested tool-argument changes; pinned OMP encoder/delta regressions also pass.
  • Rust module: not applicable — no Pi/OMP chained-dispatch projection exists there; Rust/OpenCode MessageLike snapshots and shared prefix algorithms are unchanged.

Validation

Before the implementation was added, the older-assistant completion-time regression failed with prepared history does not extend the previous managed request. It passes with this change; the final tests also cover root contextSnapshot and both nested argument names.

From packages/pi-plugin:

  • MC_SLOW_TESTS=0 BUN_JSC_useOMGJIT=0 bun test --parallel=4 --timeout 30000 src/issue-686-ws-continuation.test.ts src/pi-lkg-wire-fence.test.ts src/pi-lkg.test.ts src/pi-lkg-fit-envelope.test.ts src/pi-dispatch-chain-tail.test.ts src/pi-dispatch-omp-head-host.test.ts src/issue-931-reused-call-ids.test.ts — 135 passed, 0 failed.
  • bun test src/issue-640-review-r2.test.ts --test-name-pattern unproved — 3 passed, 9 unrelated cases filtered out.
  • bun run typecheck and bun run build — passed.
  • ./node_modules/.bin/biome check src/pi-provider-input.ts src/pi-dispatch-chain.ts src/pi-lkg.ts src/issue-686-ws-continuation.test.ts — passed.

Additional shared guards / limits

On macOS with Bun 1.4.3, cd packages/plugin && bun test src/shared/ was not green: 972 passed, 4 skipped, 6 failed. Filtering those six cases on the unchanged-production base 7fca5ac695 with independently installed frozen dependencies reproduced the worker, temporary-path and SQLite WAL failures; the three exit-listener cases passed in that isolated selection, so their full-suite interaction is not established on the base. None of those shared modules is modified here.

The two final root-field regression cases were also applied to that base without the implementation: both fail with the original chained-history refusal.

Full Linux preflight and live-host integration have not been run locally. The main CI workflow does not run automatically for pull requests; PR gates are not a substitute for that integration coverage.

AI-assisted implementation and verification. Added regressions use only synthetic history.


Summary by cubic

Fixes WebSocket continuation refusals when only a root completedAt or contextSnapshot changes in prepared history. The existing LKG root-bookkeeping projection is extracted into a shared helper and now also applied to the prepared-history chain guard. Nested tool arguments, wire messages, and existing text/role/native-response/delta checks remain unchanged, and LKG API/transport eligibility is untouched.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no blocking issues were found.

Summary

Shares the root-bookkeeping projection between LKG and the WebSocket chain guard.

  • WebSocket continuations ignore changes to two root bookkeeping fields.

The change since the previous review only updates that generated table. No new actionable issues were found.

Reviews (2) · Last reviewed commit: "chore(cli): regenerate issue log templat..." · Reviewed by Greptile