Skip to content

fix: avoid scanning cwd during server startup - #2086

Merged
leejet merged 2 commits into
leejet:masterfrom
mikemikimike:fix/2081-startup-readiness
Oct 8, 2026
Merged

leejet merged 2 commits into
leejet:masterfrom
mikemikimike:fix/2081-startup-readiness

Conversation

@mikemikimike

@mikemikimike mikemikimike commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Keep the shared SDContextParams::lora_model_dir default as . so sd-cli continues resolving prompt LoRA tags from its current working directory. sd-server clears that default before parsing command-line arguments, preventing a recursive scan of its working directory unless --lora-model-dir is explicitly supplied.

  • Preserve CLI prompt LoRA loading from the current working directory.
  • Keep server LoRA discovery disabled by default.
  • Honor an explicit server --lora-model-dir value.

Issue: #2081

Fixes #2081

Verification

  • cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSD_WEBP=OFF -DSD_WEBM=OFF -DSD_SERVER_BUILD_FRONTEND=OFF -DGGML_NATIVE=OFF
  • cmake --build build --config Release --parallel 2
  • ctest --test-dir build --output-on-failure (no tests are registered in this repository)
  • build/bin/sd-server --help
  • build/bin/sd-cli --help
  • clang-format --dry-run --Werror -style=file examples/common/common.h examples/server/main.cpp

@leejet leejet left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SDContextParams is shared by sd-server and sd-cli. Changing lora_model_dir from "." to an empty string also causes CLI generation to skip extract_and_remove_lora() when --lora-model-dir is omitted.

For example, sd-cli -m model.safetensors -p "a cat <lora:foo:1>" previously loaded foo.safetensors from the working directory. With this change, the LoRA is silently ignored and the tag remains in the prompt. This also contradicts the documented default in docs/lora.md.

Could we preserve "." in the shared parameters and clear it only during server initialization, before parsing command-line arguments? That would avoid the default server scan without breaking existing CLI usage.

@leejet
leejet merged commit a4a9669 into leejet:master Oct 8, 2026
10 checks passed
@leejet

leejet commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] sd-server: request accepted during startup window never responds, process spins at high CPU until killed

2 participants