Skip to content

perf(desktop): cache Windows shell environment - #7492

Open
Ivorisnoob wants to merge 1 commit into
pingdotgg:mainfrom
Ivorisnoob:perf/windows-desktop-startup
Open

perf(desktop): cache Windows shell environment#7492
Ivorisnoob wants to merge 1 commit into
pingdotgg:mainfrom
Ivorisnoob:perf/windows-desktop-startup

Conversation

@Ivorisnoob

@Ivorisnoob Ivorisnoob commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Cache successful PowerShell-derived Windows shell environment snapshots between desktop launches.
  • Reuse the snapshot for up to 24 hours while the inherited PATH remains unchanged.
  • Retry discovery after failed, timed-out, or incomplete probes instead of caching partial results.
  • Add focused coverage for cache reuse and incomplete-probe recovery.

The independent Windows tray/background feature is tracked in #7493.

Why

Loading the PowerShell profile dominates repeated Windows desktop startup. Reusing a verified snapshot removes that repeated work while the inherited environment is stable, without allowing a transient probe failure to suppress profile-derived PATH and FNM variables for 24 hours.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (not applicable; no UI changes)
  • I included a video for animation/interaction changes (not applicable; no interaction changes)

Implemented with GPT-5.6-sol through the Codex harness in T3 Code.

Note

Cache Windows shell environment to disk to avoid redundant PowerShell probes on launch

  • On Windows, installWindowsEnvironment now reads a cache file (stored in stateDir) before running PowerShell probes. The cache is reused when the inherited PATH matches and the cache is ≤24 hours old.
  • If no valid cache exists, the two PowerShell probes (-NoProfile and profile) run concurrently as before. A new cache is written only when both probes return PATH.
  • Incomplete probe results (missing PATH) are not cached, forcing a fresh probe on the next launch.
  • Two new tests in DesktopShellEnvironment.test.ts cover cache reuse and incomplete-probe retry behavior.

Macroscope summarized 75c39fd.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 176641a0-66f2-4ce8-99b0-85d75b4f2b80

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 19, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR introduces new caching infrastructure for Windows shell environment probes, including file I/O, JSON schema validation, and time-based expiration. While the implementation includes tests and graceful fallbacks, the added complexity and the author's unfamiliarity with this file warrant human review.

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

@t3dotgg

t3dotgg commented Sep 4, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-6 Astra (preview) responding on behalf of Theo

This note is part of an automated cleanup pass.

Carryover from #6301 at 23081bac73: retain checks for OneDrive-redirected PowerShell profiles and UTF-16LE profile text when adding cache invalidation. A profile can add a provider directory or source another script without mentioning fnm, so absence of that text must not justify discarding its environment. Invalidate or refresh after profile changes and when a cached FNM_MULTISHELL_PATH disappears. These are review cases, not ported code.

@Ivorisnoob

Copy link
Copy Markdown
Contributor Author

Note

🤖 GPT-6 Astra (preview) responding on behalf of Theo

This note is part of an automated cleanup pass.

Carryover from #6301 at 23081bac73: retain checks for OneDrive-redirected PowerShell profiles and UTF-16LE profile text when adding cache invalidation. A profile can add a provider directory or source another script without mentioning fnm, so absence of that text must not justify discarding its environment. Invalidate or refresh after profile changes and when a cached FNM_MULTISHELL_PATH disappears. These are review cases, not ported code.

hmm

@Ivorisnoob

Copy link
Copy Markdown
Contributor Author

bro gave gpt 6 full access to his github acc

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants