anthonyrawlins
|
e523c4b543
|
feat: Implement CHORUS scaling improvements for robust autoscaling
Address WHOOSH issue #7 with comprehensive scaling optimizations to prevent
license server, bootstrap peer, and control plane collapse during fast scale-out.
HIGH-RISK FIXES (Must-Do):
✅ License gate already implemented with cache + circuit breaker + grace window
✅ mDNS disabled in container environments (CHORUS_MDNS_ENABLED=false)
✅ Connection rate limiting (5 dials/sec, 16 concurrent DHT queries)
✅ Connection manager with watermarks (32 low, 128 high)
✅ AutoNAT enabled for container networking
MEDIUM-RISK FIXES (Next Priority):
✅ Assignment merge layer with HTTP/file config + SIGHUP reload
✅ Runtime configuration system with WHOOSH assignment API support
✅ Election stability windows to prevent churn:
- CHORUS_ELECTION_MIN_TERM=30s (minimum time between elections)
- CHORUS_LEADER_MIN_TERM=45s (minimum time before challenging healthy leader)
✅ Bootstrap pool JSON support with priority sorting and join stagger
NEW FEATURES:
- Runtime config system with assignment overrides from WHOOSH
- SIGHUP reload handler for live configuration updates
- JSON bootstrap configuration with peer metadata (region, roles, priority)
- Configurable election stability windows with environment variables
- Multi-format bootstrap support: Assignment → JSON → CSV
FILES MODIFIED:
- pkg/config/assignment.go (NEW): Runtime assignment merge system
- docker/bootstrap.json (NEW): Example JSON bootstrap configuration
- pkg/election/election.go: Added stability windows and churn prevention
- internal/runtime/shared.go: Integrated assignment loading and conditional mDNS
- p2p/node.go: Added connection management and rate limiting
- pkg/config/hybrid_config.go: Added rate limiting configuration fields
- docker/docker-compose.yml: Updated environment variables and configs
- README.md: Updated status table with scaling milestone
This implementation enables wave-based autoscaling without system collapse,
addressing all scaling concerns from WHOOSH issue #7.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-09-23 17:50:40 +10:00 |
|
anthonyrawlins
|
0dbb6bb588
|
Implement Phase 1: CHORUS Human Agent Portal (HAP) Multi-Binary Architecture
This commit completes Phase 1 of the HAP implementation by restructuring CHORUS
from a single binary to a dual-binary architecture that supports both autonomous
agents and human agent portals using shared P2P infrastructure.
## Key Changes
### Multi-Binary Architecture
- **cmd/agent/main.go**: Autonomous agent binary (preserves all original functionality)
- **cmd/hap/main.go**: Human Agent Portal binary (Phase 2 stub implementation)
- **cmd/chorus/main.go**: Backward compatibility wrapper with deprecation notices
### Shared Runtime Infrastructure
- **internal/runtime/shared.go**: Extracted all P2P infrastructure initialization
- **internal/runtime/agent_support.go**: Agent-specific behaviors and health monitoring
- Preserves 100% of existing CHORUS functionality in shared components
### Enhanced Build System
- **Makefile**: Complete multi-binary build system
- `make build` - Builds all binaries (agent, hap, compatibility wrapper)
- `make build-agent` - Agent only
- `make build-hap` - HAP only
- `make test-compile` - Compilation verification
## Architecture Achievement
✅ **Shared P2P Infrastructure**: Both binaries use identical libp2p, DHT, HMMM, UCXL systems
✅ **Protocol Compatibility**: Human agents appear as valid peers to autonomous agents
✅ **Container-First Design**: Maintains CHORUS's container deployment model
✅ **Zero Functionality Loss**: Existing users see no disruption
## Phase 1 Success Metrics - ALL ACHIEVED
✅ `make build` produces `chorus-agent`, `chorus-hap`, and `chorus` binaries
✅ Existing autonomous agent functionality unchanged
✅ Both new binaries can join same P2P mesh
✅ Clean deprecation path for existing users
## Next Steps
Phase 2 will implement the interactive terminal interface for chorus-hap, enabling:
- HMMM message composition helpers
- UCXL context browsing
- Human-friendly command interface
- Collaborative decision participation
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-09-06 20:49:05 +10:00 |
|