Skip to content

[Bug]: Add Environment dialog shows two cards selected after adding an SSH environment and reopening #26107

Closed

Description

@richclement

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Desktop app: Settings > Environments > Add environment.
  2. Choose the SSH card, enter an SSH alias (any host that works), click "Add environment".
    The environment is added and the dialog closes.
  3. Click "Add environment" again to add another one.

Reproduces every time. Not tried in the reverse order (Remote link first, then SSH).

Expected behavior

Exactly one card looks selected. Either the dialog resets to Remote link (its default) and shows the
Remote link form, or it remembers SSH and only the SSH card carries the selected styling.

Actual behavior

Both cards look selected. "Remote link" has the blue 2px border; "SSH" has the blue filled background,
and the form under the cards is the SSH one (SSH host or alias, Username, Port). Clicking either card
clears it. Adding the second environment works; the problem is only the styling.

Likely regression from #22686 "refactor(web): the add environment dialog owns its form state"
(merged 2026-10-21), the only commit on apps/web/src/components/settings/AddEnvironmentDialog.tsx.
From reading that file (not verified in a debugger): savedBackendMode is useState("remote") and
the selected style (border-primary/50 bg-primary/5) follows it; the state is not reset when the
dialog closes, so after an SSH add the component still holds "ssh". The border on Remote link then
looks like the first card's focus ring on reopen rather than the selected style. Either resetting the
mode on close or not autofocusing the first card when another is selected would fix it.

Closest existing issues, not duplicates: #7568 (SSH alias port change), #15802 (re-pairing creates a
duplicate environment). Both are behavior, not this dialog's UI.

Impact

Cosmetic issue

Version or commit

v0.1.4-nightly.20261027.3770

Environment

macOS 15.7.7, Apple silicon, T3 Code desktop v0.1.4-nightly.20261027.3770

Logs or stack traces

Screenshots, recordings, or supporting files

bug-add-environment-double-selection.png

Workaround

Click either card once; the styling corrects itself. Cosmetic only.

Activity

  1. added
    bugSomething is broken or behaving incorrectly.
    needs-triageIssue needs maintainer review and initial categorization.
    on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions