Commit 52e1a65 for stable-diffusion.cpp

commit 52e1a658a279079e6a14bcefcc59f4206410e43f
Author: skeole <214513857+iamskeole@users.noreply.github.com>
Date:   Sun Nov 29 18:44:11 2026 +0200

    fix(server): snapshot the DGL file-access policy after the directory enrichment (#2466)

diff --git a/examples/server/async_jobs.cpp b/examples/server/async_jobs.cpp
index c3eead3..3216e01 100644
--- a/examples/server/async_jobs.cpp
+++ b/examples/server/async_jobs.cpp
@@ -719,13 +719,15 @@ void configure_server_file_access(ServerModels& models, const SDSvrParams& param
     if (output_root.has_relative_path() && !output_root.has_filename())
         output_root = output_root.parent_path();
     policy                       = {get_model_roots(params), output_root, {}, {}};
-    models.workspace_file_access = policy;
     for (const auto* directory : {&config.lora_model_dir, &config.hires_upscalers_dir})
         if (!directory->empty())
             policy.models.push_back(make_model_root(fs::u8path(*directory), false));
     for (const auto& entry : config.embedding_map)
         policy.configured_files.insert(model_path_key(fs::weakly_canonical(fs::absolute(fs::u8path(entry.second)))));
     add_startup_model_sources(policy, config);
+    // The DGL context gets a copy of the policy: take the snapshot after the
+    // enrichment, or graphs cannot read from --lora-model-dir / --hires-upscalers-dir.
+    models.workspace_file_access = policy;

     if (sd_ctx_set_file_access_callback(models.context.get(), allowed_dgl_path, &policy) != SD_STATUS_OK)
         throw std::runtime_error(sd_get_last_error());