fix(server): Muse turns no longer fail on Windows (#17163)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Theo Browne <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-10-10 16:17:13 -07:00
1 parent 74dfbb6972
commit 953edeec9d
8 files changed
+377 -20

No files matched your search

@@ -27,6 +27,7 @@ import { TestClock } from "effect/testing";
import {
connectMuseTransport,
layer as museReplayLayer,
materializeMuseReplayWorkspace,
MUSE_MSP_REPLAY_PROTOCOL,
MUSE_PROVIDER_KIND,
museRecordLabel,
@@ -35,14 +36,15 @@ import {
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
import {
makeMuseEnvironment,
museLaunch,
museServeArgs,
museWorkspaceRoot,
parseMuseVersion,
} from "@t3tools/provider-muse/testing";
import { provideDeterministicTestRuntime } from "../src/orchestration-v2/testkit/DeterministicRuntime.ts";
import { ORCHESTRATOR_REPLAY_FIXTURES } from "../src/orchestration-v2/testkit/fixtures/index.ts";
import { materializeFixtureInput } from "../src/orchestration-v2/testkit/fixtures/shared.ts";
import { runOrchestratorV2ProviderReplayScenario } from "../src/orchestration-v2/testkit/ProviderReplayHarness.ts";
import { materializeReplayTranscriptWorkspace } from "@t3tools/provider-testing/replayTranscript";
import {
checkpointWorkspace,
makeCheckpointWorkspace,
@@ -66,6 +68,8 @@ if (fixture === undefined || variant === undefined) {
}
const museBinary = process.env.T3_MUSE_BIN ?? "muse";
// Started as T3 starts it, so Windows needs no T3_MUSE_BIN for Muse's `muse.cmd` launcher.
const museStart = Effect.runSync(museLaunch(museBinary));
const home = process.env.HOME ?? "";
function isRecord(value: unknown): value is Record<string, unknown> {
@@ -147,7 +151,7 @@ function makeRecordingCreateHost(
};
record("expect_outbound", { type: "host_start", args });
// The binary named by T3_MUSE_BIN, so the recorded version matches what ran.
const child = NodeChildProcess.spawn(museBinary, args, {
const child = NodeChildProcess.spawn(museStart.command, [...museStart.args, ...args], {
cwd: options.cwd,
env: options.environment ?? makeMuseEnvironment(),
stdio: ["pipe", "pipe", "inherit"],
@@ -208,7 +212,11 @@ function makeRecordingCreateHost(
}
const readMuseVersion = Effect.sync(() => {
const output = NodeChildProcess.execFileSync(museBinary, ["--version"], { encoding: "utf8" });
const output = NodeChildProcess.execFileSync(
museStart.command,
[...museStart.args, "--version"],
{ encoding: "utf8" },
);
return parseMuseVersion(output) ?? output.trim();
});
@@ -224,6 +232,7 @@ const record = Effect.gen(function* () {
yield* Effect.addFinalizer(() =>
fs.remove(workspace, { recursive: true, force: true }).pipe(Effect.ignore),
);
const canonicalWorkspace = yield* fs.realPath(workspace);
const entries: Array<ProviderReplayEntry> = [];
const commandIds: Array<Array<string>> = [];
@@ -276,7 +285,12 @@ const record = Effect.gen(function* () {
model: variant.modelSelection.model,
commandIds,
},
entries: normalizeEntries(entries, [yield* fs.realPath(workspace), workspace]),
// The verbatim root first: it contains the canonical path.
entries: normalizeEntries(entries, [
yield* museWorkspaceRoot(canonicalWorkspace),
canonicalWorkspace,
workspace,
]),
} satisfies ProviderReplayTranscript;
yield* Effect.gen(function* () {
@@ -286,7 +300,7 @@ const record = Effect.gen(function* () {
{
name: `${fixture.name}/muse:verify`,
transcript: yield* MuseOrchestratorReplayHarness.decodeTranscript(
materializeReplayTranscriptWorkspace(transcript, yield* fs.realPath(replayWorkspace)),
yield* materializeMuseReplayWorkspace(transcript, replayWorkspace),
),
commands: materialized.commands,
steps: materialized.steps,