Skip to content

feat(vika): review Windows-tested source preview integration - #7218

Merged
ZaynJarvis merged 56 commits into
volcengine:feat/vikafrom
openviking-superagent:vika-win
Nov 8, 2026
Merged

ZaynJarvis merged 56 commits into
volcengine:feat/vikafrom
openviking-superagent:vika-win

Conversation

@openviking-superagent

@openviking-superagent openviking-superagent commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Native Windows cannot run Vika's Unix process, socket and executable assumptions unchanged. This PR adds a source-only Windows adapter while retaining the existing Linux/macOS behavior. Windows remains a trusted single-user preview. The structural review and six follow-up cleanup items are addressed; ready for review, with native Windows acceptance still pending.

Scope after review

  • All platform selection for shared source lives in packages/daemon/src/platform/{index,posix,win32}.mjs. Shared callers import the index; an isolation test rejects platform detection elsewhere in package source and root CJS files. POSIX spawn/execFile remain the native Node functions.
  • Windows handles npm Node shims, environment casing, process-tree termination, randomized action pipes, and OpenCode junctions/file copies. Codex developer instructions use RPC; Claude uses its documented system-prompt file option.
  • Removed the Windows installer, ACL provisioning, PM2 patches, VBS startup, PowerShell tool replacements, Slack executable default and Windows CI. Node/npm/PM2/Git Bash are user prerequisites. Upgrade/updater, autostart, email and Windows release builds are disabled.
  • Added Windows Lark CLI dependency download to the existing artifact path, with ZIP extraction and checksum verification. Source-only targets are excluded from release builds.
  • Reverted unrelated lock identity, logger redaction, delivered-notice semantics, durable interruption, connector diagnostics, log options and POSIX PM2 changes. They are not included in this preview; no separate PRs have been opened yet.
  • User documentation is in vika/docs/windows.md; README changes are limited to one link. Process/acceptance documents were removed.

The requested steps are separate commits, followed by an entrypoint shebang correction. The full earlier fork remains reachable at 7f02e92365c504452e09535e4abc6cf205ffdda7. Shared import changes and regression tests account for a wider file count than the initial suggested estimate.

Follow-up cleanup at 89bbed7

Addresses all six items in #7218 (comment):

  • Runtime-specific prompt transport lives in Claude/Codex, using generic OS limits.
  • Product support is one capabilities object outside the OS adapter.
  • PM2 configuration/environment helpers live in the updater package and return the filtered environment directly.
  • Names now describe their values: ecosystemSearchPath, spawnDetached, urlOpenCommand.
  • Removed platformName/windowsX64 and platform-string test switches; tests inject implementations.
  • A declared interface and exact export-set tests cover both implementations and the facade. The npm shim parser is private.

The artifact platform catalog is data in updater/artifact-platforms.json, included by the existing archive/copy release path. No release was built or published.

Validation at 89bbed7

  • Linux npm test: 1291 tests, 1282 pass, 9 skip, 0 fail.
  • npm run check and git diff --check: pass.
  • POSIX process APIs and explicit detached overrides are covered; ecosystem snapshots were captured from upstream a6c43c1, including Linux/macOS configuration selection.
  • macOS was not run. A macOS configuration selected in a Linux test is not a macOS runtime test.
  • This refactor has not been accepted on Windows. The earlier full-fork Windows acceptance at 875117d does not certify this substantially narrowed source preview. Windows-only tests skipped on Linux require native execution.

Disclosed preview limits and pending native validation

  • Pipe-owner SID verification is not implemented. Random per-process names plus user/instance digest and existing authority checks are not equivalent to owner verification; occupied-pipe failure has a Windows test pending native execution. Do not claim multi-user isolation.
  • TraeX still passes instructions via argv because its corresponding RPC support has not been verified; its Windows command-line length limit remains.
  • Claude/Codex long instructions, native PM2 startup/stop, Git Bash tools, connector/runtime behavior and Windows pipe/process tests need real-machine validation. macOS regression validation is also outstanding.

