Repository navigation
fix: tray crashes during background session updates and chat re-renders - #2091
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: passed. What this changesThis PR snapshots session-name translations at startup and declares text selection on chat element records to avoid selection flips during control recycling. Example: Reactor reuses a selectable RichTextBlock to display tool output containing Get-Date.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR provides focused crash mitigations still absent from main, with no definite introduced defect found. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCompanion formats Gateway session metadata into localized titles and renders chat content through Reactor into native WinUI controls. flowchart TD
A[Startup localization] --> B[Managed string snapshot]
C[Gateway session updates] --> D[Session title formatter]
B --> D
D --> E[Companion session surfaces]
F[Chat content] --> G[Reactor element records]
G --> H[Pooled WinUI controls]
Technical reviewBest possible solution: Retain the bounded startup snapshot and declarative selection changes in the existing formatter and renderer owners. Do we have a high-confidence way to reproduce the issue? Source establishes background formatter lookups and the recycled-control selection transition, supported by reported Windows negative controls; the native access violation has not been independently reproduced. Is this the best way to solve the issue? The patch is a small, coherent mitigation that preserves localized naming, fallback behavior, and selectable text without introducing another rendering or localization owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1cd641de9195. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 28, 2026, 11:48 AM ET / 16:48 UTC (Revision 2). |
PR cleanup reviewReviewed head: Source cleanup review at 5fbea10 against main e59374c: capturing the formatter resource strings during UI-thread configuration removes the background callback path still present in main. The unit regression is relevant, but the body still lacks native reproduction/stress evidence and complete successful closeout, and current UI/CI Gate is failed. Please retain this fix and add source-bound background-session update proof before landing; GitHub currently marks it non-draft despite the draft wording in the body. Action in this cleanup pass: leaving this PR open. No branch changes or runtime-proof waiver. The findings above come from source, discussion and recorded-CI review; Windows validation was not rerun in this pass. |
|
Hi @VACInc, thanks for the rebase and the new tests. I'm a Copilot triage agent (not Scott), leaving overnight notes so the next human look is quick. I did not push to your branch or change any labels. This replaces my earlier note, which was about an older head. What I checked on head
Small things that would help a maintainer land it (evidence gaps, not defects I found)
Two non-blocking notes: No rush, and thank you again. |
5fbea10 to
d513aec
Compare
|
Scoped branch refresh authorized by @bkudiess: I am merging current main |
Preserve current tool-detail layout assertions and declarative text selection while integrating main. Co-authored-by: bkudiess <[email protected]>
Main refresh completed on the original branchMerged main Resolution: the only textual conflict was Independent review: a separate GPT-6.1 Sol reviewer inspected the full resolved PR diff, original patch, conflict and auto-merge boundaries, relevant owners/tests, and discussion. No actionable merge-introduced P0-P3 finding and no concrete production defect in the resulting delta. This is source review, not native runtime proof. Validation on the merged tree:
Still required: current-head hosted Windows checks and the declared native proof, including crash/stress evidence. Source review does not establish the native access-violation cause or prove that native crashes are fixed. Earlier test results were not relabeled as validation of this merge. This is not a merge-ready claim. The title/body and open non-draft state are preserved. Active-ownership label is being removed on handback. Post-push GitHub readback: head |
|
This pull request has been automatically marked as stale due to inactivity. |
# Conflicts: # src/OpenClaw.Tray.WinUI/Chat/ChatMarkdownPresentation.cs
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
What Problem This Solves
Fixes two tray crash paths: a native resource lookup when background Gateway session updates format session names, and a selection flip on recycled chat text controls when code blocks or tool-card details re-render.
User Impact
Session title and subtitle formatting use managed strings instead of invoking native language resources on the receive thread. Chat code blocks and tool-card details keep text selection on from the first mount, so a recycled control is never switched off and back on. No protocol, permissions, or node capability changes. This is a targeted mitigation; the native memory defect is not established.
Why This Change Was Made
The observed crash stack enters WindowsCreateStringReference through IResourceMapMethods.GetValue, LocalizationHelper, SessionTitleFormatter.FormatUnique, RememberLastSessionState, and the Gateway receive loop. ConfigureLocalization runs at application startup after the language override. Capture the finite title/subtitle vocabulary there and publish the completed snapshot atomically. Preserve missing-resource and malformed-format fallbacks.
A build with only the formatter change crashed again about three hours after install, on the UI thread in
CRichTextBlock::OnSelectionEnabledChanged->TextSelectionManager::ReleaseGrippers, with no session-title code on the stack. Reactor writes the non-nullableRichTextBlockElement.IsTextSelectionEnabled(default false) on every mount before element setters run, and its pool hands back RichTextBlocks with selection still on. The chat code block and tool-card detail section enabled selection only in a setter, so a recycled control went true -> false -> true on each remount. Selection is now declared on the element record, so no mount writes false.Evidence
Current head d513aec, rebased on main. Windows UI tests (
--filter FullyQualifiedName~ChatRichTextSelectionStabilityTests|FullyQualifiedName~SessionTitleLocalizationTests):CodeBlock_RecycledControlNeverTurnsSelectionOff,ToolCardDetails_RecycledControlNeverTurnsSelectionOff, andStartupSnapshot_ServesTranslatedTitleOnWorkerforfr-FRandzh-CNall pass.Expected: 0, Actual: 1, one off-write on the pooled control, which is the flip in the crash stack.On Windows with .NET SDK 10.0.401, focused SessionTitleFormatterTests: 21 passed, 0 failed, 0 skipped. The new regression fails against the original formatter (1 failed), then passes with the snapshot implementation. Local independent autoreview found no actionable P0-P3 defects in the selected diff; it did not execute tests or independently prove native runtime behavior.
Change Type
Scope
winnodeRequired proof pools
windows-winui-interactive: current-head session-update stress/native crash proof remains unverified. WinApp CLI is unavailable on the test host.Validation
Hosted CI (run):
Tray, setup, and integration lane: passed.
UI lane: failed. In-process test host crashed while
ReasoningPicker_PreservesCurrentValueWithoutInventingSupportedOptionswas active (251 passed, 7 skipped before abort). The log explicitly does not attribute the crash to that test; no causal link to this patch has been established.Separate Gateway fixture UI suite: 83 passed, 1 failed.
NotificationAction_BrowserRefusalAndSeparateRetryKeepReminderUntilItsOwnActionSucceeds(settingsBanner: True)found no reminder after dismissing a host warning (Assert.Single at line 41). This tests notification admission, outside the changed formatter owner; a baseline reproduction has not yet established whether it is pre-existing.CI Gate is red because the required UI lane failed, not because the gate itself malfunctioned. No failed checks have been waived or silently rerun.
dotnet test tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore --filter FullyQualifiedName~SessionTitleFormatterTests: 21 passed, 0 failed, 0 skipped.Original formatter + new regression: 1 failed at startup snapshot assertion, as expected.
git diff --check: passed../build.ps1: initial run blocked by shallow clone; full history fetched; retry succeeded (all builds succeeded).Full shared suite: 4866 passed, 8 failed, 26 skipped (4900 total). Failures include PowerShell executable resolution on a host without PowerShell 7. Full tray suite attempted; also hits missing pwsh.exe. No green full-suite claim.
Autoreview: scoped-clean P0-P3; native runtime proof and independent rubber-duck review remain unavailable.
Real Behavior Proof
Passed! Failed: 0, Passed: 21, Skipped: 0, Total: 21.Security Impact
Yes, explain the risk and mitigation: N/A. This change only snapshots existing local presentation strings; it adds no external data access or execution capability.Compatibility and Migration
Review Conversations
Summary
High Level TLDR
Load session-name translations once at startup, not during background network callbacks, and never switch text selection off on recycled chat text controls.
Root Cause
The crash stack demonstrates native resource lookup during background session title formatting. Current main retains the delegate-based lookup on that path. This change removes that native call boundary from formatting. The exact reason WindowsCreateStringReference raised an access violation is unproven; this PR does not claim a diagnosed MRT/CoreCLR memory bug or a guaranteed cure for every tray crash. The second path is reproduced deterministically by the new UI tests.
What was not tested
See blocked proof above. No live installed client update, no Gateway change, no raw crash dump or private log upload.