Skip to content

Phase 4.7a: Extract startup helpers + graceful shutdown (#580)#583

Merged
shikhalev merged 2 commits intomainfrom
server/phase-4.7a-startup-helpers
Mar 16, 2026
Merged

Phase 4.7a: Extract startup helpers + graceful shutdown (#580)#583
shikhalev merged 2 commits intomainfrom
server/phase-4.7a-startup-helpers

Conversation

@shikhalev
Copy link
Collaborator

Summary

  • 8 helper functions extracted from orchestrator.py into 6 domain startup.py modules:
    • modules/core/startup.pyseed_system_roles(), seed_default_workspace()
    • modules/llm/startup.pyget_or_create_default_gemini_provider(), auto_start_bridge()
    • modules/channels/telegram/startup.pyauto_start_bots()
    • modules/channels/whatsapp/startup.pyauto_start_bots()
    • modules/knowledge/startup.pyreload_llm_faq(container)
    • modules/speech/startup.pyreload_voice_presets(container)
  • Graceful shutdown added: stops Telegram bots, WhatsApp bots, and Claude bridge on app shutdown
  • FAQ/presets reload fixed: now uses container argument (after population) instead of globals
  • 5 unused imports removed from db.integration
  • orchestrator.py: 1030 → 805 lines (−225 lines, −22%)

Test plan

  • ruff check — all checks passed
  • ruff format — formatted
  • pytest tests/ — 65 tests passed
  • Manual: verify startup (seed roles, auto-start bots, FAQ reload)
  • Manual: verify graceful shutdown stops running bots

Closes #580

🤖 Generated with Claude Code

shikhalev and others added 2 commits March 16, 2026 13:01
…es (#580)

- Move seed_system_roles, seed_default_workspace → modules/core/startup.py
- Move get_or_create_default_gemini_provider, auto_start_bridge → modules/llm/startup.py
- Move auto_start_bots → modules/channels/{telegram,whatsapp}/startup.py
- Move reload_llm_faq → modules/knowledge/startup.py
- Move reload_voice_presets → modules/speech/startup.py
- Add graceful shutdown: stop Telegram/WhatsApp bots and Claude bridge
- Fix FAQ/presets reload to use container (after population) instead of globals
- Remove 5 unused db.integration imports
- orchestrator.py: 1030 → 805 lines (-225)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shikhalev shikhalev merged commit bd9569c into main Mar 16, 2026
3 checks 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.

Phase 4.7a: Доменные startup-функции + graceful shutdown

1 participant