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.
This commit is contained in:
KoalaTrapLord committed 2026-04-05 17:29:21 +00:00
1 parent 547a84d8c2
commit 2af1d58104
1 file changed
+11 -4
+11 -4
View File
@@ -348,8 +348,12 @@ public class LabCli implements Callable<Integer> {
// v4: Enable ML decision logging if requested // v4: Enable ML decision logging if requested
if (mlLog) { if (mlLog) {
String batchId = UUID.randomUUID().toString().substring(0, 8); String batchId = UUID.randomUUID().toString().substring(0, 8);
mtRunner.enableMlLogging("results", batchId); // Use absolute path so JSONL goes to commander-ai-lab/results/
System.out.println("[ML] Decision logging enabled (multi-thread) — data will be saved to 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); games = mtRunner.runBatch(numGames, masterSeed);
} else { } else {
@@ -361,8 +365,11 @@ public class LabCli implements Callable<Integer> {
// v4: Enable ML decision logging if requested // v4: Enable ML decision logging if requested
if (mlLog) { if (mlLog) {
String batchId = UUID.randomUUID().toString().substring(0, 8); String batchId = UUID.randomUUID().toString().substring(0, 8);
runner.enableMlLogging("results", batchId); // Use absolute path so JSONL goes to commander-ai-lab/results/
System.out.println("[ML] Decision logging enabled — data will be saved to 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); games = runner.runBatchSingleThread(numGames, masterSeed);