Merge pull request #75 from ipodishima/feature/agent-scheduling

feat: add time-based agent scheduling with APScheduler
This commit is contained in:
Leon van Zyl
2026-01-22 08:24:52 +02:00
committed by GitHub
16 changed files with 2261 additions and 76 deletions

View File

@@ -35,6 +35,7 @@ from .routers import (
features_router,
filesystem_router,
projects_router,
schedules_router,
settings_router,
spec_creation_router,
terminal_router,
@@ -47,6 +48,7 @@ from .services.dev_server_manager import (
)
from .services.expand_chat_session import cleanup_all_expand_sessions
from .services.process_manager import cleanup_all_managers, cleanup_orphaned_locks
from .services.scheduler_service import cleanup_scheduler, get_scheduler
from .services.terminal_manager import cleanup_all_terminals
from .websocket import project_websocket
@@ -61,8 +63,16 @@ async def lifespan(app: FastAPI):
# Startup - clean up orphaned lock files from previous runs
cleanup_orphaned_locks()
cleanup_orphaned_devserver_locks()
# Start the scheduler service
scheduler = get_scheduler()
await scheduler.start()
yield
# Shutdown - cleanup all running agents, sessions, terminals, and dev servers
# Shutdown - cleanup scheduler first to stop triggering new starts
await cleanup_scheduler()
# Then cleanup all running agents, sessions, terminals, and dev servers
await cleanup_all_managers()
await cleanup_assistant_sessions()
await cleanup_all_expand_sessions()
@@ -116,6 +126,7 @@ async def require_localhost(request: Request, call_next):
app.include_router(projects_router)
app.include_router(features_router)
app.include_router(agent_router)
app.include_router(schedules_router)
app.include_router(devserver_router)
app.include_router(spec_creation_router)
app.include_router(expand_project_router)