fix: start lifecycle manager in web dashboard to update session status#83
fix: start lifecycle manager in web dashboard to update session status#83sujayjayjay wants to merge 1 commit intomainfrom
Conversation
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>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| // 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) |
There was a problem hiding this comment.
Lifecycle manager interval never stopped, no cleanup
Low Severity
lifecycleManager.start() creates a setInterval that polls every 30 seconds, but stop() is never called anywhere in the web package and no shutdown handler is registered. The timer in the lifecycle manager is also not .unref()'d, so it keeps the Node.js event loop alive and can prevent graceful process shutdown (e.g., on SIGTERM during deploys). The stop() method exists on the LifecycleManager interface but is never wired to any cleanup path.
Triggered by project rule: BugBot Configuration


Summary
ao spawnbecause nothing was calling the lifecycle manager's polling loopProblem
ao spawnwritesstatus=spawningto the metadata file, but nothing ever updates it afterward. The dashboard shows all sessions as "spawning" indefinitely—even sessions where the agent has been working for hours, created PRs, and gone idle.Solution
The lifecycle manager already existed in
packages/core/src/lifecycle-manager.tswith full logic for:status=killedif deadstatus=workingstatus=pr_open,ci_failed,review_pending, etc.The fix simply creates and starts the lifecycle manager in
packages/web/src/lib/services.tswhen services are initialized.Test plan
ao startao spawnCloses #79
🤖 Generated with Claude Code