Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix Windows CI: escape regex metacharacters in the audioMux path assertion

[._.]/ Adam Eivyb73b9eb5ea39
diff --git a/.changelog/next/fixed-agent-a6a78c1a.md b/.changelog/next/fixed-agent-a6a78c1a.md
new file mode 100644
index 0000000000..f9f14cc419
--- /dev/null
+++ b/.changelog/next/fixed-agent-a6a78c1a.md
@@ -0,0 +1 @@
+- Windows CI: audioMux path assertion escaped no regex metacharacters, so a backslash-containing temp path could never match
diff --git a/scripts/generate_minimax_h3.py b/scripts/generate_minimax_h3.py
index 65b64e0691..434f12862d 100644
--- a/scripts/generate_minimax_h3.py
+++ b/scripts/generate_minimax_h3.py
@@ -229,7 +229,10 @@ def build_encoder_shim(
for entry in checkpoint_dir.iterdir():
if entry.name == "text_encoder":
continue
- (root / entry.name).symlink_to(entry)
+ # `target_is_directory` is a no-op on POSIX but load-bearing on Windows,
+ # where a directory linked as a file symlink cannot be traversed — the
+ # VAEs, the tokenizer and the processor are all directories.
+ (root / entry.name).symlink_to(entry, target_is_directory=entry.is_dir())
stock_config = checkpoint_dir / "text_encoder" / "config.json"
if not stock_config.is_file():
diff --git a/server/services/pipeline/audioMux.test.js b/server/services/pipeline/audioMux.test.js
index a94d9d1b42..05fba4e4de 100644
--- a/server/services/pipeline/audioMux.test.js
+++ b/server/services/pipeline/audioMux.test.js
@@ -4,6 +4,12 @@ import { join } from 'path';
import { tmpdir } from 'os';
const TEST_HOME = join(tmpdir(), `portos-audiomux-test-${process.pid}-${Date.now()}`);
+
+// Escape every RegExp metacharacter so a filesystem path can be spliced into a
+// pattern literally. `\` and `]` are the two that matter most here: `\` is the
+// Windows path separator, and a class that forgets to escape `]` closes itself
+// early and silently stops escaping anything.
+const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const FAKE_MUSIC_DIR = join(TEST_HOME, 'music');
vi.mock('../../lib/fileUtils.js', async () => {
@@ -159,7 +165,16 @@ describe('muxMusicBed', () => {
expect(args[filterIdx + 1]).toMatch(/volume=0\.300/);
// Output path is a uniquely-suffixed `.muxing.<uuid>.mp4` — the rename
// swaps it over the input on success.
- expect(args[args.length - 1]).toMatch(new RegExp(`^${video.replace(/[.+^${}()|[\\]\\\\]/g, '\\\\$&')}\\.muxing\\.[0-9a-f-]+\\.mp4$`));
+ //
+ // `video` is an absolute path being spliced into a RegExp, so every regex
+ // metacharacter in it has to be escaped — including the BACKSLASH, which is
+ // a path separator on Windows. The earlier character class closed early on
+ // its own `\\]`, so it matched a metachar followed by two literal
+ // backslashes and escaped nothing at all; that went unnoticed because a
+ // POSIX temp path contains no backslashes and its unescaped `.` still
+ // matches itself, while on Windows `C:\Users\RUNNER~1\…` turned into the
+ // escape sequences \U, \R, \T and the assertion could never match.
+ expect(args[args.length - 1]).toMatch(new RegExp(`^${escapeRegExp(video)}\\.muxing\\.[0-9a-f-]+\\.mp4$`));
});
it('uses DEFAULT_MUSIC_GAIN when caller omits musicGain', async () => {