Migration is not an in-place upgrade through the removed installer: preserve the working installation and use a separate checkout/configuration, with the documented native PM2 source startup. The old fork's additional fixes and logs flags are not promises of this PR. Ready for reviewer evaluation as requested. Native Windows results must be reported separately; readiness does not certify untested runtime or isolation guarantees.

openviking-superagent and others added 30 commits November 6, 2026 17:35
The ACL refusal case rebuilt a protected directory ACL from Get-Acl and applied it with Set-Acl. On a non-elevated shell Set-Acl also tries to write the SACL and fails with PrivilegeNotHeldException, so the test failed during fixture setup even though the product path is unaffected. GitHub's elevated windows-latest shell masked that dependency.

Author the ACE with icacls instead. icacls writes only the DACL and needs no privilege beyond the owner's WRITE_DAC, so the test now exercises the product refusal on ordinary developer shells as well.
The Windows CI job runs eight native test files; the checkout validation snippet in WINDOWS.md listed five, so following the document did not cover the ACL, PM2 and coding-tools paths.
…-elevation

test(windows): make the ACL refusal case runnable without elevation
GitHub-hosted Windows runners are administrators with UAC disabled, so a green CI run can hide fixtures that only work in an elevated token. Document that checkout validation must run in a normal PowerShell session, cite the GitHub-hosted runners reference, and add a guard that throws before validation when the session is elevated.

Local acceptance steps only: no CI job, product permission logic, or runtime/DSH integration changes.
…stall

Validated the preview end to end on a non-elevated Windows 11 workstation: source install, bundled Pi/Durable 1.4.0 and OV detection work; a single-command Windows install does not exist, npm 12 blocks the bundled Lark CLI postinstall without failing the installer, and model credentials still depend on ~/.pi/agent. Documents the evidence and the acceptance criteria for the Windows release.
Windows release artifacts and reports must never carry provider credentials: setup reads the user's Pi model config or a user-supplied secrets file instead.
…vated-validation

