fix: start lifecycle manager in web dashboard to update session status

The dashboard was permanently showing all sessions as "spawning" because
the lifecycle manager was never started. The lifecycle manager is the
component that polls sessions and detects state transitions (spawning →
working → pr_open → etc.), updating the metadata files accordingly.

This change initializes and starts the lifecycle manager when the web
services are created, enabling automatic session status updates.

Closes #79

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Sujay Choubey 2026-02-18 00:00:42 +05:30
parent 5fe476774d
commit fc6095c8ad
1 changed files with 10 additions and 1 deletions

View File

@ -14,9 +14,11 @@ import {
loadConfig,
createPluginRegistry,
createSessionManager,
createLifecycleManager,
type OrchestratorConfig,
type PluginRegistry,
type SessionManager,
type LifecycleManager,
type SCM,
type Tracker,
type ProjectConfig,
@ -34,6 +36,7 @@ export interface Services {
config: OrchestratorConfig;
registry: PluginRegistry;
sessionManager: SessionManager;
lifecycleManager: LifecycleManager;
}
// Cache in globalThis for Next.js HMR stability
@ -72,7 +75,13 @@ async function initServices(): Promise<Services> {
const sessionManager = createSessionManager({ config, registry });
const services = { config, registry, sessionManager };
// Create and start the lifecycle manager to poll session status
// This runs a background loop that detects state transitions:
// spawning → working → pr_open → ci_failed/review_pending → etc.
const lifecycleManager = createLifecycleManager({ config, registry, sessionManager });
lifecycleManager.start(); // Start polling (default: every 30 seconds)
const services = { config, registry, sessionManager, lifecycleManager };
globalForServices._aoServices = services;
return services;
}