Skip to content

fix(ui): retain desktop viewer through control handoff - #134903

Merged
steipete merged 4 commits into
mainfrom
codex/desktop-authenticated-handoff
Sep 1, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/desktop-authenticated-handoff

Conversation

@steipete

@steipete steipete commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Switching a Windows desktop from view-only to control could close the only authenticated VNC viewer before its replacement authenticated. On the real TightVNC 2.8.85 host this disconnected the replacement twice; retaining a second authenticated viewer made the same transition succeed.

The existing desktop connection owner now retains at most one same-source viewer, disables its input immediately, and retires it when noVNC reports an authenticated connection. Observe RPC completion and a returned client handle are not that boundary. Failure, credential prompting, source changes, hidden panels and unmount release both connections. A canceled lazy noVNC load also checks the existing operation identity before opening a control WebSocket.

This replaces the nullable-handle lifecycle; Gateway authentication, controller arbitration, observer caps and view-only filtering are unchanged. There are no new dependencies, configuration, timeouts, retries or compatibility paths. Production delta is +79/-27 (net +52): bounded overlapping connection ownership and explicit input/readiness transfer require state that the old single-handle owner could not express. Duplicate environment lookup was removed. Desktop tests/support are +304/-19; the Code Mode CI fixture follow-up is +5/-6. Release-note context stays here; the release-owned root changelog has no PR delta.

Validation:

  • Captured pre-fix failures in real noVNC E2E, panel lifecycle tests and canceled lazy-load coverage; all pass with the fix. The E2E asserts authenticated old → authenticated replacement → old closed.
  • 22 unit tests, 35 Desktop browser tests, UI production/test types, scoped lint, keyless i18n verification and canonical UI build passed. Managed Codex P0 review found no actionable findings.
  • Live Windows Server 2022/TightVNC 2.8.85: sole-viewer Take control passed, both directions passed in the focus view, six additional alternating transitions passed, and leaving during handoff followed by a fresh control connection passed. Keyboard input after handoff reached Notepad.
  • Native TightVNC had exactly one established viewer after handoffs and zero after the sole viewer closed. Switching to view-only blocked a subsequent keypress, so retaining the predecessor did not retain input or leak a viewer.
  • A real OpenClaw worker turn placed on the same Windows device executed Node in its remote workspace, wrote a marker reconciled through the normal workspace owner, and called computer screenshot. The retrieved image independently showed the text entered through WebVNC. The turn completed; the separate Windows worker cleanup defect is repaired and live-verified in fix(worker): close owned state before removing runtime directory #134911, not changed by this UI PR.
  • Live Gateway/node package is d1111d9 plus this exact UI candidate. Served entry and desktop chunk hashes were verified. The eight desktop files remain byte-identical to the tested candidate after integration onto main 0449cd1. Exact PR CI is additional integration evidence.

The TightVNC source supports a last-client teardown race: it clears/deletes the old desktop while a replacement can be authenticating, and an old IPC close can disconnect clients. The internal callback race was not instrumented; the live failure/control comparison and real-noVNC ordering regression are the direct repair evidence. macOS ARD authentication remains Gateway-owned; this is not a claim of live macOS GUI proof.

Before (sole-viewer Take control):

Windows desktop disconnected during control handoff

After (same panel remains connected):

Windows desktop connected after control handoff

CI follow-up and integration:

  • The first CI run exposed an existing release-plan inventory overflow: the full Git tree exceeded Node’s default 1 MiB output buffer. Main already landed the canonical metadata-only enumeration repair in perf(ci): shorten release verification tails #134824; this PR integrates that main revision rather than carrying a second fix. Its large-tree, four symlink, and current publisher-inventory regressions passed (6 tests).

  • An existing Code Mode lifecycle fixture assumed one wait must be terminal despite the runtime’s per-call budget. It now uses the existing bounded helper to resume the same run; the two executions, exactly-once lifecycle and cleanup assertions are unchanged. No runtime budget, timeout, action replay or production behavior changed. Fresh managed Codex P0 review and canonical changed-file checks passed.

  • Both complete agent files passed (30 tests), including the unchanged acquired/borrowed/empty transport table. The prior acquired-transport timeout in the 85-file CI shard remains unexplained; the focused pass does not replace that original evidence. The prior integration run is 33480747319; its fullscreen handoff timing failure is repaired below.

  • The integrated CI run exposed one additional fullscreen test race: it queried a strict single canvas after the observation RPC acknowledged, while the intended authenticated handoff still held both canvases. The existing test now waits for retirement of the original canvas (owned by replacement noVNC connect) before its single visible-canvas assertion. Fullscreen identity, geometry and control assertions remain. All three complete Desktop E2E files passed again (35 tests), and canonical changed-file checks passed. Production bytes are unchanged.

