Conversation
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/49f38d9c-2304-442d-afb8-6159375148d5 Co-authored-by: n3crosis <[email protected]>
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/49f38d9c-2304-442d-afb8-6159375148d5 Co-authored-by: n3crosis <[email protected]>
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/49f38d9c-2304-442d-afb8-6159375148d5 Co-authored-by: n3crosis <[email protected]>
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/49f38d9c-2304-442d-afb8-6159375148d5 Co-authored-by: n3crosis <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR updates web startup authentication so Basic credentials embedded in the page URL are parsed into the initial HTTP server connection while keeping the server URL credential-free.
Changes:
- Adds
authFromUrlfor parsing Basic auth userinfo from URLs. - Allows empty-string passwords to still generate Basic Authorization headers.
- Adds focused tests for URL credential parsing cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
packages/app/src/utils/server.ts |
Adds URL auth parsing and changes SDK auth header generation for empty passwords. |
packages/app/src/utils/server.test.ts |
Adds coverage for parsing credentials from URLs. |
packages/app/src/entry.tsx |
Wires URL-derived credentials into the startup server connection. |
Comments suppressed due to low confidence (1)
packages/app/src/utils/server.ts:42
- The changed behavior that sends Basic auth when
passwordis an empty string is not covered by the existing server utility tests. Add coverage forcreateSdkForServer(or equivalent request construction) so username-only credentials continue to produce an Authorization header instead of regressing to the old falsy-password behavior.
if (server.password === undefined) return undefined
return {
Authorization: `Basic ${authTokenFromCredentials({ username: server.username, password: server.password })}`,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (root instanceof HTMLElement) { | ||
| const auth = authFromToken(new URLSearchParams(location.search).get("auth_token")) | ||
| const auth = authFromToken(new URLSearchParams(location.search).get("auth_token")) ?? authFromUrl(location.href) | ||
| clearAuthToken() |
| if (!url.username && url.password === "") return undefined | ||
| return { | ||
| username: url.username ? decodeURIComponent(url.username) : "opencode", | ||
| password: url.password ? decodeURIComponent(url.password) : "", |
|
@copilot sync to the latest branch and modify the pull request according to contribution md again |
…sync-error Co-authored-by: n3crosis <[email protected]>
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/6f06909d-b09d-43ce-85ca-20f0912e0fd7 Co-authored-by: n3crosis <[email protected]>
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/6f06909d-b09d-43ce-85ca-20f0912e0fd7 Co-authored-by: n3crosis <[email protected]>
Agent-Logs-Url: https://github.com/n3crosis/opencode/sessions/6f06909d-b09d-43ce-85ca-20f0912e0fd7 Co-authored-by: n3crosis <[email protected]>
Synced the branch with latest Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: rekram1-node <[email protected]>
…ger requires matching explicit requirements
Issue for this PR
Type of change
What does this PR do?
When the web app is opened with HTTP Basic credentials in the URL, the app reads those credentials into the startup server connection while continuing to use a credential-free server URL. This lets SDK requests include the expected Basic Authorization header and avoids startup failures around the global sync provider.
The app now also removes startup credentials from the browser URL/history after extracting them, and terminal WebSocket fallback auth treats an empty password as valid Basic Auth instead of omitting auth.
Added focused coverage for parsing credentials from URLs and terminal auth token handling.
How did you verify your code works?
oxlint packages/app/src/entry.tsx packages/app/src/utils/server.ts packages/app/src/utils/server.test.ts packages/app/src/utils/terminal-websocket-url.ts packages/app/src/utils/terminal-websocket-url.test.tsbun typecheck, but it is blocked because dependency install failed andtsgois unavailable.@happy-dom/global-registratoris unavailable.bun install --frozen-lockfile, but GitHub returned 403 foranomalyco/ghostty-web.Screenshots / recordings
N/A
Checklist
If you do not follow this template your PR will be automatically rejected.