ml-intern
ml-intern copied to clipboard
Plan Phase 3 Space background workers
Summary
- document the Phase 3 background-worker architecture for Space sessions
- add Mongo-backed durable
session_runsqueue methods, indexes, claim/heartbeat/finish/interrupt-expired lifecycle - add opt-in background
/api/chatpath behindML_INTERN_BACKGROUND_WORKERS - add Mongo-polled SSE replay for worker-owned runs
- add worker runtime plus worker Space health app (
ML_INTERN_PROCESS_ROLE=worker) - keep current direct execution path as default rollback behavior
Rollout notes
- default remains unchanged until
ML_INTERN_BACKGROUND_WORKERS=true - safe first rollout is in-process worker:
ML_INTERN_BACKGROUND_WORKERS=true+ML_INTERN_RUN_WORKER_IN_PROCESS=true - separate worker Space entrypoint exists, but user-scoped HF tool execution still needs a token handoff/token-broker design before production use
Testing
UV_CACHE_DIR=/tmp/uv-cache uv run --extra dev pytest tests/unit/test_session_persistence.py tests/unit/test_background_worker.py tests/unit/test_session_manager_persistence.py tests/unit/test_user_quotas.py -qUV_CACHE_DIR=/tmp/uv-cache uv run python -m py_compile agent/core/session_persistence.py backend/background_worker.py backend/worker_app.py backend/main.py backend/routes/agent.py backend/session_manager.pygit diff --check- import smoke for
background_worker,worker_app, andmain
closed per maintainer request