Skip to content

fix(windows): replace the managed CLI launcher with a native one - #24094

Merged
nwparker merged 3 commits into
mainfrom
nwparker/native-windows-cli-launcher
Sep 30, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/native-windows-cli-launcher

Conversation

@nwparker

@nwparker nwparker commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​139 $\color{#cf222e}{\Huge{\mathbf{−}}}$​35 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​104
Prod 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​705 $\color{#cf222e}{\Huge{\mathbf{−}}}$​185 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​520

ELI5

The little orca.exe that makes the orca command 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 .cs file compiled by csc.exe.

Before: resources\bin\orca.exe was 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 the asInvoker manifest.

  • 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 from package.json, so the binary always reports the release it shipped in.
  • config/scripts/build-windows-cli-launcher.mjs — invokes cargo build --release --locked instead of csc.exe. The content-hash reuse cache, the --output contract, and the non-Windows fail-closed guard are unchanged.
  • OrcaCliLauncher.cs is deleted, and a test asserts it cannot come back.

Why

Look at what the vendors actually called it:

Vendor Verdict
Trend Micro Trojan.MSIL.MSILHERACLES
Bitdefender Gen:Variant.MSILHeracles
Microsoft Defender Trojan:Win32/Wacatac.B!ml, .H!ml

MSILHeracles is a .NET-specific heuristic family, and Wacatac!ml is 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.cmd deliberately refuses orchestration send and orchestration reply, because cmd.exe reparses %* 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.rs gives 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 --locked against a committed Cargo.lock keeps the build reproducible.

What is deliberately preserved, because each encodes a fixed bug:

  • Arguments are forwarded as individual argv entries, so a body containing newlines arrives intact (fix(cli): preserve multiline arguments on Windows #8374).
  • The child inherits our environment block rather than being handed an explicit map. Setting any entry on the child's environment would make the spawn rebuild the block from a case-insensitive map, collapsing an inherited PATH and Path into 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_COMMAND is still normalised to orca unless it is exactly orca-ide.
  • Error strings are byte-identical, so existing user-facing diagnostics and issue reports still match.

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 of resources\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:

argv:                ["orchestration","send","--body","line one\nline two\n\nline four","--json"]
ELECTRON_RUN_AS_NODE 1
ORCA_WINDOWS_PACKAGED_CLI_LAUNCHER 1
NODE_OPTIONS         null          (moved)
ORCA_NODE_OPTIONS    --no-warnings (received)

Also confirmed by hand: ORCA_CLI_COMMAND=orca-ide passes through, any other value normalises to orca, a child exiting 42 makes the launcher exit 42, and a missing Orca.exe prints the original Unable 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.mjs 11 passed. cargo fmt --check and cargo clippy -- -D warnings clean. pnpm run check:code-quality:changed clean.

Two tests were rewritten rather than deleted, keeping their intent: the environment-map guard now reads main.rs and asserts no .env()/.envs()/env_clear on the child, and a new case asserts OrcaCliLauncher.cs does 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/Path harness. They run on this PR's Windows packaging job, which also proves cargo is present on the runner; the build script fails with an explicit "install Rust" message if it is not.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: strictly reduces heuristic surface. The signing chain is untouched — the file is still an unsigned PE at build time, still staged by the release workflow's inner-signing step, and still named explicitly by the evidence gate that requires resources\bin\orca.exe to carry a valid signature before publish.
  • Cross-platform: Windows-only artifact. The build script still refuses to run off Windows, so a non-Windows host cannot package a Windows app with a missing launcher.
  • Remote SSH: untouched here, but worth flagging — src/main/ssh/ssh-remote-cli-launcher.ts still compiles a C# launcher on the remote host via csc.exe at runtime. That is the same MSIL shape plus runtime compilation, which scores worse. It needs its own change and I will open an issue.
  • Performance: one process spawn, as before. Binary grows from ~6KB to ~320KB, which is noise next to the installer.
  • Backwards compatibility: the file name, location, arguments, environment contract and error strings are unchanged, so orca.cmd and anything invoking orca.exe directly are unaffected.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

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
@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[High risk] Replaces the Windows CLI launcher build from managed to native Rust.

No newly introduced blocking issue was identified; the outstanding findings concern build-cache freshness and antivirus report accuracy.

Findings

  1. P2 Lockfile changes reuse old launcher ▶
  2. P2 Unavailable results appear clean ▶
  3. P2 Uploaded artifacts remain unreported ▶

Summary

The PR replaces the managed Windows CLI launcher with a Rust binary, embeds PE metadata, and adds Windows workflow steps to check for Cargo. It also adds an opt-in antivirus artifact-reporting script and clearance guidance.

  • The new toolchain steps match the configured Windows runners and precede packaging.
  • No new actionable finding was established since the previous review.

Reviews (2) · Last reviewed commit: "ci(windows): install the Rust toolchain ..."

Comment on lines +65 to 70
join(crateRoot, 'src', 'main.rs'),
join(crateRoot, 'build.rs'),
manifestPath,
join(crateRoot, 'app.manifest'),
iconPath,
join(repoRoot, 'config/scripts/build-windows-cli-launcher.mjs')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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 ?? {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Comment on lines +119 to +122
if (analysisResults === null && upload) {
await uploadArtifact(filePath, apiKey)
analysisResults = null
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

@greptile-apps

greptile-apps Bot commented Sep 30, 2026

Copy link
Copy Markdown

Comments Outside Diff

These findings could not be posted inline.

  • P2 Windows launcher checks are skipped config/scripts/build-windows-cli-launcher.test.mjs:35 ▶

    The tests for PE resources, multiline arguments, and duplicate PATH/Path entries run only on Windows, but this file is absent from the Windows PR job’s test list. Linux discovers the file and skips those cases; the packaged CLI smoke test does not check these contracts. Add this file to the Windows test step so regressions in the new launcher are caught before release.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

The 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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: replacing the managed Windows CLI launcher with a native launcher.
Description check ✅ Passed The description is detailed and covers the required ELI5, changes, rationale, linked issue, visual proof, testing, review notes, compatibility considerations, and checklist. It uses “Refs #23383” inst…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

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.)

  • Fix all pre-merge checks with AI

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 09daf13f-ec65-4efa-9102-277aa4c81adf

📥 Commits

Reviewing files that changed from the base of the PR and between 5fa290f and 9aa9f22.

⛔ Files ignored due to path filters (1)
  • native/windows-cli-launcher/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (14)
  • .github/workflows/pr.yml
  • .gitignore
  • AGENTS.md
  • config/scripts/build-windows-cli-launcher.mjs
  • config/scripts/build-windows-cli-launcher.test.mjs
  • config/scripts/pr-code-change-scope.test.mjs
  • config/scripts/scan-release-artifacts-antivirus.mjs
  • config/scripts/scan-release-artifacts-antivirus.test.mjs
  • docs/reference/antivirus-prerelease-clearance.md
  • native/windows-cli-launcher/Cargo.toml
  • native/windows-cli-launcher/OrcaCliLauncher.cs
  • native/windows-cli-launcher/build.rs
  • native/windows-cli-launcher/src/main.rs
  • src/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.

Comment on lines +118 to +122
let analysisResults = await fetchExistingReport(sha256, apiKey)
if (analysisResults === null && upload) {
await uploadArtifact(filePath, apiKey)
analysisResults = null
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Suggested change
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 |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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.

Suggested change
| **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 |

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.cs is deleted and replaced by a Rust crate (src/main.rs, build.rs, Cargo.toml/Cargo.lock) built with cargo build --release --locked. Argument forwarding, the environment contract (child inherits the process block, no explicit map), exit-status propagation, and the two Unable to locate … strings are preserved.
  • Build script — build-windows-cli-launcher.mjs drives cargo, embeds the version block/icon/manifest, copies target/release/orca.exe to .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, plus docs/reference/antivirus-prerelease-clearance.md and an AGENTS.md pointer.
  • Tests / workflows — launcher parity tests rewritten against main.rs with a guard that the .cs cannot reappear; pr.yml caches cargo target/registry; .gitignore adds target/.

ℹ️ 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 hashes main.rs, build.rs, Cargo.toml, app.manifest, icon.ico and the script, but not Cargo.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 — the target and ~/.cargo/registry caches share a key that includes native/windows-cli-launcher/**, so a source change misses the registry too; the comment's cold-registry concern only applies to same-key reruns. A separate Cargo.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_remove would 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::Error Display vs .NET Win32Exception.Message).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using 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`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@nwparker

Copy link
Copy Markdown
Contributor Author

Verified on a real Windows host (not CI, not a simulation) plus a measured CI pass.

Build on Windows: node config/scripts/build-windows-cli-launcher.mjs exits 0, cold compile 5.2s including crate download, 264,704-byte output.

PE metadata, read back off the built binary with FileVersionInfo:

Field Value
CompanyName Stably AI
ProductName Orca
FileDescription Orca CLI Launcher
FileVersion 1.4.214.0
ProductVersion 1.4.214
OriginalFilename orca.exe

hasAsInvoker: true, and hasOurManifestIdentity: true — the embedded manifest is ours, containing StablyAI.Orca.CliLauncher. Worth noting because the launcher currently shipping in v1.4.217 embeds csc's default MyApplication.app stub with FileVersion 0.0.0.0; this is the first build where the manifest and version block are actually ours. hasIcon: true.

The core assertion: isManagedDotNet: false — no mscoree.dll import, no _CorExeMain. The binary is no longer a managed image, which is the whole point.

Behaviour, through PowerShell → launcher → child:

argv     ["orchestration","send","--body","paragraph one line one\nparagraph one line two\n\nparagraph two","--json"]
multilineSurvived  true
ELECTRON_RUN_AS_NODE  1
ORCA_WINDOWS_PACKAGED_CLI_LAUNCHER  1
ORCA_CLI_COMMAND  orca
NODE_OPTIONS  null     (moved)
ORCA_NODE_OPTIONS  --no-warnings

One finding that changed the PR. cargo and rustc were both absent from that Windows host, so I installed rustup there to finish the verification. The hosted runners do ship cargo — the package (windows) job built the launcher successfully before this commit — but relying on the image means a future image change would fail deep inside electron-builder's native hook rather than at an obvious step. Added an explicit toolchain step to both Windows build paths, skipped when cargo is already present.

CI cost, measured from the job's own step timings:

Step Duration
Cache Windows CLI launcher (restore) 1s
Build package inputs (contains the cargo build) 71s
Cache save 2s

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 native/windows-cli-launcher/** (now including Cargo.lock), and I extended its paths to carry target/ and the cargo registry so a miss recompiles from warm rather than cold. No further optimisation is worth it at this scale.

Signing needs no change, confirmed by reading the release workflow. The staging step enumerates every .exe/.dll/.node under dist/win-unpacked, skips ones already validly signed, and submits the rest; the new PE is unsigned at build time, so it is staged exactly as the old one was. The evidence gate then names resources\\bin\\orca.exe explicitly and fails the release unless it comes back SignPath-signed. The cargo target/ directory cannot leak into the package — native{,/**/*} is excluded from app.asar and only .build/orca.exe is mapped through extraResources.

Local Windows contributors now need Rust; the build script fails with an explicit "Install Rust (https://rustup.rs)" message rather than an ENOENT.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • CI Rust toolchain setup — pr.yml and release-cut.yml gain an Ensure the Rust toolchain for the Windows CLI launcher step that installs the stable Rust toolchain via rustup when Get-Command cargo finds nothing, then prints cargo --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.yml copy is gated on matrix.platform == 'win'; the pr.yml source is already a windows-2022-only job, so its copy is unconditional. No launcher code, build script, or preserved behavior contract changes in this delta.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 611a0444-3d88-44ff-8382-d403e44706e8

📥 Commits

Reviewing files that changed from the base of the PR and between 9aa9f22 and b3f0b03.

📒 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.

Comment thread .github/workflows/pr.yml
Comment on lines +1171 to 1185
# 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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.

Suggested change
# 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

Comment on lines +1398 to 1414
# 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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.

Suggested change
# 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

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