Skip to content

Fix UI restart hanging before response flush#1619

Open
ruizanthony wants to merge 1 commit into
agent0ai:mainfrom
ruizanthony:fix/ui-restart-hangs
Open

Fix UI restart hanging before response flush#1619
ruizanthony wants to merge 1 commit into
agent0ai:mainfrom
ruizanthony:fix/ui-restart-hangs

Conversation

@ruizanthony
Copy link
Copy Markdown

Summary

  • Make /api/restart return immediately and schedule the actual reload in a delayed daemon thread.
  • Prevent duplicate reload requests while one is already in progress.
  • Use in-process restart via os.execv() instead of exiting in Docker before the UI request can complete.
  • Allow HEAD /api/health for readiness probes.

Why

The Web UI restart flow could hang because /api/restart called process.reload() before the HTTP response was reliably flushed. In Docker/LXC this could terminate or interrupt the request, leaving the UI polling/waiting indefinitely.

Validation

  • python -m py_compile api/restart.py api/health.py helpers/process.py tests/test_restart_api.py
  • python -m pytest -q tests/test_restart_api.py → 3 passed

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.

1 participant