Skip to content

bug: disabled agent pools show stale occupancy after disable and re-enable #123

@furquanuddin94

Description

@furquanuddin94

Description

Disabled agent pools can retain stale runtime occupancy after being disabled, and re-enabling the pool does not recompute occupancy from currently running sessions.

We observed two related issues:

  1. After disabling a pool, the Pools UI can still show active agents / occupied capacity from stale runtime status.
  2. Re-enabling the pool can preserve that stale status instead of reconciling against live sessions.

Steps to reproduce

  1. Create an agent pool for workers or stewards.
  2. Let a matching agent session run so the pool has active occupancy.
  3. Disable the pool.
  4. Observe the pool in the Pools UI or via GET /api/pools.
  5. Re-enable the pool while matching sessions may or may not still be running.
  6. Observe the pool status again.

Expected behavior

Disabling a pool should not leave stale runtime occupancy visible or operational.

When disabled:

  • the pool should not show stale active agents as occupying capacity
  • the pool should not block operations because of stale runtime occupancy

When re-enabled:

  • the pool should recompute occupancy from currently running matching worker/steward sessions
  • if live matching sessions exceed maxSize, the pool should come back full / over capacity and block new matching spawns
  • existing sessions should not be terminated automatically

Actual behavior

A disabled pool can still show active agents / occupied capacity.

In local testing, a disabled pool showed a worker in activeAgentIds even though no matching worker session was running. Calling POST /api/pools/refresh cleared the stale occupancy, and deletion then worked.

Code inspection also suggests re-enable follows the same update path and preserves the existing cached status instead of recomputing from live sessions.

Operating system

macOS

Node version

20

Package version

1.25.0

Additional context

This is separate from #121, which covers enabled pool slots remaining occupied after sessions terminate. This issue is specifically about disabled pool lifecycle behavior: stale occupancy can remain visible after disable, and re-enable does not appear to reconcile status from live sessions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions