From 3abddf461a62d25421e837df0938949ecbe03255 Mon Sep 17 00:00:00 2001 From: john0030710 Date: Sat, 10 Jan 2026 00:25:59 +0100 Subject: [PATCH] Fix side-effect file syncing when using symlink optimization - Ensure output files are synced even when reading from symlink - Call findActionResult to get ActionResult for side-effect files - Maintains performance benefit while ensuring correctness - Addresses @eed3si9n's concern about tasks generating files on the side --- util-cache/src/main/scala/sbt/util/ActionCache.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util-cache/src/main/scala/sbt/util/ActionCache.scala b/util-cache/src/main/scala/sbt/util/ActionCache.scala index 88bfa3803..5ed680e5f 100644 --- a/util-cache/src/main/scala/sbt/util/ActionCache.scala +++ b/util-cache/src/main/scala/sbt/util/ActionCache.scala @@ -114,7 +114,13 @@ object ActionCache: then Exception.nonFatalCatch .opt(IO.read(resolvedValuePath.toFile(), StandardCharsets.UTF_8)) - .map(valueFromStr(_, Some("symlink"))) + .map: str => + // We still need to sync output files for side effects + findActionResult(key, codeContentHash, extraHash, config) match + case Right(result) => + store.syncBlobs(result.outputFiles, config.outputDirectory) + case Left(_) => // Ignore if we can't find ActionResult + valueFromStr(str, Some("symlink")) else None readFromSymlink() match