Repository navigation
fix(connection): copied browser SSH forward uses the local port on both sides - #1556
Conversation
The diagnostics setup text reused the local browser port as the remote port when the tunnel had no browser-proxy remote endpoint. A local gateway port of 19000 and a remote port of 18789 copied -L 19002:127.0.0.1:19002. The line now uses remote gateway port + 2, matching the managed tunnel and the command-center repair copy. The same inputs now copy -L 19002:127.0.0.1:18791. An explicit browser remote port is kept. A missing remote gateway port stays a placeholder. 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 maintainer review before merge. Reviewed October 7, 2026, 8:59 AM ET / 12:59 UTC (Revision 6). ClawSweeper reviewWhat this changesThe PR corrects copied browser SSH forwarding guidance to use the remote gateway port plus two when no explicit browser endpoint is available, and adds three regression tests. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main and is ready for normal landing review. The new current-head clipboard evidence resolves the prior proof request, with no blocking findings. Priority: P2 Review scores
Verification
How this fits togetherWindows Companion builds browser setup guidance from the active gateway and SSH tunnel diagnostics. Diagnostics copy actions format and sanitize that state before placing instructions on the clipboard. flowchart TD
A[Active gateway settings] --> C[Tunnel diagnostics]
B[Live SSH tunnel state] --> C
C --> D[Browser setup guidance]
D --> E{Explicit remote browser port?}
E -->|Yes| F[Use explicit port]
E -->|No| G[Derive remote gateway port plus two]
F --> H[Sanitized clipboard instructions]
G --> H
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep copied diagnostics guidance consistent with the managed tunnel's remote-port mapping while preserving explicit endpoints and safe placeholders. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the defect: local gateway port 19000, remote port 18789, and no explicit browser endpoint cause current main to copy remote port 19002 instead of 18791. Reviewer did not execute a failing runtime reproduction. Is this the best way to solve the issue? Yes, this bounded formatter repair follows the existing managed-tunnel mapping and preserves explicit endpoints; no broader connection change is needed. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 94006b3672a0. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Tray UI tests aborted after 5 minutes of inactivity during MarkdownRendererCoalesceTests and ThemeResolveColorFallbackTests. The browser SSH line is unchanged. Signed-off-by: Sebastien Tardif <[email protected]>
|
Global triage: HOLD_FOR_AUTHOR. Take confidence 20%; recommendation confidence 98%; effort small; 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. |
What Problem This Solves
Fixes: the copied browser SSH forward uses the local port on both sides when the tunnel has no browser-proxy remote endpoint.
User Impact
The diagnostics browser-setup copy now forwards the local browser port to the remote gateway port plus 2. A local gateway port of 19000 and a remote port of 18789 produces
-L 19002:127.0.0.1:18791instead of-L 19002:127.0.0.1:19002. An explicit browser remote port is unchanged; a missing remote gateway port leaves a placeholder. The current-head Diagnostics Copy clipboard is below.Why This Change Was Made
The managed tunnel forwards local gateway port + 2 to remote gateway port + 2. The command-center repair copy already used that remote port. The diagnostics copy now uses the same rule, and it leaves a placeholder when the remote gateway port is missing.
Evidence
On 2026-10-07, isolated tray pid 34868 ran the Debug build of head
9459dfe651f2c6f394a85398ebcc44dd652433cffromwt-wn-1556. The exe timestamp was 2026-10-07 08:03:53 UTC and the worktree was clean at that commit. The isolated gateway record usedws://127.0.0.1:19000, SSH useroc, hostgateway.example, local port 19000, and remote port 18789. The tray log, after its own redaction, recorded:The copy line is from 2026-10-07 05:50:49 local. A second launch of the same exe, with the same isolated data directory, forwarded
openclaw://browser-setupinto that process. That is the Diagnostics Copy action. The clipboard read back:The product sanitizer replaced the loopback address, the user@host, and the
enabled=trueliteral. The remote side of the forward is 18791, remote gateway port 18789 plus 2. It is not 19002 on both sides. The isolated gateway token was not in the clipboard. No live SSH session was established.The Diagnostics page was open. Copy specific diagnostic text was expanded, and Copy browser setup guidance was enabled. The automation host could not call that card's Invoke pattern (
InvalidCastException), and a coordinate tap did not show the Copied infobar. The clipboard above is from the deep-link Diagnostics Copy, which calls the sameCopyBrowserSetupGuidancemethod as that card.Previously reported formatter-only before/after evidence
The contributor's original body reported a direct
BuildBrowserSetupGuidancecall with browser port 19002, SSH mode, local127.0.0.1:19000, remote127.0.0.1:18789, useroc, hostgateway.example, and no browser-proxy remote endpoint. This is not output captured from the live Diagnostics Copy action.Before, on base
5abfabb38e121cc169bd42574740a7e9518ad2e4:After, on
9459dfe651f2c6f394a85398ebcc44dd652433cf(empty retrigger of3e0be3afdb8f423e19afec92da874cfaf7c61dd6):The current-head focused tests independently passed the asymmetric-port, explicit-browser-endpoint, and missing-remote-port cases.
Change Type
Scope
winnodeRequired proof pools
windows-winui-interactive: isolated Debug tray on head9459dfe651f2c6f394a85398ebcc44dd652433cfopened Diagnostics and the Diagnostics Copy action wrote the clipboard above. The maintainer-scheduled freeze run was not executed.Validation
Current-head local results, September 30, with
$env:OPENCLAW_REPO_ROOT=(Get-Location).Pathin this isolated worktree. This copy pass did not change source and did not rerun the suites..\build.ps1: passed, exit 0; Shared, CLI, WinNode CLI, SetupEngine, and WinUI built.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: passed, 4169 passed, 33 skipped, 0 failed (4202 discovered).dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: passed, 3347 passed, 0 skipped, 0 failed.--no-restore, restoring and executing nonzero tests; the required--no-restorecommands above were then rerun with the same counts.dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --filter 'FullyQualifiedName~CommandCenterBrowserSetupGuidanceTests|FullyQualifiedName~DiagnosticsPageContractTests|FullyQualifiedName~CommandCenterTunnel|FullyQualifiedName~CommandCenterTopology|FullyQualifiedName~CommandCenterPort|FullyQualifiedName~BrowserControl': passed, 44 passed, 0 skipped, 0 failed.dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --filter 'FullyQualifiedName~SshTunnel|FullyQualifiedName~BrowserProxy|FullyQualifiedName~GatewayTopology': passed, 65 passed, 0 skipped, 0 failed.Real Behavior Proof
ws://127.0.0.1:19000. SSH local port 19000, remote port 18789, useroc, hostgateway.example. Node mode, MCP, hotkeys, notifications, and managed-local auto-repair were off. The installed gateway on port 18789 was not the target.9459dfe651f2c6f394a85398ebcc44dd652433cf. Tray pid 34868.OpenClaw.Tray.WinUI.exewithopenclaw://hub/debug. The Diagnostics page opened. Expanded Copy specific diagnostic text. A second process with the same isolated data directory forwardedopenclaw://browser-setup. The tray log recordedCopied browser setup guidance from deep link. The clipboard was then read.ssh -N -L 19002:<ip>:18791 <email>. The node command in the same clipboard uses port 19000. The tray log for that process recorded remote gateway port 18789 and remote browser port 18791.sshexited 255 becausegateway.exampledoes not resolve.No)Security Impact
No)No)No)No)No)Yes, explain the risk and mitigation: The app still does not run the copied command. Only the remote port in the text changed.Compatibility and Migration
Yes)No)No)Review Conversations
There are no inline review threads. This update records the current-head Diagnostics Copy clipboard that revision 5 asked for.