fix(preview): preserve direct localhost navigation#3939
Conversation
Address-bar submissions were routed through the discovered-server resolver, which replaced loopback hosts with the WSL environment IP. Use the existing direct URL target and cover the component submission path.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Preserve address-bar scheme defaults for schemeless localhost and public hosts while keeping direct targets separate from environment-port remapping.
ApprovabilityVerdict: Approved This is a targeted bug fix that preserves direct localhost URLs in WSL environments by using appropriate URL normalization based on navigation context. The change is well-scoped with clear intent and includes comprehensive test coverage. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7c723d8. Configure here.
Address-bar entries are direct URLs, but empty-state server cards represent environment endpoints. Route only those cards through discovered-server resolution and cover WSL remapping at the component seam.
Preserve direct address-bar navigation while retaining environment-aware discovered-server routing from main. Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate f6b2915
* fix(server): resolve Claude SDK executable path on Windows npm installs (pingdotgg#3740) * Fix project action preview settings persistence (pingdotgg#3842) * fix(desktop): allow clipboard writes in the preview browser (pingdotgg#3889) * fix(web): handle sidebar shortcut before editors (pingdotgg#3921) * fix(server): recognize Bedrock-backed Claude as authenticated (pingdotgg#3931) * Fix incorrect pluralization of “entry” (pingdotgg#3933) * feat(server): title background-task work-log rows with the task name (pingdotgg#3751) Co-authored-by: Claude Fable 5 <noreply@anthropic.com> * fix: delegate OpenCode session titles to provider (pingdotgg#3720) * Archive selected threads from the context menu (pingdotgg#3895) * fix(cli): support force removing projects (pingdotgg#3922) * fix: allow sidebar to be shrunk when wider than viewport (pingdotgg#2456) Co-authored-by: Shoaib Ansari <shoaibansari@Shoaibs-Mac-mini.local> Co-authored-by: Julius Marminge <julius0216@outlook.com> * fix(codex): show web search query and url in tool call details (pingdotgg#2093) Co-authored-by: Julius Marminge <julius0216@outlook.com> * Add Codex launch arguments setting (pingdotgg#2892) Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Julius Marminge <jmarminge@gmail.com> Co-authored-by: root <root@localhost.localdomain> * [orchestration] Clear stale active turn when session becomes inactive (pingdotgg#3159) Co-authored-by: Julius Marminge <julius0216@outlook.com> * Regenerate Codex reset credit protocol bindings (pingdotgg#4173) Co-authored-by: codex <codex@users.noreply.github.com> * fix(preview): preserve direct localhost navigation (pingdotgg#3939) Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: codex <codex@users.noreply.github.com> * Synchronize mobile threads with authoritative shell snapshots (pingdotgg#4163) Co-authored-by: codex <codex@users.noreply.github.com> * Gate iOS glass layout on native support (pingdotgg#4032) Co-authored-by: codex <codex@users.noreply.github.com> * fix(opencode): resume the OpenCode session on follow-ups instead of starting an empty one (pingdotgg#3617) Co-authored-by: codex <codex@users.noreply.github.com> * fix(server): use CLI for OpenCode health check instead of spawning server (pingdotgg#4153) * fix(web): scope timeline minimap hover target to the side gutter (pingdotgg#3869) Co-authored-by: Claude Fable 5 <noreply@anthropic.com> * [codex] show complete approval details (pingdotgg#4111) * fix(web): paint text selection over composer chips (pingdotgg#4139) Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com> * [codex] preserve custom model slugs (pingdotgg#4168) * fix(web): preview workspace images in the file panel (pingdotgg#3996) Co-authored-by: Rhiz3K <rhiz3k@protonmail.com> Co-authored-by: Julius Marminge <julius0216@outlook.com> * feat(web): drag files from the explorer into the chat composer (pingdotgg#4140) Co-authored-by: Julius Marminge <julius0216@outlook.com> Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com> * fix(desktop): preserve main window bounds (pingdotgg#3851) Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: codex <codex@users.noreply.github.com> * perf(orchestration): speed up new-chat propagation and offline catch-up (pingdotgg#4177) Co-authored-by: codex <codex@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com> * Finale: upgrade changed files card to fix various UI issues (pingdotgg#4113) Co-authored-by: Julius Marminge <julius0216@outlook.com> * fix(web): always show environment chip for remote projects (pingdotgg#4217) Co-authored-by: Claude Fable 5 <noreply@anthropic.com> * chore: reconcile upstream sync (20260721) — typecheck/test fixups Post-cherry-pick reconciliation of the shell/thread sync rewrite: - adopt upstream's client shell.ts + shell-sync.test.ts (drops the fork's superseded #142 replay-gap watchdog; server no longer emits 'caught-up') - remove the orphaned 'caught-up' contract member and obsolete fork shell server tests (upstream's coalescing tests cover the behavior) - keep the fork's thread reconciliation, resubscribing via subscribeDynamic (establish base once; foreground/session resubscribe via the live cursor) - add latestSequence to OrchestrationEngine test mocks; thread dispatch authority in bin.test; narrow stream-item unions past the new 'synchronized' Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com> Co-authored-by: David Whatley <nsxdavid@gmail.com> Co-authored-by: coach007 <6238600+keeperxy@users.noreply.github.com> Co-authored-by: Carlos Rico-Ospina <carlosricojr@gmail.com> Co-authored-by: Andrew Barnes <bortstheboat@gmail.com> Co-authored-by: Pieter van Zyl <20579513+PieterVanZyl-Dev@users.noreply.github.com> Co-authored-by: mel <mcmelon@nodiumhosting.com> Co-authored-by: Theo Browne <me@t3.gg> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Tristan Knight <tris203@gmail.com> Co-authored-by: Christoph Herzog <a.github@omega-id.com> Co-authored-by: Shoaib <shoaib050326@gmail.com> Co-authored-by: Shoaib Ansari <shoaibansari@Shoaibs-Mac-mini.local> Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Guilherme Vieira <46866023+GuilhermeVieiraDev@users.noreply.github.com> Co-authored-by: James <105842516+jamesx0416@users.noreply.github.com> Co-authored-by: Julius Marminge <jmarminge@gmail.com> Co-authored-by: root <root@localhost.localdomain> Co-authored-by: Andrew Forster <76947376+Andrew-Forster@users.noreply.github.com> Co-authored-by: codex <codex@users.noreply.github.com> Co-authored-by: Chris Michael Guzman <67719167+Chrrxs@users.noreply.github.com> Co-authored-by: Vadym Kotai <vdmkotai@gmail.com> Co-authored-by: Utkarsh Patil <73941998+UtkarshUsername@users.noreply.github.com> Co-authored-by: xxashxx-svg <xxanshxx9@gmail.com> Co-authored-by: Maxwell Young <maxtheyoung@gmail.com> Co-authored-by: Yordis Prieto <yordis.prieto@gmail.com> Co-authored-by: Rhiz3K <33246262+Rhiz3K@users.noreply.github.com> Co-authored-by: Rhiz3K <rhiz3k@protonmail.com> Co-authored-by: Anirudh Coontoor <me@anirudhs.net> Co-authored-by: Rusiru Sadathana <rusirusadathana@gmail.com> Co-authored-by: ss <69873514+sandersonstabo@users.noreply.github.com> Co-authored-by: wizzoapp[bot] <254688279+wizzoapp[bot]@users.noreply.github.com>

What Changed
{ kind: "url" }navigation intent.localhost:5173to HTTP and public hosts to HTTPS) without consulting the environment connection or remapping loopback hosts.Why
Address-bar submissions incorrectly reused the resolver intended for discovered servers. In WSL environments, that resolver replaced loopback hosts with the environment IP, so entering
https://localhost:8000/dashboard?mode=test#topnavigated tohttps://172.25.85.75:8000/dashboard?mode=test#topinstead.Using the existing direct-URL intent fixes that boundary without adding a new abstraction or changing server-discovery behavior. Direct targets still use the shared URL normalizer, preserving the prior scheme defaults for schemeless input. Fixes #3938.
UI Changes
No visual UI, animation, motion, timing, or interaction-design changes. The deterministic navigation result changes as follows:
Screenshots and video are therefore not applicable.
Validation
vp test run --passWithNoTests --project unitfromapps/web— 1,283 tests passedvp run typecheckfromapps/webvp checkfrom the repository rootvp run typecheckfrom the repository root — all 15 workspace tasks passedChecklist
Note
Low Risk
Narrow preview navigation routing change with regression tests; no auth, data, or broad architectural impact.
Overview
Fixes preview address-bar navigation in remote environments (e.g. WSL) where typed loopback URLs were incorrectly rewritten to the environment host IP.
Address bar submissions now go through
resolveBrowserNavigationTargetwith{ kind: "url" }, which appliesnormalizePreviewUrlfor schemeless input but does not remap loopback hosts via the environment connection. Empty-state discovered servers still useresolveDiscoveredServerUrlviahandleOpenServerUrl, so localhost dev servers continue to map onto the WSL/private-network host when picked from the server list.Regression tests cover direct localhost preservation, schemeless direct URLs, empty-state remapping, and resolver unit behavior.
Reviewed by Cursor Bugbot for commit 57c59af. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix direct localhost URL navigation in preview chrome row
normalizePreviewUrlinstead ofresolveDiscoveredServerUrl, preserving directlocalhostURLs rather than remapping them to the environment host.resolveDiscoveredServerUrlvia a newhandleOpenServerUrlhandler in PreviewView.tsx.navigateToResolvedUrlcallback centralizes the logic for drivingpreviewBridge.navigateand callingrememberPreviewUrl.Macroscope summarized f6b2915.