Skip to content

feat(server): configurable write directory via --output-dir - #2442

Merged
leejet merged 1 commit into
leejet:masterfrom
kuhnchris:writedir-param
Nov 27, 2026
Merged

leejet merged 1 commit into
leejet:masterfrom
kuhnchris:writedir-param

Conversation

@kuhnchris

@kuhnchris kuhnchris commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

!!! AI-DISCLOSURE NOTE: This change was created with the help of Qwen3.8-Flash-Next and tested by me !!!

Summary

Generated-file writes were hardcoded to /output with no way to relocate them; writes elsewhere failed with 'file write denied'. Add an --output-dir flag that resolves the writable output root, defaulting to the previous /output behaviour.

Related Issue / Discussion

n/a

Additional Information

Allows to specify where we want to have our output placed instead of a hardcoded "output/" folder.
This allows for finer control when using .DGLs..

Example:
~/models$ stable-diffusion.cpp/build/bin/sd-server --listen-port 3080 -l 0.0.0.0 --model-dir $PWD --output-dir $PWD

image image

failure on outside allowed output-dir (absolute):
image

failure on outside allowed output-dir (relative):
image

New command line parameter: --output-dir
image

Checklist

Summary by CodeRabbit

  • New Features
    • Added the --output-dir option to choose where generated files are saved. Writes outside the configured output directory are denied.
  • Documentation
    • Clarified how the output directory affects image saves and which write locations are allowed.

Generated-file writes were hardcoded to <working-directory>/output with no
way to relocate them; writes elsewhere failed with 'file write denied'.
Add an --output-dir flag that resolves the writable output root, defaulting
to the previous <working-directory>/output behaviour.
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The server adds a --output-dir option. It uses the configured directory as the DGL output root, or retains the current-directory output default when no directory is configured. The README describes the write policy.

Changes: DGL output directory

Layer / File(s) Summary
Output directory option and access policy
examples/server/runtime.h, examples/server/runtime.cpp, examples/server/async_jobs.cpp, examples/server/README.md
SDSvrParams adds output_dir, and get_options exposes it as --output-dir. configure_server_file_access uses the configured directory or the existing output default, then makes the selected root absolute and weakly canonical. The README states that writes outside the resolved output directory are denied.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: leejet, jasmaine

Merge Risk: Minimal · up to e4479

This adds an optional server flag to choose where generated files may be written, and the default behavior is unchanged. Writes through a symlinked alias of the output directory may still be denied, and users can work around that by passing the real path. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(server): configurable write directory via --output-dir" matches the main change. The PR adds an --output-dir option to the server so users can choose where generated files are written.…
Description check Passed The description follows the template's main sections: Summary, Related Issue / Discussion, Additional Information, and Checklist. The Summary explains the change and the reason for it. The Related Iss…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(server): configurable write directory via --output-dir" matches the main change. The PR adds an --output-dir option to the server so users can choose where generated files are written. The default stays at <working directory>/output. The title names the server scope, the feature, and the flag. It is concise and specific.

Full details: Description check

Explanation

The description follows the template's main sections: Summary, Related Issue / Discussion, Additional Information, and Checklist. The Summary explains the change and the reason for it. The Related Issue section says "n/a". The Additional Information section gives an example command, screenshots, and the new flag. The checklist is filled in, and the model documentation item is marked N/A. The description is mostly complete. One gap: the template asks for verification notes, and the author gives only screenshots and a note that the change was tested by the author, with no test steps. The summary also does not mention the README update in the file changes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

⚠️ This pull request shows signs of AI-generated slop (ai_padded_prose). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ce7c29b1-6428-46d4-94f3-3c62f53ecc64
Commits

Reviewing files that changed from the base of the PR and between e637c7b and e4479f1.

Files selected for processing: 4

  • examples/server/README.md
  • examples/server/async_jobs.cpp
  • examples/server/runtime.cpp
  • examples/server/runtime.h

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

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.

2 participants