You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AI code review — automated review for reference, author can ignore or act on any point.
Sound fix. Mirroring the page hostname for loopback loads keeps the dev server request same-origin, which is exactly what preserves Basic Auth credentials and avoids needless CORS preflights between 127.0.0.1 and localhost. I checked the matchers: location.hostname does include brackets for IPv6 ("[::1]" per the URL spec), and startsWith("127.") can't false-positive on lookalike hosts like 127evil.com since the dot is required — both are correct as written.
Two small points:
Coverage: this ships with typecheck-only validation. The logic is pure except for reading location, so extracting something like resolveDevServerHost(pageHostname: string): string would make the loopback matrix (localhost, [::1], 127.x.x.x, non-loopback, explicit VITE_OPENCODE_SERVER_HOST override) unit-testable in one table-driven test. Cheap insurance for a function two PRs have now touched in a row.
Non-loopback dev pages still target localhost: loading the dev app from a LAN IP still sends API calls to localhost:4096, which fails unless forwarded. That's pre-existing and the summary marks it intentionally unchanged — just confirming that's deliberate rather than an oversight, since the same "mirror the page host" argument could be made there (with the caveat that remote devices genuinely may want a different backend).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
127.0.0.1tolocalhostorigin changesTesting
bun typecheck(packages/app)