Repository navigation
fix: avoid duplicate errors when a desktop disconnects - #137724
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 3, 2026, 9:08 PM ET / September 4, 2026, 01:08 UTC. ClawSweeper reviewWhat this changesThe PR makes each Control UI desktop noVNC connection handle retire exactly once so panel cleanup cannot disconnect an already-terminated RFB connection. Merge readiness⛔ Blocked before merge - 4 items remain Keep open. The focused owner-level guard blocks the demonstrated reentrant disposal path, and current main does not contain it; the protected maintainer label also rules out automated closure. Independent confirmation of the referenced noVNC lifecycle contract remains unavailable in this sparse, DNS-isolated review environment. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI opens a WebSocket-backed noVNC desktop stream and passes a connection handle to the desktop panel. When noVNC reports termination, the panel disposes that handle while showing recovery UI, so the handle must not re-enter noVNC’s terminal state machine. flowchart LR
A[Desktop panel] --> B[Desktop client]
B --> C[WebSocket stream]
B --> D[noVNC RFB connection]
D --> E[Terminal disconnect event]
E --> F[Panel recovery callback]
F --> G[Connection handle disposal]
G --> B
Decision needed
Why: The code path and regression coverage are clear, but this review environment could not inspect the installed or upstream dependency source that establishes the terminal-state premise. Before merge
Agent review detailsSecurityNone. PR surfaceSource +8, Tests +11. Total +19 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep retirement at the DesktopClient boundary, retain the reentrant unit and browser coverage, independently confirm the noVNC terminal-event contract, then merge once the exact-head CI gate is green. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: an RFB disconnect invokes the panel callback, which synchronously disposes the same handle through the handoff owner; current main forwards that disposal directly to noVNC. Is this the best way to solve the issue? Unclear pending direct dependency confirmation: the guard is at the correct lifecycle owner and avoids duplicating policy in panel callers, but the noVNC terminal-event premise could not be independently read in this environment. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3d30b3accb23. LabelsLabel changes:
Label 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
|
* origin/main: fix(git-hooks): keep unstaged bytes out of pre-commit formatting (#137723) test(gateway): drain session tool fixture cleanup (#137743) fix: avoid duplicate errors when a desktop disconnects (#137724) refactor: streamline temporary mention retention (#137714) fix(gateway): prevent hosted lifecycle crashes and self-waits (#137456) test(daemon): make managerless port fixture hermetic (#137692)
Desktop stream teardown discarded the observed WebSocket close code and the preceding owner cleanup trigger, leaving normal observer disposal indistinguishable from an unexpected transport close. Record bounded diagnostics once at the observer, broker, and node transport owners without changing forwarding or teardown behavior or logging peer payloads and credentials. Move authenticated macOS snapshot mounts to controller-owned private Darwin temporary storage so external-volume builds use the same verified mount paths for build and cleanup. Preserve read-only source, signing, and cleanup ownership. Repair two native test synchronization boundaries: wait for an admitted reconnect before requesting its lease, and flush post-resize settings layout before sampling the prior pane. Regression and sibling proof covers real socket closes, cancellation/backpressure, snapshot mount cleanup, signed Intel native installation, and real Linux, Windows, and macOS CUA/WebVNC flows. Successful runs do not explain the previously observed intermittent Mac close or historical-marker response; those remain named follow-ups with improved diagnostics. Follow-up to #136297 and #137724. Required exact-head CI passed: https://github.com/openclaw/openclaw/actions/runs/33849738091 . Native proof includes the original ordered SettingsWindowLayoutTests pair, all 2,082 app Swift Testing cases, isolated AppState cases, and 1,627 OpenClawKit cases. Both native build/test jobs passed. Separate optional shared-kit scans were still queued at landing preparation.
Desktop stream teardown discarded the observed WebSocket close code and the preceding owner cleanup trigger, leaving normal observer disposal indistinguishable from an unexpected transport close. Record bounded diagnostics once at the observer, broker, and node transport owners without changing forwarding or teardown behavior or logging peer payloads and credentials. Move authenticated macOS snapshot mounts to controller-owned private Darwin temporary storage so external-volume builds use the same verified mount paths for build and cleanup. Preserve read-only source, signing, and cleanup ownership. Repair two native test synchronization boundaries: wait for an admitted reconnect before requesting its lease, and flush post-resize settings layout before sampling the prior pane. Regression and sibling proof covers real socket closes, cancellation/backpressure, snapshot mount cleanup, signed Intel native installation, and real Linux, Windows, and macOS CUA/WebVNC flows. Successful runs do not explain the previously observed intermittent Mac close or historical-marker response; those remain named follow-ups with improved diagnostics. Follow-up to openclaw#136297 and openclaw#137724. Required exact-head CI passed: https://github.com/openclaw/openclaw/actions/runs/33849738091 . Native proof includes the original ordered SettingsWindowLayoutTests pair, all 2,082 app Swift Testing cases, isolated AppState cases, and 1,627 OpenClawKit cases. Both native build/test jobs passed. Separate optional shared-kit scans were still queued at landing preparation.
Related: #136297 (cloud Desktop readiness and worker lifecycle repair).
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR.
What Problem This Solves
Fixes an issue where users investigating a disconnected Desktop would see an additional, misleading noVNC state error in the browser console after the original stream failure. Both a server-initiated close and a malformed RFB message reproduce it:
Tried changing state of a disconnected RFB object.This was observed while investigating cloud CUA and WebVNC continuity. It does not explain or repair the initiating Mac stream closure.
Why This Change Was Made
DesktopClientowns one noVNC connection. Its terminal callback can synchronously cause the panel to dispose that connection again. The wrapper now retires its handle before calling the consumer, and a caller-initiated disposal is also one-shot. The existing panel, handoff, authentication, and error-reporting flows stay unchanged.The dependency contract was inspected directly in installed noVNC 1.7.0: public disconnect enters the state machine, whose disconnected state is permanent. The terminal event is therefore the canonical point for recording retirement. Moving this guard into panel callers would duplicate the dependency policy and leave direct handle disposal unprotected.
Production: +9/-1 (net +8). The one lifecycle fact belongs in the existing dependency owner; no new abstraction or alternate cleanup path is added. Tests: +12/-1. Existing test cases are extended rather than duplicated. No dependency patch/version, configuration, persistent store, public protocol, timeout, or retry policy changes.
User Impact
The original Desktop failure and Reconnect action remain visible, while cleanup no longer adds a false state-transition error. Control takeover, credentials, and explicit source selection retain their current behavior.
Evidence
Candidate:
fe2b3f5966a8d07c30ac1fd3f5a446ba3d05d016, based on main5c353d56c2f44e50d52f8a1980957609e0ebe855.Commands:
The before/after captures deliberately show the same original failure and Reconnect action. The console regression is independently asserted by the browser tests. Both captures contain synthetic test data only.
Exact-head CI run 33823530266, attempt 2, passed, including the required
openclaw/ci-gate, UI shards, browser shards, and real-Gateway browser suite. Attempt 1 had one cancelled core shard that never acquired a runner or executed a step; the failed-jobs-only retry acquired a runner and passed without changing code, workflows, or timeouts. The separate Mac close-provenance investigation and Windows provider-terminal wording mismatch remain open diagnostic work; neither is claimed fixed here.Review disposition
The September 4, 01:08 UTC ClawSweeper review has no actionable code/security findings. Its four before-merge items and rank-up request all concern independent confirmation of the noVNC lifecycle premise. Confirmed directly against annotated tag
v1.7.0, resolved to commit63107bd06d9e1f6136ff21aeda8cd62cbf0d433e:core/rfb.js:864–868rejects any transition from disconnected; line 911 stores the new state before lines 942–946 dispatch the disconnect event. The public disconnect method and complete state-machine function are byte-identical in our installed package and this upstream source. Full upstream file SHA256:c46dfefbf869eda0c6d06c5dd86c42e96fc8a77c125e91599a2cdf3841261564. The dependency links above now use that immutable commit and the precise guard line. Retain the existing owner-level retirement fact and its +8 production lines; this avoids duplicated policy in callers and protects repeated direct disposal as well as reentrant cleanup. No source change was needed after review.