Skip to content

fix: preserve startup errors and exit status - #304

Open
LauraGPT wants to merge 1 commit into
HumanAIGC-Engineering:mainfrom
LauraGPT:codex/preserve-startup-errors
Open

fix: preserve startup errors and exit status#304
LauraGPT wants to merge 1 commit into
HumanAIGC-Engineering:mainfrom
LauraGPT:codex/preserve-startup-errors

Conversation

@LauraGPT

@LauraGPT LauraGPT commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • log unhandled startup exceptions with their traceback
  • preserve a nonzero process exit status when initialization fails
  • retain the existing immediate-exit behavior used after shutdown
  • add a regression test for startup failures

Root cause

The top-level entrypoint currently calls os._exit(0) from an unconditional finally block. Any exception raised while loading handlers is therefore discarded before Python can report it, and Docker sees a successful exit even though the service never started.

This matches the symptom in #296: handler registration succeeds, loading stops partway through initialization, no traceback is shown, and the container exits as status 0. The reported log only proves that SenseVoice was registered; its model load had not started yet. The next handler after the last successful load message is Silero VAD.

This change keeps the explicit os._exit behavior but logs unexpected exceptions and propagates exit status 1, so the underlying handler error becomes actionable.

Verification

  • python3 -m pytest -q tests/test_demo_entrypoint.py (1 passed)
  • python3 -m py_compile src/demo.py tests/test_demo_entrypoint.py
  • git diff --check

Related to #296.

Signed-off-by: LauraGPT <18321252+LauraGPT@users.noreply.github.com>
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