Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): open remote editors with the environment user #8305

Closedjakeleventhal(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/8305/headopened View on GitHub

Closes #14102

Remote open-in-editor links advertised only a hostname. Cursor therefore defaulted to the viewing machine user, so an environment running as randomuser could try to connect as myuseronprimarymachine@othercomputer.local.

This adds the environment login user to advertised Tailscale and mDNS targets, preserves explicit usernames from desktop SSH profiles, and encodes user@host in VS Code-compatible remote editor links and Zed's zed://ssh/user@host/... links. The desktop shell now allows a login user in Zed links while still rejecting passwords and ports. The username remains optional on the wire for compatibility with older servers.

Test plan

  • vp test run apps/server/src/environment/RemoteOpenTargets.test.ts apps/web/src/remoteOpen.test.ts apps/desktop/src/electron/ElectronShell.test.ts
  • vp run --filter @t3tools/shared --filter @t3tools/contracts --filter t3 --filter @t3tools/web --filter @t3tools/desktop typecheck
  • focused vp fmt --check and vp lint for all changed files

Model: GPT-5.6 Sol Harness: Codex in T3 Code


Note

Low Risk Behavioral fix for remote editor links with optional wire fields; no auth or data-model changes, though mismatched SSH usernames could still fail to connect at runtime.

Overview Remote open-in-editor deep links previously used only a hostname, so editors like Cursor could SSH as the viewer’s local user instead of the account on the remote environment.

This change threads the environment login user through the full path: HostProcessUsername supplies the OS user on the server, RemoteOpenTarget gains an optional username (omitted when unknown for backward compatibility), and buildRemoteOpenUrl encodes the SSH destination as user@host inside ssh-remote+…. The web layer replaces sshAlias with sshTarget (alias + username) from desktop SSH profiles and passes username from OpenInPicker into the deep link. Tests cover URL building, target resolution, server advertisement, and desktop shell acceptance of user@host remote URLs.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit aa4bd24fb9c43ed8bdb213ddffcd765addb34eb9. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Include environment user in remote editor open URLs

  • Adds HostProcessUsername context reference in hostProcess.ts that resolves to the trimmed OS username or null
  • Extends RemoteOpenTarget schema in editor.ts with an optional username field; buildRemoteOpenUrl now formats the destination as username@host when a username is supplied
  • resolveTargets in RemoteOpenTargets.ts includes the host process username on advertised tailscale and mdns targets when available
  • resolveRemoteOpenState and useRemoteOpenResolution in remoteOpen.ts carry the configured SSH username through to the resolved host; OpenInPicker propagates it into the deep link
  • Risk: RemoteOpenTarget consumers that do strict schema validation may reject the new optional username field; in-tree readers are updated
Macroscope summarized 9233389.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Important

      Review skipped

      We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: d35a2e0f-2fc0-425e-a176-c1f7885657f6

      📥 Commits

      Reviewing files that changed from the base of the PR and between 28fd0e5d63a841978f7389d161dba1d2b1907725 and 8e0d3d950e4b91e08130aba3f5bd85697545a213.


      📒 Files selected for processing (2)
      • apps/web/src/components/chat/OpenInPicker.tsx
      • packages/contracts/src/editor.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.



      📝 Walkthrough

      Walkthrough

      The change propagates optional SSH usernames from host discovery and desktop SSH profiles into remote-open targets and editor URLs. It adds username-aware URL construction and permits login usernames in Zed SSH paths. Tests cover username handling and hostname-only targets.

      Changes

      Remote SSH username propagation

      Layer / File(s)Summary
      Username contracts and discovery
      packages/shared/src/hostProcess.ts, packages/contracts/src/editor.ts
      Adds HostProcessUsername. Remote-open targets and editor URL construction accept an optional username.
      Server target advertisement
      apps/server/src/environment/RemoteOpenTargets.ts, apps/server/src/environment/RemoteOpenTargets.test.ts
      Adds the host username to tailscale and mDNS targets when available. Tests cover targets with and without a username.
      Client resolution and editor opening
      apps/web/src/remoteOpen.ts, apps/web/src/remoteOpen.test.ts, apps/web/src/components/chat/OpenInPicker.tsx, apps/desktop/src/electron/ElectronShell.ts, apps/desktop/src/electron/ElectronShell.test.ts
      Passes usernames from SSH profiles and remote targets into editor URLs. Allows login usernames in Zed SSH paths while rejecting passwords and ports. Tests cover resolution and URL handling.

      Priority: ⬇️ Low

      Estimated code review effort: 3 (Moderate) | ~20 minutes

      Change: Bug fix · Severity of issue fixed: Low

      Suggested reviewers: juliusmarminge


      Merge Risk

      Merge Risk: ⚪ Minimal · up to 8e0d3

      Remote editor links carry the intended SSH username, and host-only links remain supported when no username is available. No concrete merge-blocking issue is established.

      Security Architecture Review

      Security architecture risk: 🔵 Low · up to 8e0d3

      The change selects the intended SSH login while preserving existing route selection and editor restrictions. It does not itself grant SSH access. Unusual username characters and their interpretation by installed editors remain incompletely verified.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • inferred — The demonstrated exposure is the viewing machine’s editor opening an SSH destination selected from an environment advertisement or configured profile. A malicious advertisement already controlled the hostname before this change; it can now also specify the login account. The inspected flow passes a destination and path, not an SSH credential or new authorization grant. Downstream credential selection remains outside the established source coverage.

      Trust Boundaries and Controls

      • observed — Remote target data crosses into the local OS protocol-handler boundary. Desktop opening still requires a recognized editor scheme, the expected URL authority and the editor-specific pathname shape, and rejects URL-authority usernames and passwords. The changed Zed pattern allows one literal login prefix while excluding literal password and port delimiters; it does not validate decoded destination semantics.

      Resilience and Maintainability Implications

      • observed — Username discovery failure omits the new field rather than blocking target construction. Desktop URL rejection returns false and does not trigger a browser-location fallback, preserving the desktop policy decision.

      Hardening Proposals

      • proposed — Establish a supported username-character contract against the actual editor parsers, including encoded @, slash and colon cases. Reject unsupported destinations before external opening if parser behavior can change their meaning. This is a proposal to close a decoding proof gap, not a verified bypass finding.



      🚥 Pre-merge checks | ✅ 4 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 9 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly identifies the main change: remote editor links use the environment user.
      Description check✅ PassedThe description explains the problem and change, links the related issue, and lists focused verification commands. It does not report the observed test results or provide explicit scope approval, but …
      Linked Issues check✅ Passed[#14102] The web layer takes the username from the desktop SSH connection profile (remoteOpen.ts) and includes it in the resolved remote target. The server advertises its process username for Tailsc…
      Out of Scope Changes check✅ PassedAll reported changes support [#14102]: username discovery and propagation, remote URL construction, Zed URL validation, and tests for these behaviors. The optional wire field supports compatibility fo…


      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR



      Comment `@coderabbitai help` to get the list of available commands.
    2. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a51020e5f597a2430244362c5f8b3d6df8701e32. Configure [here](https://www.cursor.com/dashboard/bugbot).
    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This is a focused correction that carries the environment username through remote-editor links with backward-compatible contracts and targeted tests. Human review is warranted because it changes the SSH authentication identity and broadens the desktop external-URL validation boundary.

      Not approved because:

      • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    5. Note

      GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

    6. codewithpassion(GitHub profile, opens in a new tab)commented

      I have the same issue. Only workaround at the moment is to set the user via the ssh/.config on my desktop.

    7. juliusmarminge added labelsmacroscope-review

    8. Note

      Written by claude-opus-5-5 on behalf of Maria

      Hi! We are cleaning up open PRs, and this one appears to have been created with an older model (gpt-5.6-sol). If this change is really important, we recommend rebuilding the PR with a newer model if possible.

    9. maria-rcks closed this

    10. Note

      Written by claude-opus-5-5 on behalf of Maria

      Reopening, this was closed by mistake. Sorry for the noise!

    11. maria-rcks reopened this

    12. Note

      Written by claude-opus-5-5 on behalf of Maria

      Closing again after a second look, sorry for the back and forth. This PR has merge conflicts with main and was opened more than two weeks ago. If this change is still important, please rebuild it on current main with a newer model and note the model in the PR description.

    13. maria-rcks closed this

    14. @maria-rcks Rebuilt this fix on current main with GPT-6.1 Sol through the Codex harness, as requested: https://github.com/pingdotgg/t3code/pull/18092

      The replacement records the model and harness in its description. It preserves the SSH username in remote editor links, handles targets entered as user@host, and adapts the implementation to the current HostProcess API. Focused tests and CI passed on the initial commit; I am addressing the bot feedback and monitoring the replacement PR.

Sign in to join this conversation.