Repository navigation
fix(chat): keep flattened tool results with the correct tool - #1298
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 6:40 AM ET / 10:40 UTC. ClawSweeper reviewWhat this changesThe branch changes native Chat history replay so flattened tool output receives a collision-free synthetic identity while structured tool calls retain exact cached metadata. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review This is a distinct, focused repair for native Chat history correlation. The reviewed patch has no supported correctness or security finding, and its collaborator author means it should remain open for ordinary maintainer landing review. Priority: P2 Review scores
Verification
How this fits togetherThe native tray Chat view loads gateway conversation history, correlates structured and flattened tool activity with cached display metadata, then projects that timeline into accessible WinUI tool rows. flowchart LR
A[Gateway history] --> B[History replay]
C[Cached tool metadata] --> D[Tool correlation]
B --> D
D --> E[Chat timeline]
E --> F[WinUI tool rows]
F --> G[Accessibility proof]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Land the focused history-correlation repair after the normal current-head merge gates complete. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: the focused fixture constructs the structured-ID and flattened-output collision, and the base loader reused cached identities for flattened rows. Is this the best way to solve the issue? Yes: reserving transcript IDs and assigning flattened rows new synthetic IDs removes the shared identity while retaining safe cached display metadata. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 585c1776e890. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Preserve current ChatHistoryLoader and ChatMetadataStore ownership while correlating structured calls by stable IDs and assigning flattened results collision-free synthetic IDs. Co-authored-by: Copilot App <[email protected]>
Use the replay timestamp to select the nearest exact cached identity while preserving unmatched metadata order. Co-authored-by: Copilot App <[email protected]>
Keep exact call/result lookups paired per occurrence and stop positional enrichment after a genuine verified-ID miss, without penalizing duplicate results or reused IDs. Co-authored-by: Copilot App <[email protected]> Copilot-Session: a73d1c86-3724-4651-aaf7-7578a6102976
b95d803 to
ea0dd54
Compare
Related: #894
Replaces: #1130
What problem this solves
Native Chat history could attach flattened tool output to the wrong structured tool row when cached metadata, reused call IDs, and generated history IDs collided.
What changed
ChatHistoryLoaderreserves structured transcript IDs before allocating synthetic IDs.ChatMetadataStoremerges stable cross-key metadata and matches structured entries by exact ordinal call ID, choosing the nearest timestamp when IDs are reused.Ownership remains consistent with
docs/ARCHITECTURE.md: history replay stays inChatHistoryLoader, cached correlation stays inChatMetadataStore, andOpenClawChatDataProviderremains the facade. Later PR #1301 changes provider snapshot publication/lifetime only; there is no production-file overlap or semantic ownership conflict.User impact
Structured and flattened historical tool activity render as separate rows with truthful tool identity, sanitized arguments, status, and output ownership.
Required proof pools
windows-winui-interactive: current-head native Chat history identity, input, output, and accessibility proof.Validation
Exact reviewed head:
ea0dd548f459de8be3fea0c10408c353d66014c3on base585c1776e8900c22aa12c2be801db6d6e73ddf9e..\build.ps1: passed, 5 of 5 projects.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: 3,915 passed, 0 failed, 32 skipped.dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: 2,852 passed, 0 failed.HistoryCollisionScreenshotProofTestswith-r win-x64: 1 passed, 0 failed.McpHttpServerTests.Dispose_DuringInFlightHandler_DoesNotSurfaceObjectDisposedException; the isolated rerun and subsequent full required reruns passed.33863943601, attempt 2: CI Gate passed. Core/CLI, Tray/setup/integration, UI/accessibility, proof contracts, release metadata, E2E, and publish smoke jobs passed.33863943703: passed, including C# and Actions security.Real behavior proof
ea0dd548f459de8be3fea0c10408c353d66014c3.dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -r win-x64 --filter "FullyQualifiedName~HistoryCollisionScreenshotProofTests".Tool call Bash. Done.with inputcommand: synthetic flattened id: history-tool-1and outputflattened output owned by history-tool-1.unverified-flat-idandunverified-flat-runwere absent.7621823E76A10109931DE83BDA6CB5DF8A2003DAD375AE3C99203A6B58AEF1FF.Security impact
Compatibility and migration
Backward compatible. No configuration, environment, or migration changes are required.
Merge
Squash-merged from exact reviewed head as
8e5526bb4b72232cd84e6e1163f019037ff975eeonmain.