Repository navigation
fix(windows): replace the managed CLI launcher with a native one - #24094
Conversation
Every AV false positive here has been handled one vendor and one shipped version at a time. Document the programs that clear future releases instead -- signer and product enrollment rather than per-build sample submission -- and add a script that reports an RC's current detection state by hash, so a verdict is found before users meet it in an issue report. Hash lookup only by default; --upload transmits the artifact and stays manual.
resources\bin\orca.exe was a csc-compiled MSIL assembly: a small, freshly compiled .NET image in a user-writable directory that mutates environment variables and proxies a child process. That is the shape .NET dropper heuristics are trained on, and every verdict against it named the family -- MSILHeracles from two vendors, Wacatac!ml from a third. Signing the file does not change its shape, so signing never cleared it. Rebuild it in Rust. Same resolution, same environment contract, same argv passthrough that keeps newline-bearing orchestration bodies intact (#8374), and the child still inherits our environment block rather than an explicit map, so a block carrying both PATH and Path survives (#12046). The PE now carries publisher, version, icon and an asInvoker manifest from build.rs. Refs #23383
|
| join(crateRoot, 'src', 'main.rs'), | ||
| join(crateRoot, 'build.rs'), | ||
| manifestPath, | ||
| join(crateRoot, 'app.manifest'), | ||
| iconPath, | ||
| join(repoRoot, 'config/scripts/build-windows-cli-launcher.mjs') |
There was a problem hiding this comment.
Lockfile changes reuse old launcher
If Cargo.lock changes while these fingerprint inputs stay the same, a workspace with an existing .build/orca.exe skips Cargo and reuses a launcher built with the previous dependencies. Include the lockfile in the fingerprint so persistent workspaces rebuild the artifact they package.
| throw new Error(`VirusTotal lookup failed for ${sha256}: ${response.status}`) | ||
| } | ||
| const body = await response.json() | ||
| return body?.data?.attributes?.last_analysis_results ?? {} |
There was a problem hiding this comment.
Unavailable results appear clean
A successful lookup without last_analysis_results becomes an empty result set, so an analysis that is not yet available prints “clean across 0 engines” instead of an unknown state. The displayed count also includes timeout, failure, and unsupported entries. This can give someone checking an RC an inaccurate impression of its antivirus coverage.
| if (analysisResults === null && upload) { | ||
| await uploadArtifact(filePath, apiKey) | ||
| analysisResults = null | ||
| } |
There was a problem hiding this comment.
Uploaded artifacts remain unreported
For an artifact with no existing report, --upload submits the file but immediately leaves its result as null. The output then says the build “has never been scanned,” although it was just submitted, and provides no subsequent analysis result. The RC checker must run a separate lookup later to learn the verdict.
Comments Outside DiffThese findings could not be posted inline.
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe Windows CLI launcher now builds from a Rust crate instead of C# source. Its build script, cache, and tests use the Rust inputs. A new VirusTotal scanner hashes release artifacts, looks up existing reports, and uploads files only when requested. New reference guidance covers file-verdict clearance and release-candidate scanning. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 8 files. (2 skipped: 2 unsupported.)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 09daf13f-ec65-4efa-9102-277aa4c81adf
⛔ Files ignored due to path filters (1)
native/windows-cli-launcher/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (14)
.github/workflows/pr.yml.gitignoreAGENTS.mdconfig/scripts/build-windows-cli-launcher.mjsconfig/scripts/build-windows-cli-launcher.test.mjsconfig/scripts/pr-code-change-scope.test.mjsconfig/scripts/scan-release-artifacts-antivirus.mjsconfig/scripts/scan-release-artifacts-antivirus.test.mjsdocs/reference/antivirus-prerelease-clearance.mdnative/windows-cli-launcher/Cargo.tomlnative/windows-cli-launcher/OrcaCliLauncher.csnative/windows-cli-launcher/build.rsnative/windows-cli-launcher/src/main.rssrc/main/cli/windows-launcher-asset.test.ts
💤 Files with no reviewable changes (1)
- native/windows-cli-launcher/OrcaCliLauncher.cs
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
| let analysisResults = await fetchExistingReport(sha256, apiKey) | ||
| if (analysisResults === null && upload) { | ||
| await uploadArtifact(filePath, apiKey) | ||
| analysisResults = null | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Fix the upload path: the report never shows the upload happened.
The --upload flag makes the code call uploadArtifact. Then the code sets analysisResults = null, which is the value it already has. The report therefore shows known: false and "no report yet — this build has never been scanned". This text is misleading after a successful upload. The line at 121 does nothing.
Track the upload state and report it. Remove the no-op assignment.
Proposed fix
- let analysisResults = await fetchExistingReport(sha256, apiKey)
- if (analysisResults === null && upload) {
- await uploadArtifact(filePath, apiKey)
- analysisResults = null
- }
+ const analysisResults = await fetchExistingReport(sha256, apiKey)
+ let uploaded = false
+ if (analysisResults === null && upload) {
+ await uploadArtifact(filePath, apiKey)
+ uploaded = true
+ }Then add uploaded to the pushed report object. In formatArtifactReport, print a message such as "uploaded; rerun later for the verdict" when uploaded is true.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| let analysisResults = await fetchExistingReport(sha256, apiKey) | |
| if (analysisResults === null && upload) { | |
| await uploadArtifact(filePath, apiKey) | |
| analysisResults = null | |
| } | |
| const analysisResults = await fetchExistingReport(sha256, apiKey) | |
| let uploaded = false | |
| if (analysisResults === null && upload) { | |
| await uploadArtifact(filePath, apiKey) | |
| uploaded = true | |
| } |
|
|
||
| | Vendor | Mechanism | Scope | State | | ||
| | ------------------------- | ---------------------------------------------------------------------------- | ------------------------ | ----- | | ||
| | **VirusTotal** | Monitor — paid; builds rescanned daily, developer and vendor both notified | ~70 engines at once | TODO | |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -e
printf '%s\n' '--- file outline ---'
ast-grep outline docs/reference/antivirus-prerelease-clearance.md || true
printf '%s\n' '--- relevant file ---'
cat -n docs/reference/antivirus-prerelease-clearance.md
printf '%s\n' '--- diff base..head ---'
git diff --unified=25 d41403340027a18d5a0bed677eb5f77b80577bf6 -- docs/reference/antivirus-prerelease-clearance.md
printf '%s\n' '--- repository references ---'
rg -n -i -C 3 'VirusTotal|Monitor|daily rescan|vendor alert|partner' --glob '!node_modules' --glob '!dist' .Repository: stablyai/orca
Length of output: 45601
🤖 get_repo_knowledge executed:
get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings
Length of output: 7818
🌐 Web query:
official VirusTotal Monitor documentation scan frequency user notifications vendor alerts partner detection metadata
💡 Result:
Official VirusTotal documentation says:
- **Scan frequency:** Monitor files are scanned **periodically** using the latest antivirus signature sets. The documentation does **not specify a fixed interval**. ([docs.virustotal.com](https://docs.virustotal.com/reference/software-publishers?utm_source=openai))
- **User notifications:** Monitor notifies users when an antivirus flags one of their files. ([docs.virustotal.com](https://docs.virustotal.com/reference/software-publishers?utm_source=openai))
- **Vendor alerts and access:** Participating antivirus partners can access hashes, file contents, metadata, and ownership information for detected files; sharing occurs **only upon a false positive**. ([docs.virustotal.com](https://docs.virustotal.com/reference/antivirus-partners?utm_source=openai))
- **Detection metadata:** When a file is detected, shared metadata can include its hash, filename and path, detection signature, and other information the user provided. The user’s profile should be accurate because this information is shared with scanner companies if—and only if—a file is detected. ([docs.virustotal.com](https://docs.virustotal.com/reference/software-publishers?utm_source=openai))
**Unspecified:** The cited Monitor documentation doesn’t give a precise scan cadence or detail the exact notification channel or timing.
Citations:
- 1: https://docs.virustotal.com/reference/software-publishers?utm_source=openai
- 2: https://docs.virustotal.com/reference/software-publishers?utm_source=openai
- 3: https://docs.virustotal.com/reference/antivirus-partners?utm_source=openai
- 4: https://docs.virustotal.com/reference/software-publishers?utm_source=openai
Align the VirusTotal Monitor claims with its documented guarantees.
VirusTotal Monitor scans files periodically, not on a documented daily schedule. It notifies Monitor users when an antivirus flags a file, but its documentation describes partner access to detection metadata for false positives rather than automatic per-detection vendor alerts. The current wording can create an unsupported 24-hour and vendor-notification guarantee.
Suggested fix
-| **VirusTotal** | Monitor — paid; builds rescanned daily, developer and vendor both notified | ~70 engines at once | TODO |
+| **VirusTotal** | Monitor — paid; builds rescanned periodically; users notified on detection | ~70 engines at once | TODO |
...
-VirusTotal Monitor is the highest-leverage single entry, because it is the only
-channel built for exactly this workflow: uploads sit in a private store, get
-rescanned daily against every engine's current signatures, and when one flags a
-file **both we and that vendor are notified automatically**. Pre-publish upload
-is a supported use, which is precisely the future-release posture we want. It is
-a paid service, monetised on developers and free to the antivirus vendors.
+VirusTotal Monitor is the highest-leverage single entry, because it is the only
+channel built for exactly this workflow: uploads sit in a private store and get
+rescanned periodically using current antivirus signatures. Monitor users are
+notified when an antivirus flags a file, and participating antivirus partners
+can access detection metadata for files identified as false positives.
+Pre-publish upload is a supported use, which is precisely the future-release
+posture we want. It is a paid service, monetised on developers and free to the
+antivirus vendors.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| | **VirusTotal** | Monitor — paid; builds rescanned daily, developer and vendor both notified | ~70 engines at once | TODO | | |
| | **VirusTotal** | Monitor — paid; builds rescanned periodically; users notified on detection | ~70 engines at once | TODO | |
There was a problem hiding this comment.
Important
The antivirus report can print a false clean across 0 engines for a build VirusTotal knows about but has not actually scanned. Cheap to fix, and worth fixing before the report is relied on. The launcher rewrite itself checks out — argv, environment inheritance, exit status and the two missing-file error strings are preserved.
Reviewed changes
- Native launcher rewrite —
OrcaCliLauncher.csis deleted and replaced by a Rust crate (src/main.rs,build.rs,Cargo.toml/Cargo.lock) built withcargo build --release --locked. Argument forwarding, the environment contract (child inherits the process block, no explicit map), exit-status propagation, and the twoUnable to locate …strings are preserved. - Build script —
build-windows-cli-launcher.mjsdrives cargo, embeds the version block/icon/manifest, copiestarget/release/orca.exeto.build/orca.exe, and keeps the content-hash reuse cache and the non-Windows fail-closed guard. - Antivirus clearance tooling — new
scan-release-artifacts-antivirus.mjs(VirusTotal hash lookup, opt-in--upload) with unit tests, plusdocs/reference/antivirus-prerelease-clearance.mdand an AGENTS.md pointer. - Tests / workflows — launcher parity tests rewritten against
main.rswith a guard that the.cscannot reappear;pr.ymlcaches cargotarget/registry;.gitignoreaddstarget/.
ℹ️ The new scan script has no automated caller
The doc places the check at RC time, but nothing invokes scan-release-artifacts-antivirus.mjs — no workflow, no package script — so the report only exists if someone remembers to run it. That is consistent with the stated "no hard gate" intent; confirm it is deliberate, or wire the RC-time invocation the doc describes.
Technical details
# Unwired antivirus scan
## Affected sites
- `config/scripts/scan-release-artifacts-antivirus.mjs` — exported helpers and a CLI main, referenced only by its own test.
- `docs/reference/antivirus-prerelease-clearance.md:90-100` — says to run it against an RC's artifacts, implying a release-flow step that does not exist yet.
## Required outcome
- Either an explicit note that the step is manual-only, or a release-workflow step that runs the hash lookup (without `--upload`) and prints the report.ℹ️ Nitpicks
config/scripts/build-windows-cli-launcher.mjs:64-71— the reuse fingerprint hashesmain.rs,build.rs,Cargo.toml,app.manifest,icon.icoand the script, but notCargo.lock; a lockfile-only dependency change reuses a stale.build/orca.exe(the CI cache key does include it)..github/workflows/pr.yml:1162-1169— thetargetand~/.cargo/registrycaches share a key that includesnative/windows-cli-launcher/**, so a source change misses the registry too; the comment's cold-registry concern only applies to same-key reruns. A separateCargo.lock-keyed registry cache would survive source edits.config/scripts/build-windows-cli-launcher.test.mjs:172-174— the env-map guard covers.env(/.envs(/env_clear;Command::env_removewould also hand the child an explicit map but passes.- The PR's "error strings are byte-identical" claim holds for the two missing-file messages; the spawn-failure suffix necessarily differs (
io::ErrorDisplay vs .NETWin32Exception.Message).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| return `${name}\n sha256 ${sha256}\n no report yet — this build has never been scanned` | ||
| } | ||
| if (flagged.length === 0) { | ||
| return `${name}\n sha256 ${sha256}\n clean across ${scanned} engines` |
There was a problem hiding this comment.
When VirusTotal returns HTTP 200 but last_analysis_results is absent, fetchExistingReport returns {} (line 84), so known is true and scanned is 0 — this branch then prints clean across 0 engines, a false clean for a build that was never actually analyzed. Separately, scanned counts timeout/failure/type-unsupported engines (lines 36-38), so clean across N engines overstates even on the normal path.
Technical details
# False "clean" in the antivirus report
## Affected sites
- `config/scripts/scan-release-artifacts-antivirus.mjs:84` — `?? {}` turns a 200 with no `last_analysis_results` into an empty object, which then reads as "known".
- `config/scripts/scan-release-artifacts-antivirus.mjs:127` — `known: analysisResults !== null` is therefore true.
- `config/scripts/scan-release-artifacts-antivirus.mjs:54-55` — falls through to `clean across ${scanned} engines` with `scanned === 0`.
- `config/scripts/scan-release-artifacts-antivirus.mjs:36-38` — `scanned` increments for every engine, including those that did not yield a verdict.
## Required outcome
- An artifact with no analyzed engine results must not be reported as clean (use the `!known` "never been scanned" wording or a distinct "results pending" state).
- The clean line must not count engines whose scan did not produce a verdict.
## Suggested approach (optional)
- Require a non-empty `last_analysis_results` for `known`, or branch on `scanned === 0` before the clean message.
- Track an `undetected` count for the clean line instead of reusing `scanned`.The hosted runners happen to ship cargo, but a real Windows dev box does not -- verified on our own Windows QA host, where cargo and rustc were both absent. Relying on the image means a future image change fails deep inside electron-builder's native hook instead of at an obvious step.
|
Verified on a real Windows host (not CI, not a simulation) plus a measured CI pass. Build on Windows: PE metadata, read back off the built binary with
The core assertion: Behaviour, through PowerShell → launcher → child: One finding that changed the PR. CI cost, measured from the job's own step timings:
That run was a cache miss, so the ~5s cargo build is inside the 71s. On a hit the build script short-circuits on its content fingerprint and cargo never runs. The cache key already hashes Signing needs no change, confirmed by reading the release workflow. The staging step enumerates every Local Windows contributors now need Rust; the build script fails with an explicit "Install Rust (https://rustup.rs)" message rather than an ENOENT. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- CI Rust toolchain setup —
pr.ymlandrelease-cut.ymlgain anEnsure the Rust toolchain for the Windows CLI launcherstep that installs the stable Rust toolchain viarustupwhenGet-Command cargofinds nothing, then printscargo --version. It runs before the packaged build so a host without cargo fails at a named step rather than mid-build. - Platform scoping — the
release-cut.ymlcopy is gated onmatrix.platform == 'win'; thepr.ymlsource is already awindows-2022-only job, so its copy is unconditional. No launcher code, build script, or preserved behavior contract changes in this delta.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 611a0444-3d88-44ff-8382-d403e44706e8
📒 Files selected for processing (2)
.github/workflows/pr.yml.github/workflows/release-cut.yml
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| # Why an explicit step rather than trusting the runner image: the packaged | ||
| # CLI launcher is a native Rust binary, and a host without cargo fails deep | ||
| # inside electron-builder's native hook instead of here. | ||
| - name: Ensure the Rust toolchain for the Windows CLI launcher | ||
| shell: pwsh | ||
| run: | | ||
| if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) { | ||
| rustup toolchain install stable --profile minimal | ||
| rustup default stable | ||
| } | ||
| cargo --version | ||
|
|
||
| - name: Build package inputs | ||
| run: pnpm run build:release:parallel | ||
|
|
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Refresh Cargo’s PATH before the version check.
When cargo is unavailable, Rustup installs Cargo under $env:USERPROFILE\.cargo\bin, but the current PowerShell process keeps its existing PATH. The same-step cargo --version can therefore fail and stop packaging before pnpm run build:release:parallel.
Suggested fix
if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) {
rustup toolchain install stable --profile minimal
rustup default stable
+ $cargoBin = Join-Path $env:USERPROFILE '.cargo\bin'
+ $env:Path = "$cargoBin;$env:Path"
+ $cargoBin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
}
cargo --version📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Why an explicit step rather than trusting the runner image: the packaged | |
| # CLI launcher is a native Rust binary, and a host without cargo fails deep | |
| # inside electron-builder's native hook instead of here. | |
| - name: Ensure the Rust toolchain for the Windows CLI launcher | |
| shell: pwsh | |
| run: | | |
| if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) { | |
| rustup toolchain install stable --profile minimal | |
| rustup default stable | |
| } | |
| cargo --version | |
| - name: Build package inputs | |
| run: pnpm run build:release:parallel | |
| # Why an explicit step rather than trusting the runner image: the packaged | |
| # CLI launcher is a native Rust binary, and a host without cargo fails deep | |
| # inside electron-builder's native hook instead of here. | |
| - name: Ensure the Rust toolchain for the Windows CLI launcher | |
| shell: pwsh | |
| run: | | |
| if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) { | |
| rustup toolchain install stable --profile minimal | |
| rustup default stable | |
| $cargoBin = Join-Path $env:USERPROFILE '.cargo\bin' | |
| $env:Path = "$cargoBin;$env:Path" | |
| $cargoBin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| } | |
| cargo --version | |
| - name: Build package inputs | |
| run: pnpm run build:release:parallel | |
| # Why an explicit step rather than trusting the runner image: the packaged | ||
| # CLI launcher is a native Rust binary, and a Windows host without cargo | ||
| # fails deep inside electron-builder's native hook instead of here. Real | ||
| # Windows dev machines do not have it by default either. | ||
| - name: Ensure the Rust toolchain for the Windows CLI launcher | ||
| if: matrix.platform == 'win' | ||
| shell: pwsh | ||
| run: | | ||
| if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) { | ||
| rustup toolchain install stable --profile minimal | ||
| rustup default stable | ||
| } | ||
| cargo --version | ||
|
|
||
| # Why ORCA_POSTHOG_WRITE_KEY here: this is the only build that | ||
| # produces a published binary, so this is the only place the secret | ||
| # needs to be in scope. The key is a PostHog *project* API key, not |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Refresh Cargo’s PATH after Rust installation.
When cargo is unavailable, rustup installs Cargo but does not refresh the current PowerShell process. The same step then runs cargo --version, which can fail and prevent the release build from starting. Update the current PATH and persist Cargo’s bin directory for later steps.
Suggested fix
if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) {
rustup toolchain install stable --profile minimal
rustup default stable
+ $cargoBin = Join-Path $env:USERPROFILE ".cargo\bin"
+ $env:Path = "$cargoBin;$env:Path"
+ Add-Content -Path $env:GITHUB_PATH -Value $cargoBin
}
cargo --version📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Why an explicit step rather than trusting the runner image: the packaged | |
| # CLI launcher is a native Rust binary, and a Windows host without cargo | |
| # fails deep inside electron-builder's native hook instead of here. Real | |
| # Windows dev machines do not have it by default either. | |
| - name: Ensure the Rust toolchain for the Windows CLI launcher | |
| if: matrix.platform == 'win' | |
| shell: pwsh | |
| run: | | |
| if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) { | |
| rustup toolchain install stable --profile minimal | |
| rustup default stable | |
| } | |
| cargo --version | |
| # Why ORCA_POSTHOG_WRITE_KEY here: this is the only build that | |
| # produces a published binary, so this is the only place the secret | |
| # needs to be in scope. The key is a PostHog *project* API key, not | |
| # Why an explicit step rather than trusting the runner image: the packaged | |
| # CLI launcher is a native Rust binary, and a Windows host without cargo | |
| # fails deep inside electron-builder's native hook instead of here. Real | |
| # Windows dev machines do not have it by default either. | |
| - name: Ensure the Rust toolchain for the Windows CLI launcher | |
| if: matrix.platform == 'win' | |
| shell: pwsh | |
| run: | | |
| if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) { | |
| rustup toolchain install stable --profile minimal | |
| rustup default stable | |
| $cargoBin = Join-Path $env:USERPROFILE ".cargo\bin" | |
| $env:Path = "$cargoBin;$env:Path" | |
| Add-Content -Path $env:GITHUB_PATH -Value $cargoBin | |
| } | |
| cargo --version | |
| # Why ORCA_POSTHOG_WRITE_KEY here: this is the only build that | |
| # produces a published binary, so this is the only place the secret | |
| # needs to be in scope. The key is a PostHog *project* API key, not |

ELI5
The little
orca.exethat makes theorcacommand work on Windows was written in C# and compiled into a .NET program. That specific combination — a tiny .NET file, freshly compiled, sitting in a user-writable folder, changing environment variables and launching another program — is almost exactly what a certain family of malware looks like, so antivirus engines kept deleting it. This rewrites the same program in Rust, which removes the resemblance. It does not change anything a user can see.What Changed
native/windows-cli-launcher/becomes a small Rust crate instead of a single.csfile compiled bycsc.exe.Before:
resources\bin\orca.exewas a 6,144-byte MSIL assembly built by the .NET Framework compiler. It was signed as of v1.4.217, and still flagged.After: the same file is an ordinary native PE built by
cargo, carrying a full version block, the application icon, and theasInvokermanifest.native/windows-cli-launcher/src/main.rs— the launcher. Same path resolution, same error strings, same environment contract, same exit-code propagation.native/windows-cli-launcher/build.rs— embeds ProductName, FileDescription, CompanyName, LegalCopyright, InternalName, OriginalFilename, FileVersion and ProductVersion, plus the manifest and icon. The release version is passed in frompackage.json, so the binary always reports the release it shipped in.config/scripts/build-windows-cli-launcher.mjs— invokescargo build --release --lockedinstead ofcsc.exe. The content-hash reuse cache, the--outputcontract, and the non-Windows fail-closed guard are unchanged.OrcaCliLauncher.csis deleted, and a test asserts it cannot come back.Why
Look at what the vendors actually called it:
Trojan.MSIL.MSILHERACLESGen:Variant.MSILHeraclesTrojan:Win32/Wacatac.B!ml,.H!mlMSILHeraclesis a .NET-specific heuristic family, andWacatac!mlis an ML classifier whose training data is saturated with small .NET droppers. These are not signature hits on our bytes — they are verdicts on the binary's shape. We were shipping the textbook artifact: a tiny managed image, compiled at build time, in%LOCALAPPDATA%, that rewrites environment variables and proxies a process.That is why signing did not fix it. v1.4.217 signs the launcher correctly, and a signed MSIL file is still an MSIL file. The only fix that addresses the cause is to stop emitting one.
Why not delete the launcher and keep only
orca.cmd. That was my first instinct and it is wrong.orca.cmddeliberately refusesorchestration sendandorchestration reply, becausecmd.exereparses%*and will execute or truncate embedded newlines — #8374. A batch-only path silently loses multiline message bodies. The launcher has to exist; it just must not be managed code.Why Rust over C++. Both remove the MSIL signature. C++ would have reused the existing
binding.gyp/MSVC toolchain with no new dependency, which is a real advantage. Rust wins on the two things that matter more here:build.rsgives us the version block, manifest and icon in one declarative place that is hard to get wrong, and a comparable Electron editor already ships a signed native Rust CLI binary in exactly this role without drawing these verdicts. Toolchain cost is low — the hosted Windows runners already carry Rust, and--lockedagainst a committedCargo.lockkeeps the build reproducible.What is deliberately preserved, because each encodes a fixed bug:
PATHandPathinto one entry and killing the CLI ([Bug] Windows Orca CLI crashes when environment contains both PATH and Path #12046). The launcher mutates its own process and leaves the child map untouched, which is what the C# version did for the same reason.ORCA_CLI_COMMANDis still normalised toorcaunless it is exactlyorca-ide.Linked Issue
Refs #23383 — this removes the cause of the detections. I have not closed it, because the certificate story (#6487, #14317) and the install location are separate contributors tracked there and in #23999.
Visual Proof
N/A— no UI or interaction change. The observable difference is the file type ofresources\bin\orca.exe.Testing
The launcher is cross-platform Rust, so I built and exercised the real binary on macOS against a synthetic app tree, then confirmed the Node-side contract tests.
Behavioural parity, verified against a built binary:
Also confirmed by hand:
ORCA_CLI_COMMAND=orca-idepasses through, any other value normalises toorca, a child exiting 42 makes the launcher exit 42, and a missingOrca.exeprints the originalUnable to locate Orca.exe next to "..."and exits 1.Automated:
build-windows-cli-launcher.test.mjs,windows-launcher-asset.test.ts,pr-code-change-scope.test.mjs,ssh-remote-cli-launcher.test.ts— 50 passed, 5 skipped (the Windows-only integration cases).windows-signing-workflow-contract.test.mjs11 passed.cargo fmt --checkandcargo clippy -- -D warningsclean.pnpm run check:code-quality:changedclean.Two tests were rewritten rather than deleted, keeping their intent: the environment-map guard now reads
main.rsand asserts no.env()/.envs()/env_clearon the child, and a new case assertsOrcaCliLauncher.csdoes not reappear.What I could not verify locally: the Windows-only cases — PE version block, embedded manifest, embedded icon, the multiline path through PowerShell, and the duplicate
PATH/Pathharness. They run on this PR's Windows packaging job, which also provescargois present on the runner; the build script fails with an explicit "install Rust" message if it is not.Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
resources\bin\orca.exeto carry a valid signature before publish.src/main/ssh/ssh-remote-cli-launcher.tsstill compiles a C# launcher on the remote host viacsc.exeat runtime. That is the same MSIL shape plus runtime compilation, which scores worse. It needs its own change and I will open an issue.orca.cmdand anything invokingorca.exedirectly are unaffected.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)