docs(windows): require non-elevated checkout validation
fix(windows): verify Lark CLI when npm blocks postinstall
At 8bcde77 the installer bootstraps and verifies the Lark CLI under blocked npm lifecycle scripts, and the manual update flow plus 31/31 native tests pass on a non-elevated workstation. Model guidance exists; document the measured detection boundary: Pi reads inherited environment plus ~/.pi/agent, Durable also reads ~/.vika/secrets.env, so a secrets file alone does not make Pi selectable.
setup showed the default workspace as ~\..., but expandHome only handled the POSIX ~/ form, so accepting the default saved a literal ~ directory under the user profile (issue #7). Expand both separators and cover it with a test.
…-blockers

docs(vika): record native Windows preview blockers for one-command install

@ZaynJarvis ZaynJarvis left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for putting the full Windows fork up for review. The Linux test suite passes (base 1260 / PR 1315, 0 failures; the 17 extra skips are Windows-only cases). But this can't merge in its current shape: Windows logic is spread across ~20 shared source files, several POSIX behavior changes ride along without a win32 guard, and out-of-scope pieces from the #7178 review are still here. Please restructure as follows. Work through the steps in order and keep each step in its own commit.

Goal

Windows support must be an isolated platform adapter. Core and channel code must behave identically on macOS/Linux before and after this PR, and must contain no win32 branches. System dependencies (Node, npm, pm2, Git Bash) are user-installed prerequisites documented in vika/WINDOWS.md, not auto-installed or patched by Vika.

Step 1: Remove out-of-scope pieces (same list as the #7178 review)

Delete these files and their tests (moving them into daemon/windows/ in 7f02e92 is not enough), and remove every call site:

  • daemon/windows/windows-acl.mjs (ACL hardening) + test/windows-acl.test.mjs
  • daemon/windows/ensure-windows-lark-cli.mjs + cli/test/windows-lark-install.test.mjs. Instead add a win32-x64 entry to the platform map in vika/packages/updater/src/artifacts.mjs so the existing scripts/install-lark-cli.mjs / build-release.mjs path fetches lark-cli for Windows.
  • daemon/windows/pm2-windows.cjs, windows-pm2-launch.mjs (in-memory pm2 patching) + their tests
  • VBS autostart; on Windows vika autostart should print a clear "not supported in the Windows preview" message and exit non-zero
  • daemon/windows/install-windows.ps1
  • PowerShell replacements for Pi/Durable tools (coding-tools.mjs, piPlatformTools, cliShellHint); document Git Bash as a prerequisite instead
  • the slack.exe default
  • .github/workflows/vika-windows.yml (can come back in a later PR once the preview is validated on real machines)

Step 2: Move unrelated behavior changes out of this PR

These change macOS/Linux behavior and are not about Windows. Revert them here; if you still want them, open one separate PR per item with its own description and tests:

  1. vika/packages/daemon/src/lock.mjs:21: reading /proc/<pid>/stat start time on Linux. Today a stale lock with a live PID errors out; with this change a reused PID lets the lock be taken over.
  2. logger.mjs:78: redaction now applies to the whole record, including level/msg.
  3. notices.mjs:61, store.mjs:1679, actions/service.mjs:697: the new "already delivered, don't retry or notify" semantics.
  4. durable.mjs:635: emitting tool_completed FAILED on interrupt.
  5. connectors/process.mjs:18: filtering debug/info/warn lines out of crash details.
  6. vika logs --lines/--no-follow and the logsCommand exit-code change (empty code now 1 instead of 0).
  7. updater/pm2.mjs:152 realpath comparison and the 11 extra keys in the pm2 environment whitelist.

Step 3: Consolidate all platform logic into one module

Create vika/packages/daemon/src/platform/:

  • index.mjs: the only module other code imports. It selects the implementation once at load time (process.platform === 'win32') and re-exports one interface.
  • posix.mjs: must be a pure pass-through to today's behavior (same child_process calls, same paths, same env handling).
  • win32.mjs: the Windows implementation.

Interface (move the existing logic into it; names are suggestions):

Function Moves from
spawn, execFile, which current platform.mjs, runtimes.which, agent-clis.mjs
killTree(pid) process-utils.mjs (taskkill /T /F on win32)
socketPath(dataDir, name), isPipe config.mjs, main.mjs (named pipe on win32)
normalizeEnv(env) ecosystem.config.cjs, deployment-config.cjs, slack/cli.mjs (Path/PATH, TEMP/TMP, USERPROFILE)
homeDir() control.mjs, deployment-config.cjs
privateDir(path) private-temp.mjs (skip the mode check on win32)
processIdentity(pid) lock.mjs (only if you keep step 2.1 in its own PR)
onShutdown(handler) pm2 shutdown message handling in daemon/main.mjs and web/main.mjs
shellHint() agent-clis.mjs, pi-runtime.mjs
binName(name) lark-cli-bin.mjs, slack/cli.mjs (.exe on win32)

The CLI and web packages import from the daemon's platform/ (or a small shared copy). After this step, only platform/ and WINDOWS.md may mention win32. That includes autostart.mjs, control.mjs, qr.mjs, setup.mjs, upgrade.mjs, config.mjs, connectors/process.mjs, durable.mjs, main.mjs, ov-isolation.mjs, pi-runtime.mjs, private-temp.mjs, process-utils.mjs and ecosystem.config.cjs.

Also fix the open items from the #7178 review inside win32.mjs:

  • promisify.custom throwing ERR_INVALID_ARG_TYPE when args are omitted
  • child processes losing PATH when the parent env key is Path
  • prompts passed on the command line can exceed 32767 characters; use stdin or a temp file on win32
  • named pipe name squatting; include a per-user random component and verify the pipe owner

Step 4: Guard rails

  1. Add a test, e.g. daemon/test/platform-isolation.test.mjs, that greps vika/packages/**/src and vika/*.cjs and fails if process.platform or 'win32' appears outside platform/.
  2. Add platform/posix.test.mjs asserting every exported function behaves exactly like the native Node call on POSIX.
  3. Add a snapshot test of the generated pm2/ecosystem config on Linux and macOS, so env-whitelist drift shows up in review.
  4. Keep npm test green on Linux; state in the PR description that macOS was run too.

Step 5: Docs

vika/WINDOWS.md:

  • prerequisites (Node version, npm, pm2, Git Bash)
  • what is supported in the preview
  • what is explicitly disabled (upgrade/updater, autostart, email, release builds)
  • how to report issues

No changes to the main README beyond one link.

Expected result

Roughly 15 files and +500/−80 lines; shared core/channel files contain no win32 branches; macOS/Linux behavior unchanged. Please update this PR, or close it and open a fresh one against feat/vika, and link the separate PRs from step 2 in the description.

@ZaynJarvis

Copy link
Copy Markdown
Collaborator

Follow-up items for after this merges. Not blocking the preview, but please address them in a cleanup PR so platform/ stays a thin OS adapter:

  1. Runtime details live in the platform layer. claudePromptArgs, appServerPromptArgs(runtime) and appServerThreadParams(runtime) branch on runtime === 'codex', so the platform module has to know about specific runtimes. Expose a generic capability instead (e.g. maxCommandLineLength, or a helper that passes long text via a temp file) and let each runtime decide how to use it.
  2. Product policy mixed with OS differences. supportsConnector(name) / assertEmailSupported() encode a product decision, not an OS difference. Related flags are also inconsistent: supportsUpdater is a constant, supportsAutostart() a function, supportsConnector(name) takes an argument. Collapse them into one capabilities object, e.g. { updater, autostart, connectors }.
  3. pm2 helpers belong outside the daemon platform layer. pm2Bin, pm2Options, pm2ControlEnvironment and ecosystemPath are used only by cli/updater; move them there. pm2ControlEnvironment returning { source, keys } is also hard to read from the name.
  4. Naming.
    • ecosystemPath returns a PATH string, not a file path; rename it, e.g. ecosystemSearchPath.
    • detached is a bare boolean; rename it, e.g. spawnDetached.
    • opener should say what it opens, e.g. urlOpenCommand.
  5. The facade leaks platform checks. index.mjs exports platformName and windowsX64, and supportsAutostart / opener accept a platform argument "for tests". That hands platform branching back to callers. Inject the implementation in tests instead (e.g. import posix.mjs / win32.mjs directly), and drop these exports.
  6. No single interface definition. win32.mjs exports npmShimEntrypoint, which posix.mjs doesn't, and posix.supportsAutostart is silently shadowed by index.mjs. Define the interface once (a JSDoc typedef or a list in index.mjs) and add a test asserting both implementations export exactly that set.

@openviking-superagent
openviking-superagent marked this pull request as ready for review November 8, 2026 05:36
@ZaynJarvis
ZaynJarvis merged commit 35e37d1 into volcengine:feat/vika Nov 8, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Nov 8, 2026
nexw added a commit to nexw/OpenViking that referenced this pull request Nov 9, 2026
The branch had drifted 25 commits behind volcengine/openviking's feat/vika
since volcengine#7012: the OpenViking tool surface work (volcengine#7079), per-instance OV users
and peers (volcengine#7092), timers in OV (volcengine#7016), explicitSilence defaults (volcengine#7110),
image-heavy turns (volcengine#7113), stale implicit turns (volcengine#7021), the email connector
(volcengine#7144/volcengine#7145/volcengine#7148), Feishu chat scoping (volcengine#7149) and the Windows preview
chain (volcengine#7218-volcengine#7245).

Conflicts were all in files the superseded local commit a709961 touched;
resolution takes the upstream side, because volcengine#7079 replaced that design:
OpenViking tools now reach every runtime through the Core ActionService
(ov-tools.mjs), so the durable host keeps registering durableCodingTools()
and no longer wires its own MCP catalogue. The local-only
durable-ov-tools.mjs, its test, the @earendil-works/pi-mcp dependency and
DURABLE_OV are dropped with it; README.md, install.md and
docs/pi-durable-runtime.md take the upstream (English) rewrites.

vika/ is now byte-identical to origin-https/feat/vika; the merge keeps
origin/main already merged in.
@nexw
nexw deleted the vika-win branch November 13, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants