Skip to content

fix(stack): wire HiveConfig.max_memory_nodes into RustBrain#14

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-aa0b
Draft

fix(stack): wire HiveConfig.max_memory_nodes into RustBrain#14
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-aa0b

Conversation

@cursor

@cursor cursor Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

HiveConfig.max_memory_nodes (and HIVE_MAX_MEMORY_NODES / HIVE_MAX_NODES env vars) were parsed but never applied when constructing RustBrain inside HiveStack. Operators following the incident runbook or K8s manifests could believe they had capped memory at e.g. 500 nodes while the store still allowed 10,000 — risking OOM kills in memory-constrained pods.

Root cause

HiveStack.__init__ passed tenant_isolation and default_ttl_s from config to RustBrain, but omitted max_nodes. Deploy manifests also used the non-standard HIVE_MAX_NODES key instead of HIVE_MAX_MEMORY_NODES.

Fix

  • Pass max_nodes=self.config.max_memory_nodes when creating RustBrain
  • Accept HIVE_MAX_NODES as a legacy alias in HiveConfig.from_env()
  • Align K8s ConfigMap and Helm values with HIVE_MAX_MEMORY_NODES
  • Add regression tests verifying config → stack → eviction behavior

Validation

  • pytest tests/test_enterprise_config.py — new wiring + alias tests pass
  • Full suite: 178 passed, 8 skipped
Open in Web View Automation 

HiveConfig.max_memory_nodes and HIVE_MAX_MEMORY_NODES were parsed but
never passed to RustBrain, so operators could set a lower node cap (or
follow the incident runbook) and still get the hardcoded 10_000 limit.

- Pass max_nodes=self.config.max_memory_nodes in HiveStack
- Accept legacy HIVE_MAX_NODES env alias (used in K8s/Helm manifests)
- Align deploy configmaps with HIVE_MAX_MEMORY_NODES

Regression tests added in test_enterprise_config.py.

Co-authored-by: Daniel <DJLougen@users.noreply.github.com>
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