ml-intern icon indicating copy to clipboard operation
ml-intern copied to clipboard

Plan Phase 3 Space background workers

Open akseljoonas opened this issue 7 months ago • 3 comments

Summary

  • document the Phase 3 background-worker architecture for Space sessions
  • add Mongo-backed durable session_runs queue methods, indexes, claim/heartbeat/finish/interrupt-expired lifecycle
  • add opt-in background /api/chat path behind ML_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 -q
  • UV_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.py
  • git diff --check
  • import smoke for background_worker, worker_app, and main

akseljoonas avatar Apr 28 '26 14:04 akseljoonas

Claude encountered an error —— View job


I'll analyze this and get back to you.

github-actions[bot] avatar Apr 28 '26 14:04 github-actions[bot]

Claude encountered an error —— View job


I'll analyze this and get back to you.

github-actions[bot] avatar Apr 28 '26 15:04 github-actions[bot]

closed per maintainer request

fglogan avatar May 03 '26 14:05 fglogan