Skip to content

Comments

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

Open
sujayjayjay wants to merge 1 commit intomainfrom
feat/79
Open

fix: start lifecycle manager in web dashboard to update session status#83
sujayjayjay wants to merge 1 commit intomainfrom
feat/79

Conversation

@sujayjayjay
Copy link

Summary

  • Integrates the lifecycle manager into the web dashboard's service initialization
  • Lifecycle manager now starts automatically when the dashboard loads, polling session status every 30 seconds
  • Fixes the root cause: session status was never updated after ao spawn because nothing was calling the lifecycle manager's polling loop

Problem

ao spawn writes status=spawning to 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.ts with full logic for:

  • Checking if tmux session is alive → status=killed if dead
  • Checking agent process activity → status=working
  • Checking PR state via SCM plugin → status=pr_open, ci_failed, review_pending, etc.

The fix simply creates and starts the lifecycle manager in packages/web/src/lib/services.ts when services are initialized.

Test plan

  • Start the dashboard with ao start
  • Spawn a session with ao spawn
  • Verify session transitions from "spawning" to "working" within 30 seconds
  • Create a PR and verify status updates to "pr_open"
  • CI checks should reflect in dashboard status

Closes #79

🤖 Generated with Claude Code

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>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Triggered by project rule: BugBot Configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: session status never updates after spawn — dashboard permanently shows 'spawning'

1 participant