Skip to content

fix: pass global-timeout to router and use it for sd-server proxy#1422

Merged
jeremyfowers merged 1 commit intolemonade-sdk:mainfrom
ianbmacdonald:fix/sd-server-proxy-timeout
Mar 21, 2026
Merged

fix: pass global-timeout to router and use it for sd-server proxy#1422
jeremyfowers merged 1 commit intolemonade-sdk:mainfrom
ianbmacdonald:fix/sd-server-proxy-timeout

Conversation

@ianbmacdonald
Copy link
Copy Markdown
Contributor

Summary

  • sd_server.cpp: Replace hardcoded 600s proxy timeouts with get_default_timeout() so image generation/edit/variation requests respect LEMONADE_GLOBAL_TIMEOUT
  • ServerManager: Forward global_timeout from lemonade-server to lemonade-router via --global-timeout CLI arg (fixes env var not propagating through subprocess spawn)
  • TrayApp: Pass server_config_.global_timeout through both start_server() call sites

Context

Image generation models like Qwen Image Edit can take 30+ minutes on consumer GPUs (e.g. Radeon 8060S). The sd-server proxy had hardcoded 600s timeouts that couldn't be overridden, and LEMONADE_GLOBAL_TIMEOUT set in /etc/lemonade/conf.d/ was never reaching the router because ServerManager didn't pass it as an arg.

Complementary to #1421 which fixes the HttpClient timeout semantics — this PR ensures the global timeout value actually reaches the router and is used by the sd-server proxy.

Test plan

  • Set LEMONADE_GLOBAL_TIMEOUT=3600 in /etc/lemonade/conf.d/timeout.conf
  • Verify --global-timeout 3600 appears in router process args
  • Image edit request completes after 35m46s without timeout
  • Verify default behavior (no env override) still works with 300s timeout
  • Verify existing image generation models (Flux, SDXL) unaffected

🤖 Generated with Claude Code

The sd-server proxy used hardcoded 600s timeouts for image generation,
edits, and variations — causing failures for models that take longer
(e.g. Qwen Image Edit at ~36 min on consumer GPUs).

Additionally, LEMONADE_GLOBAL_TIMEOUT was never propagated from
lemonade-server to lemonade-router because ServerManager didn't pass
--global-timeout in the subprocess args.

Changes:
- sd_server.cpp: replace hardcoded 600s with get_default_timeout()
- ServerManager: accept and forward global_timeout to router via
  --global-timeout arg (both Unix execv and Windows CreateProcess)
- TrayApp: pass server_config_.global_timeout to start_server()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ianbmacdonald
Copy link
Copy Markdown
Contributor Author

Probably a better approach, but this takes the hardcoded default which breaks long image edit prompts via the router, and wires it up to the existing global timeout ENV when it is defined.

@ianbmacdonald ianbmacdonald marked this pull request as ready for review March 20, 2026 14:28
@jeremyfowers jeremyfowers self-requested a review March 21, 2026 01:08
@jeremyfowers jeremyfowers enabled auto-merge March 21, 2026 01:14
Copy link
Copy Markdown
Member

@jeremyfowers jeremyfowers left a comment

Choose a reason for hiding this comment

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

LGTM

@jeremyfowers jeremyfowers added this pull request to the merge queue Mar 21, 2026
Merged via the queue into lemonade-sdk:main with commit 922239e Mar 21, 2026
51 checks passed
jeremyfowers added a commit that referenced this pull request Mar 24, 2026
)

Ported from main commit 922239e. Only the sd_server.cpp change applies
to the spring-cleaning branch — the tray-side timeout propagation
(server_manager.cpp, tray_app.cpp) is architecturally unnecessary since
the tray no longer spawns the router.

Replaces hardcoded 600s timeouts with get_default_timeout() so image
generation respects the global timeout setting.
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