Skip to content

Conversation

@sigfawn
Copy link

@sigfawn sigfawn commented Jan 2, 2026

This PR addresses stability issues in the Federated Learning service.

1. Memory Leak Prevention

  • Problem: EphemeralLearningAgent accumulated task history indefinitely until aggregation occurred. If the coordinator was offline or the interval failed, this caused unbounded memory growth.
  • Fix: Added a maxHistorySize (default 1000) cap. The history queue now automatically drops the oldest tasks when full.

2. Process Lifecycle Management

  • Problem: FederatedLearningManager started a setInterval that kept the Node.js event loop alive indefinitely, causing CLI commands and tests to hang instead of exiting.
  • Fix: Applied .unref() to the aggregation timer, allowing the process to exit naturally when no other work is pending.

Result: Safer, leak-proof distributed learning agents.

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.

1 participant