fix(chat): preserve history cache correlation - #1130
Conversation
|
Codex review: found issues before merge. Reviewed August 9, 2026, 1:00 PM ET / 17:00 UTC. ClawSweeper reviewWhat this changesThe PR changes native chat-history replay to preserve cached tool metadata while assigning collision-safe synthetic IDs to flattened tool output. Merge readinessKeep open. The functional patch has strong unit and CI signal, but the prior P2 proof blockers remain: the visible collision fixture bypasses history replay, and its committed artifact records a pre-final commit. Priority: P2 Review scores
Verification
How this fits togetherNative chat history combines Gateway transcript entries with cached tool metadata, then reduces them into activity rows for the WinUI chat renderer. This PR changes the correlation boundary between history replay and those visible rows. flowchart LR
A[Gateway history] --> C[History replay]
B[Tool metadata cache] --> C
C --> D[Correlation and ID allocation]
D --> E[Timeline activity rows]
E --> F[WinUI chat renderer]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Drive the collision scenario through LoadHistoryAsync in the isolated app fixture, then publish redacted UIA and image evidence captured from commit 128bc29. Do we have a high-confidence way to reproduce the issue? Yes. The focused provider regression constructs the structured-ID and flattened-output sequence through LoadHistoryAsync, although this read-only review did not execute it. Is this the best way to solve the issue? No. The correlation repair is narrow, but the visible proof should use the same provider replay path rather than manually constructed reducer rows. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 582a44713860. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
e1be9df to
128bc29
Compare
Related to #894
Scope
This PR now contains three focused layers across nine files:
Production history/cache behavior
(RunId, ToolCallId, LegacyTurn)identities while preserving reused IDs across distinct runs and legacy turns.history-tool-*IDs for flattened history and unkeyed structured fallbacks.Regression and renderer proof coverage
history-tool-0remains a separate interrupted structured row while flattened output is assigned only to synthetichistory-tool-1.Committed proof artifacts
.github/proof/pr-1130/so this PR head has immutable, reviewable evidence.hideFromChannelProgressremains intentionally out of scope.Exact head and base
128bc29b3adc7263d0ad60d3ef9af285c49078d93a03dfddbed6323fa5cd970f41b7bb0a0ab2ea0cfix(chat): preserve history cache correlation683517894bd13dfeeb9996d3934bdac5b4b4863bfix(chat): avoid synthetic history ID collisions128bc29b3adc7263d0ad60d3ef9af285c49078d9test(chat): prove history ID collision rendering4712e227d110746400e93107c60616544d68f7b4maintarget:582a44713860409bc34c5acbf6da54a09cf2b10amainadvanced by two commits after the completed validation refresh. Git reports the current head remains cleanly mergeable with the current target, but the validation counts below apply to the exact validated tree at4712e227plus this three-commit stack. New-head CI is the current source of truth for the target merge result.Validation
git diff --check: passed.\build.ps1: passeddotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: 3,631 passed, 0 failed, 32 skippeddotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: 2,255 passed, 0 failedNativeToolIdentityScreenshotProofTests,HistoryCollisionScreenshotProofTests, andReactorToolActivityProofTests: 3 passed, 0 failed with the runtime-qualifiedwin-x64commandReal behavior proof
The exact provider regression starts an unfinished structured call with verified ID
history-tool-0, then replays flattened tool output. It asserts exactly two rows:history-tool-0:Interrupted, no output.history-tool-1:Done, ownsflattened output owned by history-tool-1.The visible proof uses direct production RenderTargetBitmap captures of both production tool cards plus the synthetic output viewport, composed with spacing and without coordinate cropping. Matching UIA assertions verify two distinct visible rows, structured output absence, and synthetic output ownership. The visible fixture proves reducer, projection, and renderer behavior; allocator correctness remains owned by the focused provider regression.
.github/proof/pr-1130/history-collision-68351789.png5E0FBB308567AB0F304D6D05DAA202E20C3DBFBFDAB6E571C5D5DED1840C2C6F.github/proof/pr-1130/history-collision-68351789.txtFB29DA6CAB76004E680E0FCAA86C7CFFA8C99600B17D0B9B14665B348397B7E5683517894bd13dfeeb9996d3934bdac5b4b4863bplus exact four-file proof patch SHA-256F10E5599298252AA5BA0941ABB4B159A6B9545C3BF0D546D05409914429A1BEC; those exact changes are committed by128bc29b3adc7263d0ad60d3ef9af285c49078d9.The artifacts were checked for blank media, credential-like content, user-specific paths, and real user/Gateway data before publication.
Review
401 Unauthorized; the clean results above are the requested GPT-5.6 Sol/high specialist fallback.128bc29b.e1be9dfe14065820550d50b684363d2414683fa6. They are stale for this head and are not used as current-head evidence. New-head ClawSweeper is pending.PR #1111 interaction
PR #1111 remains complementary and unmodified at head
be50098bae12e6291ad60b2196ca50996837f94e.Its semantic patch owns persisted call ID aliases, message-level errors, string-encoded safe arguments, and failed-tool grouping. This PR owns positional cache correlation, flattened row identity, and synthetic/structured ID collision handling. There is no direct changed-line overlap in the source or tests.
Release boundary
#894 is OPEN and remains open until the follow-up lands and a release includes #1078, #1114, and #1130. This PR does not close the issue and intentionally uses
Related to #894rather than a closing keyword.