From 2af1d58104bff147c1346c2e5ff8f0c5414c36c7 Mon Sep 17 00:00:00 2001 From: KoalaTrapLord Date: Sun, 5 Apr 2026 17:29:21 +0000 Subject: [PATCH] fix: write ML JSONL to commander-ai-lab/results/ (not Forge CWD) LabCli passed relative 'results' to enableMlLogging(), which resolved to Forge-Repo/forge-gui/results/ because the Java subprocess CWD is forgeWorkDir. Now uses outputPath's parent directory (absolute) so JSONL training data goes to commander-ai-lab/results/ where the Python ML pipeline and Training page expect it. --- src/main/java/commanderailab/cli/LabCli.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/commanderailab/cli/LabCli.java b/src/main/java/commanderailab/cli/LabCli.java index c55a2b4..70694e1 100644 --- a/src/main/java/commanderailab/cli/LabCli.java +++ b/src/main/java/commanderailab/cli/LabCli.java @@ -348,8 +348,12 @@ public class LabCli implements Callable { // v4: Enable ML decision logging if requested if (mlLog) { String batchId = UUID.randomUUID().toString().substring(0, 8); - mtRunner.enableMlLogging("results", batchId); - System.out.println("[ML] Decision logging enabled (multi-thread) — data will be saved to results/"); + // Use absolute path so JSONL goes to commander-ai-lab/results/ + // regardless of CWD (which is forgeWorkDir for the subprocess) + String mlResultsDir = new File(outputPath).getAbsoluteFile().getParent(); + if (mlResultsDir == null) mlResultsDir = "results"; + mtRunner.enableMlLogging(mlResultsDir, batchId); + System.out.println("[ML] Decision logging enabled (multi-thread) — " + mlResultsDir); } games = mtRunner.runBatch(numGames, masterSeed); } else { @@ -361,8 +365,11 @@ public class LabCli implements Callable { // v4: Enable ML decision logging if requested if (mlLog) { String batchId = UUID.randomUUID().toString().substring(0, 8); - runner.enableMlLogging("results", batchId); - System.out.println("[ML] Decision logging enabled — data will be saved to results/"); + // Use absolute path so JSONL goes to commander-ai-lab/results/ + String mlResultsDir = new File(outputPath).getAbsoluteFile().getParent(); + if (mlResultsDir == null) mlResultsDir = "results"; + runner.enableMlLogging(mlResultsDir, batchId); + System.out.println("[ML] Decision logging enabled — " + mlResultsDir); } games = runner.runBatchSingleThread(numGames, masterSeed);