Fresh managed Codex review of the complete candidate found no actionable findings. The final test repair is commit e5af1515ecb4782403b95ac9cfc5d105c3303c5b; GitHub branch state confirms it is pushed. Exact-head PR checks remain required before native landing.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete force-pushed the codex/desktop-authenticated-handoff branch from eb378be to 261df68 Compare September 1, 2026 07:08
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 1, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 11:57 AM ET / 15:57 UTC.

ClawSweeper review

What this changes

The PR retains a disabled same-source desktop viewer until the replacement RFB viewer connects, so switching between view-only and control does not tear down the only authenticated session.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this maintainer-authored, maintainer-labelled PR open for explicit owner handling. The exact head has no blocking correctness finding: it moves the overlapping-viewer state into the desktop connection owner and the previous CI rank-up is resolved by a successful current-head CI gate.

Priority: P1
Reviewed head: e5af1515ecb4782403b95ac9cfc5d105c3303c5b
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful ordering and cleanup coverage; explicit maintainer handling remains required by the protected author/label state.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor proof gate does not apply to this member-authored PR; the reviewed PR body nevertheless records Windows/TightVNC after-fix evidence and before/after attachments, while the source E2E independently covers the production-client ordering path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor proof gate does not apply to this member-authored PR; the reviewed PR body nevertheless records Windows/TightVNC after-fix evidence and before/after attachments, while the source E2E independently covers the production-client ordering path.
Evidence reviewed 6 items Owner-boundary repair: The panel passes an operation-current predicate to the RFB client and transfers connected state only from the replacement connection callback; stale work is disconnected after the await.
Bounded handoff lifecycle: The new owner retains at most one prior handle, disables its input, and releases it when the replacement reports connected; cancellation clears both handles.
Regression coverage: The browser E2E runs the production DesktopClient against a scripted RFB endpoint that models last-peer teardown and asserts replacement authentication before the old viewer closes.
Findings None None.
Security None None.

How this fits together

Control UI asks the Gateway for a desktop observation endpoint, then DesktopClient creates the browser’s noVNC/RFB viewer. The desktop panel owns presentation state and now coordinates the old and replacement viewers during a control handoff.

flowchart LR
A[Desktop control toggle] --> B[Gateway desktop observation]
B --> C[Desktop panel handoff owner]
C --> D[Retained view-only viewer]
C --> E[Replacement RFB viewer]
E --> F[Authenticated connection event]
F --> G[Old viewer retired]
C --> H[Desktop panel state]
Loading

Decision needed

Question Recommendation
Does the desktop owner approve landing the bounded two-viewer handoff lifecycle on the current exact head? Approve the handoff lifecycle: Accept the bounded temporary overlap backed by the panel lifecycle tests, production-client E2E ordering check, and successful current-head CI gate.

Why: The PR is authored by a repository member and carries the protected maintainer label, so this workflow must leave the final landing decision to explicit maintainer handling.

Before merge

  • Resolve merge risk (P1) - The repair adds a +52-line production lifecycle owner for temporarily overlapping RFB viewers; a mistake here could still interrupt a desktop session during handoff, so explicit desktop-owner review should confirm the bounded two-viewer model.
  • Complete next step (P2) - No repair job is appropriate: this clean member-authored PR has no actionable code finding and requires explicit protected-label maintainer handling.
Agent review details

Security

None.

PR surface

Source +52, Tests +284. Total +336 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 3 79 27 +52
Tests 7 309 25 +284
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 388 52 +336

Review metrics

Metric Value Why it matters
Production versus test delta production +79/-27 (net +52); tests/support +309/-25 (net +284) The production growth represents bounded overlapping connection ownership; the larger test delta exercises callback ordering, cancellation, cleanup, and the browser-level RFB sequence.

Merge-risk options

Maintainer options:

  1. Approve the bounded viewer overlap (recommended)
    Accept the temporary second viewer after the desktop owner confirms that preserving the authenticated session outweighs the contained lifecycle complexity.
  2. Pause for a smaller lifecycle shape
    Keep the PR open if the owner wants the overlap represented through a different existing desktop lifecycle abstraction.

Technical review

Best possible solution:

Land the bounded same-source handoff after explicit desktop-owner sign-off, retaining one input-disabled predecessor only until the replacement RFB connection reports ready.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: the new production-client E2E models the last-viewer teardown and asserts the required authenticated-old → authenticated-replacement → old-closed order, which the former eager disconnect could not preserve.

Is this the best way to solve the issue?

Yes. The handoff state belongs in the desktop connection owner, rather than in Gateway observation or a downstream UI guard; it also disables the retained viewer immediately and clears it on each failure path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 60c5793325d0.

Labels

Label changes:

  • add merge-risk: 🚨 availability: The PR changes the lifecycle that keeps an active remote-desktop viewer available while its replacement authenticates.

Label justifications:

  • P1: A failed view/control handoff can disconnect an active desktop session for users.
  • merge-risk: 🚨 availability: The PR changes the lifecycle that keeps an active remote-desktop viewer available while its replacement authenticates.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor proof gate does not apply to this member-authored PR; the reviewed PR body nevertheless records Windows/TightVNC after-fix evidence and before/after attachments, while the source E2E independently covers the production-client ordering path.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-01T07:23:04.775Z sha 261df68 :: needs maintainer review before merge. :: none

@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Verification for source commit e5af1515ecb4782403b95ac9cfc5d105c3303c5b: the panel retains one input-disabled viewer until the replacement completes noVNC authentication. Gateway authority and observer limits are unchanged. Failure, cancellation, source changes and unmount drain both handles. Production delta is +79/-27; tests/support are +309/-25.

Focused commands passed:

  • node scripts/run-vitest.mjs ui/src/components/desktop/desktop-panel.test.ts ui/src/components/desktop/desktop-client.test.ts — 22 tests.
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/desktop-panel.e2e.test.ts ui/src/e2e/desktop-document-mode.e2e.test.ts ui/src/e2e/desktop-panel-fullscreen.e2e.test.ts — 35 tests.
  • node scripts/check-changed.mjs -- ui/src/e2e/desktop-panel-fullscreen.e2e.test.ts — passed; original candidate also passed production/test types, scoped lint, keyless i18n and canonical UI build.

Fresh managed Codex review of the complete candidate found no actionable findings. Live Windows/TightVNC before/after, control input, view-only input blocking, repeated transitions, cancellation/reconnect and one/zero steady/closed peer counts are documented in the body, including sanitized images. The fullscreen CI failure is preserved and repaired by waiting for original-canvas retirement at replacement authentication. Current main supplies the separate release-inventory fix; the Code Mode fixture resumes its same bounded run. No macOS GUI claim is made by this PR. Installed noVNC1.7 source was directly checked for input disablement, its ServerInit-to-connect event and per-client screen cleanup.

Required CI: run 33526986212. The latest ClawSweeper review has no source finding; its rank-up request is to resolve the required exact-head gate.

The canonical exact-head watcher completed GREEN with zero pending checks. Native review artifacts validate and the required CI gate passed. Proceeding through repository-native preparation and merge; no rule bypass.

@steipete
steipete merged commit 1b236df into main Sep 1, 2026
235 checks passed
@steipete
steipete deleted the codex/desktop-authenticated-handoff branch September 1, 2026 16:03
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 2, 2026
* fix(ui): retain desktop viewer through control handoff

* docs: leave desktop release notes to release generation

* test: resume Code Mode lifecycle through waiting results

* test(ui): await authenticated fullscreen handoff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant