Skip to content

OR-423 Install Git and OpenCode reliably on Windows - #540

Merged
myles332 merged 10 commits into
mainfrom
myles/windows-git-onboarding
Oct 6, 2026
Merged

myles332 merged 10 commits into
mainfrom
myles/windows-git-onboarding

Conversation

@myles332

@myles332 myles332 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Windows onboarding finishes far less often than on macOS and Linux. The biggest drop is the automatic OpenCode install, which runs when no agent is detected: 53% of those Windows installs finish onboarding, against 86–87% on macOS and Linux. The OpenCode download from GitHub fails on network errors, but telemetry labelled those failures "Unsupported architecture". Git is also a hard requirement, and onboarding could only say "Install Git, then re-check".

What changes

  • OpenCode downloads more reliably on Windows (install_opencode.ps1): it now tries three sources in order:
    1. GitHub, via Invoke-WebRequest, which uses the system proxy and handles certificate revocation checks on filtered networks, unlike curl.exe. It also forces TLS 1.2 and turns off the progress bar.
    2. The same build from the npm registry (opencode-windows-<arch>), checked against npm's SHA-512 and unpacked with Windows' own tar.exe. No Node is needed.
    3. The previous curl.exe path.
  • Telemetry reports the real failure: the script's full text reached the captured output (through a top-level Write-Error and the console title), so allowlisted phrases inside it, like its never-taken "Unsupported architecture" branch, became every failure's excerpt.
    • The script is now passed via -EncodedCommand and writes errors straight to stderr.
    • The architecture message is reworded.
    • New phrases record which download source failed, plus common .NET network errors.
  • Re-check finds a Git installed while orx runs (shell_env::search_path): on Windows, orx now also reads the registry's current PATH, so no restart is needed.
  • Onboarding can install Git (portable_git.rs, POST /api/git/install):
    • When Windows has no Git, both onboarding Git cards offer Install Git, including the automatic-setup step.
    • It installs the latest PortableGit, checked against GitHub's SHA-256 digest, into %LOCALAPPDATA%\OpenResearch\PortableGit, with no admin prompt and no PATH change.
    • It's added last to the PATH orx searches, so a Git you install yourself takes precedence.

The cfg(windows) code has only been checked by reading it; Windows CI is its first compile.

Test plan

  • cargo fmt --all --check, cargo clippy --all-targets -D warnings, cargo build --locked, cargo test --locked (macOS)
  • UI translation check, tsc --noEmit, vite build, UI unit tests (216 pass); ui/dist rebuilt
  • Live check: PortableGit and OpenCode release assets, GitHub digest fields, npm tarball layout
  • Windows CI compiles and passes
  • Windows, no Git: Install Git on step 1 installs PortableGit and enables Continue
  • Windows, no Git and no agent: the automatic OpenCode setup and Install Git both complete on step 2
  • PortableGit install with a space in the user folder name (-o"<dir>" quoting); no lingering console window
  • With orx running, install Git with the normal installer, then Re-check finds it without a restart
  • OpenCode install with GitHub blocked falls back to npm; check the setup telemetry excerpt names the failed source
  • An experiment run and Claude Code both use PortableGit's bash

🤖 Generated with Claude Code

myles332 and others added 5 commits October 5, 2026 18:20
Re-read the registry PATH so a Git installed while orx runs is found,
offer an orx-installed PortableGit in onboarding, download OpenCode via
the system proxy with an npm fallback, and keep the install script's own
text out of setup telemetry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h steps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Adds Git installation and onboarding flow on Windows.

Add a cross-process Git install lock before merging so separate dashboards cannot interfere with each other.

Findings

  1. P1 Concurrent Git installs interfere ▶
Fix with agent prompt
### Issue 1
src/local/portable_git.rs:32-33
`INSTALLING` only protects one process, but every process installs into the same folder. If the desktop app and `orx up` install Git at the same time, `sweep_stale()` can delete the other install's active staging folder. Both also try to rename into the same destination, so one request can fail even after downloading and checking Git.

Hold a cross-process file lock through cleanup and installation, then re-check `cmd_dir()` after acquiring it.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds Windows onboarding buttons to install a checked PortableGit download. Extends tool lookup with the current registry PATH, adds OpenCode download fallbacks, and encodes the PowerShell command to keep script text out of the console title.

  • Git installation needs a cross-process lock before merging.
  • The UI adds install progress, errors, translations, and rebuilt assets.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Windows onboarding: Install Git] --> B[POST /api/git/install]
  B --> C[Acquire process-local mutex]
  C --> D[Remove matching staging folders]
  D --> E[Download PortableGit]
  E --> F[Check SHA-256]
  F --> G[Extract and check Git]
  G --> H[Move into shared install folder]
  H --> I[Refresh Git status]
  I --> J[Search inherited PATH, registry PATH, then PortableGit]
Loading

Reviews (1) · Last reviewed commit: "Address review round three: full install..."

Comment thread src/local/portable_git.rs
myles332 and others added 5 commits October 5, 2026 21:47
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oarding

# Conflicts:
#	README.md
#	ui/dist/assets/PdfPreview-CUNM1AGl.js
#	ui/dist/assets/PdfPreview-Cv4PDQEo.js
#	ui/dist/assets/PdfPreview-DTe4mY-0.js
#	ui/dist/assets/index-n2QHfWHn.js
#	ui/dist/index.html
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RegGetValueW can report an expanded value's size past its terminator, which
left a NUL in the PATH orx hands every child, so every spawn failed with
"nul byte found in provided data". Also log Git install failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@myles332 myles332 changed the title Install Git and OpenCode reliably on Windows OR-423 Install Git and OpenCode reliably on Windows Oct 6, 2026
@myles332
myles332 merged commit 5538a61 into main Oct 6, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant