OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug]: Codex memory plugin compressor tests use a POSIX-only fake CLI on Windows

Open dogking95 opened this issue 3 months ago • 0 comments

Issue Origin

Observed or reproduced in a real environment.

Bug Description

The Codex memory plugin's withFakeCodex() test helper is POSIX-only even though the test file contains Windows-specific launch coverage.

On native Windows, the helper currently:

  • creates an extensionless executable named codex;
  • writes a #!/bin/sh script into it; and
  • prepends the fake bin directory with ``PATH: `${binDir}:${process.env.PATH}```.

However, resolveCodexLaunch() correctly splits Windows PATH on ;. The fake directory is therefore not a PATH entry on Windows, so the tests resolve a real machine-wide Codex executable instead of the fake launcher. In a Codex Desktop/MSIX environment this can select the packaged WindowsApps codex.exe, which a Node child process cannot launch, and the assertions exercise the deterministic fallback rather than the intended fake compressor.

This is related to, but not a duplicate of, #3304 / #3308. Those fixed context loss when compressor startup fails and added synthetic Windows resolver coverage. The shared fake compressor used by the end-to-end tests remains POSIX-only on current main.

Steps to Reproduce

  1. Check out current main on native Windows.
  2. Use Node.js 24.
  3. Run:
node --test --test-name-pattern "relevance compressor|bounded deterministic" examples/codex-memory-plugin/scripts/auto-recall.test.mjs
  1. Observe that neither test reaches the fake Codex launcher.

Expected Behavior

The test helper should install a fake Codex entry point that is resolvable on Windows, macOS, and Linux, and should prepend PATH using the platform delimiter.

The focused tests should invoke the fake compressor exactly as they do on POSIX systems, without ever falling through to a real user-installed or Desktop-bundled Codex executable.

Actual Behavior

On Windows the focused command reports 0/2 passing:

not ok - auto-recall applies the relevance compressor to server recall entries
not ok - auto-recall falls back to a bounded deterministic digest when endpoint compression fails

tests 2
pass 0
fail 2

The first test receives the deterministic fallback digest instead of the configured fake compressor output. The second records compressorCalls === 0 instead of 1.

Minimal Reproducible Example

Current helper:

const executable = join(binDir, "codex");
await writeFile(executable, `#!/bin/sh
# ...
`);
PATH: `${binDir}:${process.env.PATH}`;

On Windows, resolveCodexLaunch() uses pathValue.split(";"), so the fake path above is not recognized as a separate entry.

Error Logs

AssertionError: expected {} but received deterministic additionalContext
AssertionError: 0 !== 1

OpenViking Version

  • OpenViking main at c1cc592aaf1d104b5ad9cb0694ec88db62b753ad
  • Codex memory plugin 0.7.5

Python Version

Not applicable. This is a Node-only plugin test and does not invoke Python.

Operating System

Windows 11

Model Backend

Other / not applicable.

Additional Context

A tested local fix replaces the shell fake with a small Node.js script, writes the npm-style entry point expected by resolveCodexLaunch() at:

<fake-bin>/node_modules/@openai/codex/bin/codex.js

It also uses node:path.delimiter when composing PATH and makes the synchronous-spawn regression identify the codex exec argument rather than assuming the command is literally "codex".

Validation after that change on native Windows:

auto-recall.test.mjs: 9/9 passed
Codex memory plugin test set: 66/66 passed

The production hook already preserves recall through deterministic fallback, so this report is specifically about cross-platform test correctness and preventing tests from accidentally invoking the user's real Codex installation.

dogking95 avatar Aug 12 '26 07:08 dogking95