Repository navigation
fix(desktop): retain stream close diagnostics - #137787
Conversation
Record the first local cleanup trigger separately from the observed WebSocket close code across observer, broker, and node transport owners. Preserve existing teardown and omit peer reason text, tickets, credentials, and frame payloads.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 2:47 AM ET / 06:47 UTC. ClawSweeper reviewWhat this changesThe PR records bounded close diagnostics at desktop stream owners, moves macOS read-only snapshot mounts to private temporary storage, and removes a reconnect race from a macOS test fixture. Merge readiness⛔ Blocked before merge - 4 items remain No introduced correctness or security defect was found. This maintainer-authored PR remains on the normal merge path because exact-head CI is incomplete and the Priority: P3 Review scores
Verification
How this fits togetherDesktop observers, paired nodes, and the Gateway broker jointly relay desktop streams; this change makes their terminal cleanup observable without logging sensitive transport data. Separately, the macOS packaging controller creates authenticated source snapshots and now mounts them outside the checkout before cleaning them up. flowchart LR
Browser[Desktop browser panel] --> Observer[Gateway observer]
Node[Paired node] --> Transport[Node stream transport]
Transport --> Broker[Gateway stream broker]
Observer --> Diagnostics[Bounded close diagnostics]
Broker --> Diagnostics
Transport --> Diagnostics
MacBuild[macOS build controller] --> TempMount[Private snapshot mount]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +84, Tests +245, Docs +9, Other +23. Total +361 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the owner-local diagnostics and temporary mount lifecycle, after independently confirming the pinned WebSocket contract and obtaining a complete green exact-head CI rollup. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the changed test suites exercise local WebSocket/TCP closure and packaging cleanup paths, though this read-only review did not execute them. Is this the best way to solve the issue? Yes, with one evidence gap: recording each terminal fact at the existing transport owner avoids downstream inference, while the WebSocket close-code interpretation still needs direct dependency confirmation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fd9adb5af2c2. 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 (4 earlier review cycles)
|
Keep snapshot images and build output on the checkout volume, while the Swift controller owns the OS-provided private mount directory and passes its exact architecture path to both build and cleanup. Preserve read-only source authentication, process-tree ownership, uncertain-cleanup locks, and atomic signed app publication. An external APFS checkout reproduced hdiutil Permission denied for the checkout-local mount. The same image mounted read-only in Darwin user temp; the repaired canonical helper authenticated a synthetic Git checkout and cleaned both locations. Extend existing lifecycle and snapshot coverage.
|
@clawsweeper re-review The new head adds a separately reviewed Mac snapshot mount prerequisite needed for live native validation. The PR body preserves the diagnostic proof and the distinct mount red/green evidence, and now pins the byte-verified ws 8.21.3 dependency contract. Full current-head CI and the live three-owner WebVNC close trace remain pending; no claim that the earlier spontaneous close is fixed. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Refresh the cloud desktop diagnostics branch over current main, including its canonical CI package-prewarm and advisory-retry repairs. Observe an admitted replacement lease instead of issuing a health request while a failed reconnect still owns disconnect cleanup. Share that fixture boundary across same-route recovery cases while preserving the original assertions, deadlines, and explicit first connection to a replacement Gateway. Production connection and retry behavior remain unchanged.
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.
Follow-up to merged #136297 and #137724.
Additional instructions
MUST: Keep Allow edits from maintainers enabled.
Scope and current status
Current head:
44b5327584e87e430e66962cacbb0c2f4dba5b49; the preceding runtime candidate6668d8a2was refreshed over main94268df40516d5e83bd52a0131e6f74d59ab519f. Repairs cover stream diagnostics, Mac snapshot mounting, and a newer-main test-only reconnect race. The original intermittent Mac stream loss and earlier wrong-marker response remain unexplained.Current-head CI passed on
44b53275. The 111 successful first-attempt jobs and 14 skips were preserved; only two unassigned, zero-step Swift jobs and their dependent rollup were canceled. Failed-only attempt 2 passed both native jobs on hosted macOS 26, including the full app test step. The requiredopenclaw/ci-gatecheck completed successfully at 08:19:02 UTC. Two separate optional shared-kit Periphery scans remain queued; they are not represented as completed proof.CI attempt 3 on
6668d8a2failed atSettingsWindowLayoutTests.swift:68: the pre-tabNSScrollViewwas nil after resize. The Swift Testing portion passed 2,082 tests in 218 suites, including SkillsOwnership and all three Cron cases. The release build and OpenClawKit passed earlier. Attempt 2's initial 2-second Cron readiness failure occurred before its cancellation branch; Cron passed unchanged on attempt 3, with no Cron fix.The three-line, test-only follow-up uses the existing
waitForLayoutpredicate for detail-view presence aftersetContentSize, before sampling the previous view identity. It changes no production code, assertion, or timeout. The local changed gate, SwiftFormat, and strict SwiftLint passed; independent P0–P2 review found no actionable findings (confidence 0.96). Native CI on44b53275passed. The original ordered settings pair passed (3.042 seconds and 5.903 seconds), with all four app XCTest cases green. The app Swift Testing run passed 2,082 tests in 218 suites, followed by both isolated AppState cases; Skills ownership and all three Cron replacement-refresh cases passed. OpenClawKit passed 1,627 Swift Testing cases in 124 suites. CI tested merge61f021b80cf49c366ab812485d493ee24e9140e9, combining this head with main0d2169fdabc48931e666ab227daca779fa9cba65. The live proof below belongs to its explicitly named runtime candidate; the only change since that proof is this test synchronization.Repairs and ownership
Teardown lost the observed WebSocket close code and preceding cleanup decision. The node transport now retains its first cleanup trigger; the broker records known attach rejection/socket error; the observer replaces its closed boolean with its first trigger and requested cleanup code. Each owning socket logs its actual close code once, separately from requested cleanup.
Forwarding, authentication, keepalive, backpressure, outcomes, and cleanup order are unchanged. No transport retries, timeouts, configuration, protocol fields, persistence, or alternative paths were added. Logs omit peer prose, credentials, tickets, tokens, and desktop payloads.
Installed
ws8.21.3 was inspected and its stream wrapper matched byte-for-byte to immutable upstream source: WebSocket close produces Duplex EOF, while consumer destruction can terminate the socket. Code 1006 alone therefore does not establish failure or proxy fault; the docs explain this.On external APFS,
hdiutil attachrejected a checkout-local authenticated snapshot mount; the same image mounted read-only in Darwin temporary storage. The Swift controller now owns one private root fromgetconf DARWIN_USER_TEMP_DIR, passing identical architecture paths to build/cleanup. Images, outputs, and atomic staging stay on the checkout volume. Authentication, read-only mounting, process cleanup, and signing remain mandatory; uncertain cleanup retains paths and locks.The newer-main Swift test requested a lease after reconnect started but before disconnect cleanup finished. A shared fixture wait now observes an admitted replacement across sibling paths, preserving the 2-second bound, 5 ms cadence, route identity, and install assertions. Production safety is unchanged. The failed merge-tree CI run is retained; its test arrived through #137502 and was absent from bare
618bce0a.At
44b53275, the 13-file delta is production +121/-29 (net +92), tests +301/-38 (net +263), docs +12/-3 (net +9). The layout repair adds three test lines over6668d8a2; all production and documentation bytes are unchanged. Growth supplies three-owner diagnostics (+84) and mount ownership (+8). The Swift fixture adds 15 net test lines, no production lines; the original 11 files are byte-identical to618bce0a.Validation and review
Both TLS/proxy close regressions failed before repair; the initial zero-case filter is excluded. 84 real-socket cases passed on unchanged
6668d8a2: desktop/portal, TLS/proxy, explicit/abrupt close, abort, backpressured EOF, view-only filtering, cancellation, and concurrent observers. The pre-fix mount regression failed; 85 packaging tests passed, including cancellation, wrong-source, and cleanup failure. The real snapshot helper verified authenticated synthetic source, read-only mount, and cleanup.At
6668d8a2, the local changed gate passed 1,090 tests/20 files, types, lint, and guards; independent P0–P2 review found no actionable findings. After an installed Bash 5.3.15heredoc_writestall matching the upstream Darwin report, validation used a task-local build with its supported 512-byte cap; 24 byte-exact shell checks passed. Installed shell, assertions, and deadlines stayed unchanged; failures remain recorded.The latest ClawSweeper review found no introduced defect at
6668d8a2; its missingwsinspection is supplied above. Its serialized-state flag concerns temporary storage:peekaboo-commit/cleanup-completebytes and consumer are unchanged.scripts/build-mac-swift.mtsremoves verified mounts, retaining uncertain cleanup. No runtime store/schema/format/upgrade contract changes; no migration is needed. The dependency inspection above and successful required exact-head CI satisfy the Rank-up requests. Independent reviews found no actionable P0–P2 defects; the earlier bot confidence label is not claimed to have changed.Fresh integration:
6668d8a2Gateway /618bce0anative appThe full canonical Gateway build/install was accepted at
6668d8a2, with retained618bce0anative app. Two real turns each made one screenshot call and returned the correct requested witness. Both actual 1024×768 tool images were visually checked. Placement and reported worker-bundle identity stayed unchanged; sampled authority state was empty between turns and before/after normal reclamation.The UI showed the second turn as active, then completed with “Done in 25 seconds.” Normal WebVNC Back navigation, manual ScreenSharing reauthentication, and a new viewer returned a fresh locked desktop at 07:07 UTC, after normal idle lock. This smoke is screenshot-only. Two initial optional physical probes failed. A corrected read-only probe subsequently matched the installed native app markers and public device identity, and both exact native launch/turn journals were completed. The expected worker cache path was absent after reclamation; the cause is unobserved. A later exact-PID observation found both recorded turn workers absent and their original supervisor still present with a matching start time. Independent worker-bundle hashing, descendant-process cleanup, and temporary-state absence remain unverified. No native VNC client was used.
A later long-lived viewer check found a real disconnect. A bounded read of the actual installed
618bce0anative log, with log/app/node identities checked before and after, foundwebsocket-close/1006 at 07:33:19.001 UTC. The Gateway broker recordedwebsocket-close/1006 at 07:33:19.176, then the observer recordedstream-close/1000 at 07:33:19.177. No owner-abort, target-close, or error trigger was recorded. Neither the native nor Gateway socket's close initiator is established by these records or their timestamp order.Source inspection confirmed that the explicit zero invoke timeout disables expiry on this stream path and that the RFB timeout covers only its handshake. No speculative timer or transport fix was made. Normal Reconnect restored a fresh locked desktop in the same viewer at 07:58, without password re-entry or native supervisor restart. This demonstrates recovery after an observed interruption, not uninterrupted long-lived viewer reliability.
Earlier complete OS proof:
618bce0aThe clean
618bce0aIntel build passed snapshot mounting, worker readiness, and strict deep signing verification. Archive hash/content/mode/link checks verified transfer and installed identities; Accessibility and Screen Recording grants survived.Normal WebVNC Back navigation at 2026-09-04 04:17:34 UTC produced one record at each owner:
browser-closewebsocket-closewebsocket-closeFresh log identities/offsets bound these records. Without a common stream ID, this is correlation for one controlled observer and verified processes/builds. Reattachment produced a fresh frame; the original intermittent close initiator remains unknown.
Mac: two turns completed 14 computer actions. Both fresh prompts reached outbound input; all 16 responses, including arguments/text/deltas, matched normalized output. Passive WebVNC and stable readback showed both markers once and preserved the 229-byte prefix. Final file: 265 bytes, SHA-256
e8dbe4f0065d0b7a8c5508ab8f269174a3e1bdd604d78a9d0223a419de73ea1d.Mac projections capped at 512 items; fresh prompts were captured separately, but 24 older-context items lack projections despite complete-send hashes. Full requests do not prove incremental continuation or complete historical-context fidelity. An earlier eight-call turn chose and reported a historical marker: that proof remains failed and unexplained; the successful pair does not establish its cause.
Before the Gateway refresh, WebVNC canvas input unlocked the idle Mac and a view-only frame preserved the document/markers. The first textarea attempt had no visible success; its cause remains unknown.
Windows: the same logical session/history continued after Mac reclamation: 2 native exec + 13 computer calls, 15 successful tool calls, two final replies across two turns. All 410 history messages were covered; 17 raw responses matched normalized output with zero gaps/mismatches. Full initial histories do not prove incremental continuation. Passive WebVNC confirmed markers and counter 1→2. Fixture process/journal stayed intact: no reset, correction, replay, or device/placement change.
Both Windows files were 322 bytes; their recorded SHA-256 digests matched byte-for-byte after normal reclamation into the canonical workspace, with no pending authorities/claims. Captures were removed; all 17 Windows responses preceded the original 15-minute cutoff. Reclaim exited/joined successfully; Crabbox reports released/cleanup complete, without independent AWS inventory proof. The Mac and dedicated host remain retained.
Historical failures and follow-ups
The separate 618b hosted run passed both Swift jobs. Its UI shard passed on retry; four failures remained in attempt 2:
Follow-ups: Cron initial readiness (passed unchanged on attempt 3; cause unproven), Gateway timeout, Android admission, runtime cold starts, malformed successful npm advisory responses (distinct from timeout), and UI animation synchronization. Optional tool-argument padding optimization remains deferred: the actual auth/route binding was not established, so no schema or auth changes were made. Historical failures remain recorded.