Repository navigation
feat(vika): review Windows-tested source preview integration - #7218
Conversation
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
There was a problem hiding this comment.
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.mjsdaemon/windows/ensure-windows-lark-cli.mjs+cli/test/windows-lark-install.test.mjs. Instead add awin32-x64entry to the platform map invika/packages/updater/src/artifacts.mjsso the existingscripts/install-lark-cli.mjs/build-release.mjspath 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 autostartshould 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.exedefault .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:
vika/packages/daemon/src/lock.mjs:21: reading/proc/<pid>/statstart 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.logger.mjs:78: redaction now applies to the whole record, includinglevel/msg.notices.mjs:61,store.mjs:1679,actions/service.mjs:697: the new "already delivered, don't retry or notify" semantics.durable.mjs:635: emittingtool_completed FAILEDon interrupt.connectors/process.mjs:18: filtering debug/info/warn lines out of crash details.vika logs --lines/--no-followand thelogsCommandexit-code change (empty code now 1 instead of 0).updater/pm2.mjs:152realpath 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 (samechild_processcalls, 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.customthrowingERR_INVALID_ARG_TYPEwhen 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
- Add a test, e.g.
daemon/test/platform-isolation.test.mjs, that grepsvika/packages/**/srcandvika/*.cjsand fails ifprocess.platformor'win32'appears outsideplatform/. - Add
platform/posix.test.mjsasserting every exported function behaves exactly like the native Node call on POSIX. - Add a snapshot test of the generated pm2/ecosystem config on Linux and macOS, so env-whitelist drift shows up in review.
- Keep
npm testgreen 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.
|
Follow-up items for after this merges. Not blocking the preview, but please address them in a cleanup PR so
|
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.
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
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.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):
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
npm test: 1291 tests, 1282 pass, 9 skip, 0 fail.npm run checkandgit diff --check: pass.Disclosed preview limits and pending native validation
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.