Skip to content

fix(desktop): match T3CODE_HOME and WSLENV case-insensitively on Windows - #36114

Open
helmipradita wants to merge 1 commit into
pingdotgg:mainfrom
helmipradita:fix/wsl-cased-env-keys
Open

helmipradita wants to merge 1 commit into
pingdotgg:mainfrom
helmipradita:fix/wsl-cased-env-keys

Conversation

@helmipradita

Copy link
Copy Markdown
Contributor

Problem

Windows environment variables are case-insensitive. In DesktopBackendConfiguration.ts:

Change

Case-fold the key comparison against "T3CODE_HOME" and "WSLENV" when preparing the WSL launch environment, ensuring host T3 home paths are always stripped and inherited WSLENV values are merged and forwarded into canonical uppercase WSLENV.

Scope

Fixes #35961
Fixes #35957

Verification

  • Added resolveWsl strips lowercase t3code_home and forwards lowercase wslenv on Windows unit test in apps/desktop/src/backend/DesktopBackendConfiguration.test.ts verifying that t3code_home and wslenv are stripped from the parent env, while inherited entries are preserved in config.env.WSLENV.

Windows environment variables are case-insensitive. A lowercase or
mixed-case 't3code_home' previously bypassed the filter and leaked host
paths into the WSL backend environment, while 'wslenv' was dropped when
forwarding inherited entries and created colliding cased keys.

Case-fold the comparison so host T3 home paths are always stripped and
inherited WSLENV values are preserved regardless of case.

Fixes pingdotgg#35961, fixes pingdotgg#35957

Signed-off-by: Helmi Pradita <helmipraditaa@gmail.com>
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 13, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 5e06c7e

Macroscope's review found this PR approvable — This normalizes Windows environment-key handling for WSL startup, preserving forwarding settings and preventing mixed-case T3CODE_HOME from crossing into Linux. The change is narrowly confined to child-process configuration and preserves existing isolation intent.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The WSL backend environment builder now detects T3CODE_HOME and WSLENV without regard to letter case. It excludes the host home variable and merges inherited WSLENV entries with forwarded variables. A Windows test covers lowercase keys.

Changes: WSL environment construction

Layer / File(s) Summary
Filter host variables and preserve WSLENV
apps/desktop/src/backend/DesktopBackendConfiguration.ts, apps/desktop/src/backend/DesktopBackendConfiguration.test.ts
The builder detects T3CODE_HOME and WSLENV case-insensitively. It removes the host home variable and passes the inherited WSLENV value to the merge function. The test checks lowercase keys and verifies inherited and forwarded entries in the resulting environment.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to 5e06c

This change stops lowercase or mixed-case T3CODE_HOME from leaking into the WSL environment and keeps inherited WSLENV entries when the key is lowercase. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: making the T3CODE_HOME and WSLENV key handling case-insensitive in the Windows WSL launch environment. It follows the conventional commit format and matches the summar…
Description check Passed The description follows the template and covers Problem, Change, Scope, and Verification. The Problem section explains the lowercase t3code_home leak and the lowercase wslenv drop with issue reference…
Linked Issues check Passed Both directly linked issues, #35961 and #35957, are marked closed. The PR objectives state that no active directly linked targets remain. Under the assessment rules, closed issues supply background on…
Out of Scope Changes check Passed The changed files are apps/desktop/src/backend/DesktopBackendConfiguration.ts and its test file, DesktopBackendConfiguration.test.ts. The source change makes the T3CODE_HOME exclusion and the inherite…
Full details: Title check

Explanation

The title names the main change: making the T3CODE_HOME and WSLENV key handling case-insensitive in the Windows WSL launch environment. It follows the conventional commit format and matches the summary, which adds case-insensitive key matching in DesktopBackendConfiguration.ts and a test for lowercase keys.

Full details: Description check

Explanation

The description follows the template and covers Problem, Change, Scope, and Verification. The Problem section explains the lowercase t3code_home leak and the lowercase wslenv drop with issue references. The Change section explains the case-folded key comparison. The Scope section links #35961 and #35957. The Verification section names a specific unit test and what it checks. The description does not state whether the test was run or what it observed, and it does not mention the agent/model line that the template asks for when an agent was used. These gaps are minor.

Full details: Linked Issues check

Explanation

Both directly linked issues, #35961 and #35957, are marked closed. The PR objectives state that no active directly linked targets remain. Under the assessment rules, closed issues supply background only, so no linked-issue coding requirements apply to this PR. The PR also states the intent to fix both issues. The change summary shows case-insensitive handling of T3CODE_HOME and WSLENV in DesktopBackendConfiguration.ts, plus a unit test. This is consistent with that intent, but it is not assessed against the closed issues' acceptance criteria.

Full details: Out of Scope Changes check

Explanation

The changed files are apps/desktop/src/backend/DesktopBackendConfiguration.ts and its test file, DesktopBackendConfiguration.test.ts. The source change makes the T3CODE_HOME exclusion and the inherited WSLENV extraction case-insensitive. The test covers lowercase t3code_home and wslenv inputs. Both changes match the stated purpose of the PR, which is the Windows key-casing defect described in the PR description and the linked issues. No unrelated change appears in the summary. The assessment uses the change summary and the PR description. I did not inspect the full diff.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 10fbff5 and 5e06c7e.

Files selected for processing: 2

  • apps/desktop/src/backend/DesktopBackendConfiguration.test.ts
  • apps/desktop/src/backend/DesktopBackendConfiguration.ts

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

@helmipradita

Copy link
Copy Markdown
Contributor Author

All 8 required checks are green on 5e06c7e and the PR is CLEAN/MERGEABLE. Macroscope approved at this head; the only outstanding item is a human review / vouch (vouch:unvouched — author not yet on .github/VOUCHED.td). This normalizes T3CODE_HOME / WSLENV case-insensitively on Windows, touching the same WSL config path as #35719. @juliusmarminge (recent DesktopBackendConfiguration.ts changes and vouching) could you take a look when you get a chance? Happy to address any feedback.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

1 participant