Repository navigation
Conversation
Open Dashboard marked the tunnel up as soon as ssh.exe started, then put the shared token in the browser URL. Wait for the same listener ownership check StartOwnedAsync uses, and do not build that URL when the wait fails. - Add EnsureSettingsOwnedForwardReadyAsync for the settings-owned forward - Stop the forward and show the existing tunnel toast when ownership fails - Leave direct dashboard opens unchanged when SSH is off Signed-off-by: Sebastien Tardif <[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 real behavior proof before merge. What this changesThis PR waits for SSH listener ownership before opening Dashboard and retains browser endpoints across tunnel shutdown and saved-gateway switching. Example: An SSH gateway saves ws://gateway.example:18789/mount/ with local forward port 19049.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 19 items remain Keep this PR open: main still needs the Dashboard credential-safety repair, but credential routing and SSH lifecycle defects block merge. Priority: P1 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherGatewayDashboardLauncher receives registry credentials and an SSH endpoint, then submits a browser URL; GatewayConnectionManager separately owns operator and node connection authorization. flowchart LR
A[Dashboard action] --> B[Registry credentials]
B --> C[Dashboard launcher]
D[Connection manager] --> E[SSH tunnel service]
C --> E
C --> F[Browser]
F --> G[Loopback guard]
G --> E
E --> H[Remote Gateway]
Technical reviewBest possible solution: Keep Dashboard dispatch in its existing owners and let GatewayConnectionManager coordinate one record-bound runtime endpoint with matching authorization, network routing, and durable browser protection. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the missing owned-forward browser binding, and current-head callers establish the reported failure paths; no target code or tests were executed during this review. Is this the best way to solve the issue? Owned local navigation is necessary, but the patch must preserve manager generations, use the actual runtime destination for every credential-bearing request, and retain the existing browser isolation owner. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e70292487958. Provenance checked
TestingProof path: shipped entry point. SecurityNeeds attention: Credential binding, endpoint retention and relocated-port authorization can expose authentication to unintended destinations. EvidenceSecurity concerns:
What 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
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label 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 (34 earlier review cycles; latest 8 shown)
Reviewed November 7, 2026, 12:02 PM ET / 17:02 UTC (Revision 35). |
|
Global triage: HOLD_FOR_AUTHOR. Take confidence 10%; recommendation confidence 97%; effort medium; risk high. Two handoff races block this exact head:
Please carry a generation-bound ownership lease through browser launch, prevent replacement during that handoff, and guard failure-state updates by the captured process/generation. Add overlapping-attempt and replacement-before-launch regressions. Run The E2E setup refusals appear shared/baseline; the UI lane timed out and remains unresolved. CI Gate is derivative, so the required current-head proof is not green. |
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 0f6d0b3f-48b9-489e-a9dd-a736c63d485b
Resolve the dashboard credential and endpoint from one immutable gateway snapshot, preserve newer tunnel state when an older ownership wait fails, and revalidate the exact tunnel generation at browser handoff. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 0f6d0b3f-48b9-489e-a9dd-a736c63d485b
|
@clawsweeper re-review Current head 6649c8b fixes the endpoint snapshot mismatch, preserves newer tunnel state, and holds a generation-bound owned-listener lease through browser handoff. Full local build plus Shared, Tray, and Connection suites pass. The PR body now includes current-head isolated WinUI/MCP/browser proof and the explicit live-SSH blocker. |
|
🦞👀 Re-review progress:
|
Restore PR openclaw#1514 to SebTardif's original four-file patch after the maintainer repair exceeded the bounded review scope. This reverts commit 6649c8b. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 0f6d0b3f-48b9-489e-a9dd-a736c63d485b
The listener check returned before the shared-token URL was handed to the browser, and an older wait wrote Failed onto a replacement tunnel. Dashboard launch now keeps the generation from the ready check and refuses to start the browser if that generation is no longer the settings-owned forward. A wait that has already lost the process does not publish failure. Tests: EnsureSettingsOwnedForwardReadyAsync 2 passed. Dashboard contract tests 2 passed. ./build.ps1 exit 0. Shared 4107 passed, 32 skipped. Tray 3116 passed. Signed-off-by: Sebastien Tardif <[email protected]>
A manager-owned tunnel was rejected even when it was the verified forward. The failure flag was written after the ownership lock was released, so an older wait could mark a replacement failed. Open Dashboard now accepts a settings or manager owner, requires the dashboard URL to use that local port, and keeps the process alive until the browser launch returns. Tests: EnsureSettingsOwnedForwardReadyAsync 2 passed. Dashboard contract test passed. ./build.ps1 exit 0. Shared 4107 passed, 32 skipped. Tray 3116 passed. Signed-off-by: Sebastien Tardif <[email protected]>
A stop during the browser handoff used to return and let a later start publish a new process over the old listener. A different tunnel spec now fails while that handoff is active, and the old process stays the tracked one. Ending the handoff no longer stops the forward, so the port stays up after the browser is launched. Tests: SshTunnel 67 passed. ./build.ps1 exit 0. Shared 4107 passed, 32 skipped. Signed-off-by: Sebastien Tardif <[email protected]>
…f lease A handoff could make StopLocked return while the caller still replaced the tunnel, and StopIfOwnedAsync reported that deferred stop as complete. Signed-off-by: Sebastien Tardif <[email protected]>
…f ends A stop or reset during a browser handoff was dropped, so the forward stayed up after the launch and a reset could report NotConfigured while the process was still running. Signed-off-by: Sebastien Tardif <[email protected]>
…e browser connects Open Dashboard waited for one SSH forward, then read the active gateway again. A different gateway on the same local port could send its token through the forward that had just been checked. The launch now keeps one gateway identity, tunnel destination, and token snapshot through that wait and the browser handoff. A token rotation on that same gateway and destination still opens. Process.Start returns before the browser connects. A stop recorded during launch used to run as soon as the handoff method finished, which freed the port while the browser still held the token URL. A stop that is already waiting skips the launch and completes. A stop that arrives during launch keeps the listener until an established loopback connection uses the forward, or until ssh exits. If that connection does not show up, the listener stays up. Signed-off-by: Sebastien Tardif <[email protected]>
Core and CLI failed only WaitForOperatorHandshakeAsync_ReturnsTrue_WhenStateEventFires. The wait returned false after 934 ms. That test is not in this change, and it passed locally in 14 ms. The SSH handoff tests in the same job passed. Signed-off-by: Sebastien Tardif <[email protected]>
The dashboard snapshot read the active gateway again after resolving the token, so a switch could pair one gateway's token with another's identity. The browser lease and a deferred stop are now decided under one lock. An established loopback connection releases that stop only when it is new for this handoff and, for an accepted socket, owned by the SSH process. Validation: ./build.ps1 exit 0. Shared 4107 passed, 32 skipped. Tray 3116 passed. Connection SSH and TCP snapshot tests passed 40. Signed-off-by: Sebastien Tardif <[email protected]>
|
Global triage: HOLD_FOR_AUTHOR. Take confidence 20%; recommendation confidence 98%; effort medium; risk high. Reviewed exact head Author: investigate the 1 failing check(s), establish whether each failure is branch-owned, and publish a green exact-head CI Gate before reconsideration. This is a triage classification, not a merge action. No branch changes were made. |
|
I'd hold this revision until the credential-binding and lifecycle issues below are addressed. Reviewed head:
For the credential-exposure cases, the token is in the URL fragment, but a page served by the wrong or replacement listener can read it. Releasing or re-pinning a protected port merely on timeout or shell submission is not a safe fix. The existing same-port gateway-switching policy decision also remains open. Before merge, please run the build, Shared, Tray and Connection suites on the integrated head and provide an isolated connected-tray smoke covering Dashboard open, saved-gateway switching, proxy toggles and repeated manager restart. |
|
Hi @SebTardif, I'm a Copilot triage agent helping the maintainers work through the ready queue (not Scott himself). Thanks for all the work here; the proof with real ssh.exe is really helpful. We'd like to land this, and the one thing holding it is the shared local port behavior. Right now, once Open Dashboard has been used, a different saved SSH gateway that uses the same local port can't connect through that port until the app restarts. Many people keep several SSH gateways on the default port, so we'd prefer to keep the new protection without that restriction: keep the old Dashboard endpoint protected, but still let another saved gateway connect without changing its stored settings. Could you take a look at that when you have time? A small regression test that switches between two saved SSH gateways sharing a port would be great too. No rush, and happy to help if anything is unclear. |
Opening Dashboard pins the saved forward port to that gateway. A later saved gateway that stores the same port now listens on a new runtime port instead of failing the destination check. The saved port stays pinned to the first gateway, and the stored local port is not rewritten. Stopping the second gateway leaves the first dashboard port in place. The new switch test failed on that release before the filter. Signed-off-by: Sebastien Tardif <[email protected]>
|
The shared local port case is handled on 6c7b974. Opening Dashboard still pins that saved port to the first gateway. A second saved SSH gateway that stores the same port now gets a different runtime listener. The stored local port is not changed, and stopping the second gateway does not release the first port. SelectSharedPortListen_SecondSavedGatewayUsesARuntimePort and Stop_SecondSavedGatewaySharingTheDashboardPort_KeepsTheFirstDestination cover that switch. The stop test failed before the change. ./build.ps1 passed. Shared tests passed 4226 and skipped 33. Tray tests passed 3808. The runtime port was not opened with ssh.exe or a browser. The earlier ssh.exe and tray dialog proof is still from 2a20af4. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Keep the owned dashboard forward and the runtime port for a second saved SSH gateway. The setup dashboard launcher from main stays. SSH argument checks use the loopback bind. Signed-off-by: Sebastien Tardif <[email protected]>
|
Merged main so this pull can run product CI. Head 2651ebd. Open Dashboard still uses the owned forward. A second saved SSH gateway that stores the same local port still gets a runtime listener, and the first dashboard port stays pinned. The setup dashboard path from main is unchanged. ./build.ps1 passed on the resolved tree. On 2651ebd, shared tests passed 4878 and skipped 24. Tray tests passed 5297. The runtime port was not opened with ssh.exe or a browser. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Channels navigation waits for the fixture log from DashboardBrowser. Opening the URL with the shell directly never wrote that log, so the UI tests timed out on the chat page. Signed-off-by: Sebastien Tardif <[email protected]>
PR cleanup reviewReviewed head: Thanks for the fixture-launch repair. At 2b003b6, both ordinary paths now use DashboardBrowser, and the exact-head UI job passes. This is still needed on main, so I would keep the PR open rather than close it as superseded. The remaining blockers include mixing active-registry credentials with global SSH settings, verifying the relocated proxy port while sending to the saved port, and losing pending-navigation protection during concurrent or repeated teardown. Please bring the repair through one record-bound runtime endpoint and the connection-manager lifecycle, then add current-head two-gateway, proxy and repeated-teardown proof. The current CI Gate is also red; the failing Tray test is SettingsChangeCoordinatorTests.Apply_ConcurrentPermissionChanges_PreserveFinalDisabledOrder, not the repaired fixture launch. This is a source-level triage finding, not landing clearance. 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. |
|
This pull request has been automatically marked as stale due to inactivity. |
What Problem This Solves
Open Dashboard could send a gateway token through an SSH forward that belonged to a different gateway, and it could drop that forward before the browser connected.
User Impact
The browser opens only when the gateway identity and SSH destination still match the ones checked before the wait. If a stop is already waiting before the browser is opened, the dashboard does not open and the stop finishes.
A saved gateway URL that names a remote host is left in settings. GatewayDashboardLauncher builds the browser URL. That URL keeps the saved mount path, query, and fragment, and uses the verified local forward for the host and port.
Before that URL is handed to the browser, this app binds both 127.0.0.1 and ::1 on the public port. SSH listens on a backend port. Guarded gateway clients use 127.0.0.1. If the tunnel already belongs to the connection manager, the replacement stays on that owner. Stop and Reset after the navigation is submitted end the SSH process and leave the public port occupied. Recovery drops the launch lease and can start SSH again on a backend port for the same user, host, remote port, and SSH port. A guard created for a start that fails before the browser opens is released.
Browser traffic is copied only when the accepted loopback socket belongs to that SSH process and the process start time still matches. Browser-proxy forwarding uses the saved local port. Local proxy ports 65534 and 65535 remain valid. The remote gateway port still has to leave room for the proxy's
+ 2.A failed browser open shows the existing Connection notification and retry dialog. Retry keeps the requested path. A successful open dismisses that notification. The launch error is not written to the log, because the message can contain the token URL.
Switching to another saved SSH gateway that stores the same local port keeps the older dashboard port pinned to the first destination. The second gateway listens on a new runtime port. Its stored local port is not rewritten.
Why This Change Was Made
The ownership wait returns the generation, local port, and SSH process id that passed listener verification.
The public port has to be owned on every loopback address the client can select, before SSH exits and before the browser receives the URL. Manager-owned tunnels keep that owner. A failed start does not leave the new bind behind.
Dashboard URL construction and launch failure handling stay in GatewayDashboardLauncher.
Evidence
The
ssh.exesession below is from parent2a20af4a0d672d61fec4ba95d88d49a7c5bc119e. Head6c7b974084eebd5f629fdf0baf2612b1cd008418adds the second-gateway runtime port and was not part of that session.SshTunnelService.EnsureSettingsOwnedForwardReadyAsyncstarted realssh.exeto[email protected]port 22, with BatchMode and no password. The guest HTTP server listened on127.0.0.1:19048. The owned forward was local port 19049, ssh pid 7580.GET /ocwn-1514?token=not-a-gateway-tokenreturned HTTP 200. A browser opened that same URL. The guest log recordedtoken=truefor those requests and did not store the query value. One later guest line wastoken=false, from a browser fetch that did not include the query.A second call for remote port 19047 on the same local port returned
owned=false. It did not replace the forward. Binding another listener on 19049 failed while the guard held it. The next request then failed withHttpRequestException. Calling ensure again for the original destination returnedowned=truewith a new ssh pid 43132, and the same GET returned HTTP 200.A later run on the same head kept ssh pid 45824 as the recorded owner and pointed the backend port at a different process listening on
127.0.0.1:19046. The public GET failed. That other process accepted the TCP connection and read 0 bytes. The guest log did not record that request. Recovery then used ssh pid 36624 and the GET returned HTTP 200. The guest log for the whole run was twotoken=truelines, the allowed call and the recovered call.The same head then covered a delayed navigation across explicit Stop and Reset.
EnsureSettingsOwnedForwardReadyAsyncused realssh.exeto[email protected]port 22, local port 19149, remote port 19148. The first owned forward was ssh pid 48196, backend port 61404.GET /ocwn-1514?token=not-a-gateway-tokenreturned HTTP 200. The guest log was onetoken=trueline. Navigation was submitted on that handoff, thenStopran. Status was Stopped, the public port stayed held, and a second bind of 19149 threwSocketException. The delayed GET failed withHttpRequestException. A foreign listener on backend port 61404 accepted 0 connections and read 0 bytes. The guest log did not gain a line. Ensure for the same destination then used ssh pid 39768, backend port 61409, and the GET returned HTTP 200. The guest log gained a secondtoken=trueline.ResetNotConfiguredused the same sequence. Navigation was submitted on ssh pid 39768. After reset, status was NotConfigured, port 19149 stayed held, and a second bind threwSocketException. The delayed GET failed. A foreign listener on backend port 61409 accepted 0 connections and read 0 bytes. The guest log stayed at two lines. Ensure for the same destination then used ssh pid 35880, backend port 61414, and the GET returned HTTP 200. The guest log gained a thirdtoken=trueline.A local port Dashboard has reserved stays tied to the original user, host, remote port, and SSH port. A different destination is not accepted on that same port. A second saved gateway that stores the same port gets a different runtime listener, and stopping that gateway does not release the first port.
Unit coverage on this head, from the earlier closeout:
Unit coverage on this head:
Change Type
Scope
winnodeRequired proof pools
windows-winui-interactive: isolated Debug tray built from this head. Settings hadEnableMcpServertrue,EnableNodeModefalse, andUseSshTunneltrue with an empty user and host, so setup did not block and the tunnel settings were incomplete.openclaw://dashboardwas forwarded on the isolated pipe. The log recordedSSH tunnel is enabled but settings are incomplete. The Connection page showed a dialog titled Dashboard, with the text "Dashboard could not open. Check the verified gateway connection, then try again." Retry and Close are both fully inside the window. Invoking Retry removed that button, and the same dialog returned about 200 ms later. The incomplete-tunnel warning was logged again.Validation
Head
6c7b974084eebd5f629fdf0baf2612b1cd008418../build.ps1: exit 0SshTunnelServiceTests,DashboardBrowserHandoffTests, andGatewayClientEndpointResolverTests: 56 passed, 0 failedReal behavior proof
C:\Users\sebta\wt-wn-1514, head2a20af4a0d672d61fec4ba95d88d49a7c5bc119e. Guest SSH is Ubuntu-24.04 on127.0.0.1:22. The HTTP proof server was127.0.0.1:19048inside that guest.SshTunnelService.EnsureSettingsOwnedForwardReadyAsyncfor[email protected], local port 19049, remote port 19048. Then an HTTP GET and a browser open ofhttp://127.0.0.1:19049/ocwn-1514?token=not-a-gateway-token. Then the same call with remote port 19047. Then ensure again for remote port 19048. On this same head, the delayed case used local port 19149 and remote port 19148: submit the navigation, callStop, send the GET, then ensure the original destination. Repeat that withResetNotConfigured. The isolated tray then receivedopenclaw://dashboard.owned=false. A second bind of 19049 was denied. Recovery used ssh pid 43132 and returned HTTP 200. On the next run, ssh pid 45824 stayed the recorded owner while a different process listened on the backend port. That process read 0 bytes and the guest did not see the request. Recovery used ssh pid 36624 and returned HTTP 200. After Stop, ssh pid 48196 was gone, the delayed GET failed, and the foreign listener on backend port 61404 read 0 bytes. Recovery ssh pid 39768 returned HTTP 200. After Reset, the foreign listener on backend port 61409 read 0 bytes. Recovery ssh pid 35880 returned HTTP 200. The isolated tray dialog is the screenshot above. Retry left and then returned.ssh.exeor a browser. The port choice and the stop are covered by the unit tests above. Thessh.exeand tray dialog evidence is from parent2a20af4a.Security Impact
NoYesNoNoNoYes, explain the risk and mitigation: The shared token is appended only when the gateway identity and SSH destination still match the snapshot checked before the wait. This app binds 127.0.0.1 and ::1 before the URL is issued and keeps that binding after SSH stops. Guarded clients use 127.0.0.1. Forwarding happens only when the accepted loopback socket belongs to the SSH process for the original user, host, remote port, and SSH port. Launch failures are not logged, because the exception text can contain the token URL.Compatibility and Migration
YesNoNoReview Conversations