Repository navigation
fix: collapsing the sidebar can crash Companion after sessions or pinned pages change - #2172
Conversation
…ned pages change The Workspace sidebar removed NavigationViewItems when a session left the list or a page was unpinned. WinUI keeps SplitView callbacks on removed rows (microsoft/microsoft-ui-xaml#10757, fixed upstream by #12235 but not in Windows App SDK 2.6.5). Once a removed row is collected, the next pane change calls into it and raises an unhandled E_FAIL or an access violation. KeyedMenuRows now works inside a shared menu: it places rows at a start index, removes only the rows it owns, can adopt an existing row and can pool retired rows. Pinned-page rows come from it, so a re-pin shows the original row again. Session rows use a pool, so a new session reuses a retired row and memory stays close to the most rows shown at once. The Settings agent menu adopts its XAML "main" row instead of replacing it. Co-authored-by: Copilot App <[email protected]>
|
🦞👀 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: needs maintainer review before merge. What this changesThe PR retains removed sidebar rows and reuses retired session rows to prevent crashes during later pane changes. Example: Unpin and re-pin Dashboards 12 times, then collapse and reopen the sidebar 20 times.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a concrete sidebar crash path still present on main; source review found no actionable introduced defects. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherWorkspace and Settings turn session, pin, and agent lists into native NavigationView rows; reconciliation updates menu order, selection, accessibility metadata, and focus. flowchart TD
A[Session and pin lists] --> B[WorkspaceWindow]
C[Agent roster] --> D[SettingsShellView]
B --> E[KeyedMenuRows]
D --> E
E --> F[Retained and pooled rows]
F --> G[Native NavigationView]
Technical reviewBest possible solution: Extend the existing keyed-row owner to retain removed pins and pool session rows while preserving menu order, selection, accessibility, and focus identity. Do we have a high-confidence way to reproduce the issue? Main's row-removal paths and the verified upstream callback defect support the reported trigger; the author describes base-versus-fix reproduction, but this read-only review did not independently reproduce the native crash. Is this the best way to solve the issue? The patch fixes the lifetime cause through the existing owner rather than catching the resulting exception; pooling addresses continuous session churn, and the focus check preserves conversation identity when a row is rebound. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e9ed3ba8b27b. Provenance checked
TestingProof path: unit tests only. 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 Reviewed November 13, 2026, 12:24 PM ET / 17:24 UTC. |
Resolves conflicts with openclaw#2173 (session dashboard tab beside chat), openclaw#2176, openclaw#2175, openclaw#2116 and openclaw#2172: - ReactorBoardView: embedded board keeps main's compact 12/0 padding, standalone pages keep the shared PageResponsiveLayout PaddingTop/PaddingBottom. - Resources.resw (all 6 locales): keep this PR's PageAction_Refresh keys and main's Chat_Panel_Dashboard. - TestTimingPatternBaseline.json: main's counts, then lowered for this branch. Co-authored-by: Copilot App <[email protected]>
Related: #2171 (fix: pinned pages can crash Companion after Settings refreshes its agent list)
What Problem This Solves
Fixes: Companion can raise an unhandled
COMException 0x80004005 "Unspecified error"(no managed stack), or crash with0xC0000005, when the Workspace sidebar is collapsed or reopened after a pinned page was unpinned or a session left the sidebar. In fixture CI this shows up as "The real app wrote a crash log" with exactly that signature; the most recent case isAutomations_DesignerValidationFocusAndDraftsStayIsolatedon #2170 run 43443495532.User Impact
User impact: unpinning and re-pinning pages, or sessions coming and going (new chats, deleted chats, cron and subagent runs), no longer leaves the sidebar in a state where the next pane collapse or reopen can crash Companion. Sidebar order, labels, selection, focus repair and Narrator names are unchanged. A re-pinned page shows its original row again.
Why This Change Was Made
This is the same WinUI bug that #2171 fixed for the Settings agent rows: microsoft/microsoft-ui-xaml#10757, fixed upstream by microsoft/microsoft-ui-xaml#12235 but not in Windows App SDK 2.6.5, which this app ships.
NavigationViewItemregisters SplitView property callbacks that capture the raw item.The Workspace sidebar had two removal paths:
PinnedPageRowsremoved and forgot a row on unpin and created a new one on re-pin.SyncSessionItemsremoved a session's row fromMenuItemsand dropped it from its cache.This PR moves both onto
KeyedMenuRows(added in #2171), extended so it works inside the shared sidebar menu:PinnedPageRowsstill reports removed rows and whether the focused row was removed, using focus captured before any detach.IsSelectedcleared, AutomationId, Tag, content, context menu, Name, tooltip and ItemStatus reset). A pooled row is only reused after the sync that retired it, so a reused row is never still in the menu.DefaultAgentNavItem(agent:main) instead of replacing it on the first sync. This resolves a LOW note from the fix: pinned pages can crash Companion after Settings refreshes its agent list #2171 review.Memory tradeoff (retained rows)
These are estimates from both reviewers, not measurements:
sessions.listhas no page limit here), and cron and subagent runs create new session keys continuously. For example, an hourly automation over two weeks is about 340 sessions, roughly 7 to 34 MB, and it keeps growing.Once a Windows App SDK release includes #12235,
KeyedMenuRowscan stop retaining removed rows. As of 2026-11-13, neither the 2.6.5 nor the 2.6.6-experimental release notes mention #10757 or #12235.Evidence
mainwith fix: pinned pages can crash Companion after Settings refreshes its agent list #2171 (session rows and pins not yet fixed): 4 of 6 runs wroteUnhandledException COMException (0x80004005): Unspecified errorwith no managed stack, the same signature as the test(a2ui): queued SVG decode test fails on a slow runner because it checks total elapsed time #2170 Automations crash log.main(0 of 6), so the session-row change is covered by the same mechanism, unit tests, and 7 of 7 clean runs on this PR.3cc72800f(Claude Opus 5.5 and GPT-6 Astra long-context, both high effort), plus a delta review of the fixes. Neither found a CRITICAL or HIGH issue. Applied:KeyedMenuRows.Synckeeps every row owned if a create or rebind callback throws (Opus LOW).Change Type
Scope
winnodeRequired proof pools
windows-winui-interactive: covered by isolated fixture runs of the WinUI app for the sidebar, pinned-page and Settings flows. See Validation and Real Behavior Proof.Validation
All runs were local on Windows x64 at 175% DPI, with isolated profiles. Metadata for the real
%APPDATA%/%LOCALAPPDATA%\OpenClawTraywas unchanged after every run.main+#2171: 4 of 6 crash logs; this PR: 23/23 cleanmain, 0/6)DashboardsRenderNativeReportsTabsAndFailureStatesSettingsPane_KeepsToggleChoiceAcrossPinnedPagesAndRestartHomeSidebar_CustomizeDoesNotNavigate_AndHomeRestoresCanonicalConversationCategory=GatewayFixture&KeyboardProof!=Required, pre-review head)Automations_ScopesToAgentsAndCoversMainStates, an AxeBoundingRectangleSizeReasonableviolation that happens only locally at 175% DPI and also fails onmainhere.KeyboardProof=Required, pre-review head)mainon this machine.KeyedMenuRowsTests,PinnedPageRowsTests(new and updated cases).\scripts\validate-test-timing-patterns.ps1: passed../build.ps1: all builds succeeded.dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj: 5862 passed, 0 failed, 29 skipped.dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: 6453 passed, 0 failed (final source).Real Behavior Proof
maine9ed3ba with no upstream changes to the touched files; validated on the identical pre-rebase source).dotnet test tests/OpenClaw.Tray.UITests -c Debug -r win-x64 -p:DevBuild=false --no-build --filter "<test>"withOPENCLAW_RUN_GATEWAY_FIXTURE_UI=1for each test above, plus the two probes described under Evidence.Yes/No/N/A): N/A (local artifacts only).Security Impact
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, explain the risk and mitigation: N/ACompatibility and Migration
Yes/No): YesYes/No): NoYes/No): NoReview Conversations