You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Scheduler initialized but not processing tasks (uvicorn vs direct call difference) #1395
MemOS Version: 2.0.11 (also reproducible on 2.0.10)
Deployment: Docker (memtensor/memos-base:v1.0)
Storage: Neo4j 5.21 + Qdrant v1.16.3
Queue: Local (not Redis, DEFAULT_USE_REDIS_QUEUE=false)
OS: Debian 12, Docker 28.5.2
Issue Description
The MemOS scheduler initializes successfully — OptimizedScheduler._running=True and MessageConsumerThread is alive — but no tasks are ever processed. When memories are added via /product/add, the scheduler status always shows all zeros:
When MemOS starts via uvicorn (uvicorn memos.api.server_api:app):
No scheduler-related startup logs appear
No Scheduler initialized or Scheduler started or Message consumer thread started
But the scheduler object exists and _running=True
❌ No tasks are processed
The startup logs show only:
INFO: Started server process [1]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000
Missing all scheduler initialization messages.
Suspected Root Cause
The server_router.py module calls components = handlers.init_server() at module import time. When running under uvicorn, this initialization appears to complete (the API works), but the scheduler consumer thread may not actually start processing messages. There may be a timing or threading issue specific to the uvicorn event loop.
Additional Notes
The validate_partial_initialization warning from AuthConfig appears because rabbitmq/openai/graph_db are not configured
The add handler creates memories in Neo4j successfully — only scheduler processing is broken
Tested on both v2.0.10 and v2.0.11 with identical behavior
Question
Could you confirm if the scheduler is tested in a Docker deployment with local queue (no Redis)? Is there any additional configuration required beyond MOS_ENABLE_SCHEDULER=true and API_SCHEDULER_ON=true?
Summary: Fixes issue #1395: under Docker + uvicorn with the local in-memory message queue (DEFAULT_USE_REDIS_QUEUE=false), GET /product/scheduler/allstatus always returned {waiting:0, in_progress:0, pending:0, ...} even though the consumer thread was alive and dispatching MEM_READ tasks. Root cause: handle_scheduler_allstatus only aggregated per-stream entries whose key starts with "scheduler:" — these only exist for the Redis-backed queue monitor. The local queue monitor returns just flat top-level totals (running, remaining, pending), so the prefix filter collapsed the summary to zero regardless of actual queue depth or dispatcher state.
Fix: in src/memos/api/handlers/scheduler_handler.py::handle_scheduler_allstatus, detect whether per-stream entries are present; if not and mem_scheduler.use_redis_queue is False, fall back to the flat totals so in_progress, waiting, and pending reflect live local-queue state. Redis-queue aggregation is untouched. The API response model is unchanged, so no OpenAPI regeneration is required; completed/failed/cancelled remain zero for local queues (documented behavior — persistent task status tracking is Redis-only).
Tests: added 3 regression tests in tests/api/test_scheduler_handler_allstatus.py covering local-non-zero, local-empty, and Redis per-stream paths. Initial run of the local-non-zero test produced the expected RED (assert 0 == 2); after the fix all three pass. Wider regression sweep across tests/api/test_server_router.py + tests/mem_scheduler/ + the new file: 79 passed / 1 skipped. Four pre-existing failures in tests/api/test_mcp_serve.py are unrelated to this change (confirmed by stashing the diff and reproducing on the base branch HEAD). Ruff lint + format clean on the touched files. The secondary symptom in the issue (missing scheduler INFO logs on Docker stdout) is caused by memos/log.py pinning the console handler to WARNING when DEBUG=False; this is documented in the design doc as out of scope to avoid a broader operational change.
Activity
Memtensor-AI commentedon Jun 30, 2026
🤖 AutoDev has picked up this issue and started working on it.
Task ID:
fcda6b589ec78706Working branch:
bugfix/autodev-1395Target branch:
latest dev* branchWorkflow: opsp (analysis → coding → testing → PR)
I will post the PR link here once done. If I need more information, I will ask in the comments.
fix(scheduler): surface live local-queue counts in /scheduler/allstatus
Memtensor-AI commentedon Jun 30, 2026
✅ AutoDev task
fcda6b589ec78706completed.Summary: Fixes issue #1395: under Docker + uvicorn with the local in-memory message queue (DEFAULT_USE_REDIS_QUEUE=false), GET /product/scheduler/allstatus always returned {waiting:0, in_progress:0, pending:0, ...} even though the consumer thread was alive and dispatching MEM_READ tasks. Root cause: handle_scheduler_allstatus only aggregated per-stream entries whose key starts with "scheduler:" — these only exist for the Redis-backed queue monitor. The local queue monitor returns just flat top-level totals (running, remaining, pending), so the prefix filter collapsed the summary to zero regardless of actual queue depth or dispatcher state.
Fix: in
src/memos/api/handlers/scheduler_handler.py::handle_scheduler_allstatus, detect whether per-stream entries are present; if not andmem_scheduler.use_redis_queue is False, fall back to the flat totals soin_progress,waiting, andpendingreflect live local-queue state. Redis-queue aggregation is untouched. The API response model is unchanged, so no OpenAPI regeneration is required;completed/failed/cancelledremain zero for local queues (documented behavior — persistent task status tracking is Redis-only).Tests: added 3 regression tests in
tests/api/test_scheduler_handler_allstatus.pycovering local-non-zero, local-empty, and Redis per-stream paths. Initial run of the local-non-zero test produced the expected RED (assert 0 == 2); after the fix all three pass. Wider regression sweep acrosstests/api/test_server_router.py+tests/mem_scheduler/+ the new file: 79 passed / 1 skipped. Four pre-existing failures intests/api/test_mcp_serve.pyare unrelated to this change (confirmed by stashing the diff and reproducing on the base branch HEAD). Ruff lint + format clean on the touched files. The secondary symptom in the issue (missing scheduler INFO logs on Docker stdout) is caused bymemos/log.pypinning the console handler to WARNING when DEBUG=False; this is documented in the design doc as out of scope to avoid a broader operational change.Base branch:
mainBranch:
bugfix/autodev-1395Commit:
977bfe2PR: #1982
Assigned to: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
Reviewers: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
Fix #1395: Scheduler initialized but not processing tasks (uvicorn vs…