HERMES-GIELIE/api
nesquena-hermes 19d00e3586 fix(#5543): fire-and-forget commit_session_memory + drain-safe managed stop
Move the 1-5s commit_session_memory() extraction off the POST /api/session/new
request thread (was blocking + New Chat) into a fire-and-forget daemon thread,
guarded by the existing per-session in-flight serialization.

Data-loss prevention on managed stop:
- server.py installs a SIGTERM handler that requests an orderly stop so
  serve_forever()'s finally block runs drain_all_on_shutdown() (the default
  SIGTERM disposition terminated without unwinding, losing in-flight commits).
- session_lifecycle: bounded self-unregistering background-commit registry;
  a _draining flag so no NEW worker starts once the drain begins (the inline
  generation-drain commits any late arrival instead); a 30s overall drain
  deadline so a stuck worker cannot hang the stop path forever.

Co-authored-by: luperrypf <luperrypf@users.noreply.github.com>
2026-07-04 21:40:21 +00:00
..
__init__.py
agent_health.py fix(health): send Bearer auth on remote /health/detailed probe (#5418) 2026-07-02 16:24:39 +00:00
agent_sessions.py fix: encode read-only session DB URI 2026-07-03 20:04:41 +02:00
auth.py
auth_oidc.py
background.py
background_process.py
clarify.py
commands.py
compression_anchor.py
config.py harden #5511: active provider owns its OWN providers: allowlist (complete ownership model) 2026-07-04 07:28:44 +00:00
crash_visibility.py
dashboard_probe.py
extensions.py fix: prefer IPv4 for extension gallery downloads to prevent timeout on broken IPv6 2026-07-03 20:26:18 +00:00
gateway_chat.py
gateway_restart.py
gateway_watcher.py
goals.py
helpers.py
kanban_bridge.py
metering.py
models.py harden #5504 on rodboev's latest head: complete the tombstone wiring + CHANGELOG 2026-07-04 05:32:51 +00:00
oauth.py
office_documents.py #5142: office-doc preview + safe docx editing (#540), rebased on master; optional deps 2026-07-02 01:15:57 +00:00
onboarding.py feat(#3260): self-hosted provider setup (Ollama/LM Studio) in Settings (i18n complete) 2026-07-02 08:17:44 +00:00
passkeys.py
paths.py
plugin_providers.py
plugins.py
profiles.py fix(profiles): include extra_models in profile model validation 2026-07-03 03:26:25 +00:00
providers.py feat(#3260): self-hosted provider setup (Ollama/LM Studio) in Settings (i18n complete) 2026-07-02 08:17:44 +00:00
request_diagnostics.py
rollback.py
route_approvals.py
route_session_list_cache.py
routes.py fix(#5543): fire-and-forget commit_session_memory + drain-safe managed stop 2026-07-04 21:40:21 +00:00
run_journal.py
runner_client.py
runtime_adapter.py
session_discoverability.py
session_events.py
session_export_html.py #4968: export chat to self-contained themed HTML, rebased on master 2026-07-02 02:36:09 +00:00
session_lifecycle.py fix(#5543): fire-and-forget commit_session_memory + drain-safe managed stop 2026-07-04 21:40:21 +00:00
session_ops.py fix(#5563): align forked context to display for large (compacted) sessions 2026-07-04 20:55:06 +00:00
session_recovery.py harden #5504: dedup audit tombstone item when .bak + state.db row both survive 2026-07-04 05:38:49 +00:00
skill_usage.py
sse_chunked.py
startup.py
state_sync.py
streaming.py
system_health.py
terminal.py
todo_state.py
turn_journal.py
updates.py fix(webui): resolve git.exe via Windows registry/known paths so WEBUI_VERSION doesn't degrade to 'unknown' 2026-07-04 15:36:59 +08:00
upload.py
usage.py
webui_session_db.py
workspace.py #5142: office-doc preview + safe docx editing (#540), rebased on master; optional deps 2026-07-02 01:15:57 +00:00
workspace_git.py
worktrees.py