February 2026 Updates
This document covers all major changes pushed to themain branch during February 2026, including critical memory leak fixes, client performance optimizations, streaming infrastructure improvements, and agent system enhancements.
Critical Memory Leak Fixes
A comprehensive memory leak audit identified and fixed 20+ memory leaks across the codebase. All fixes follow the establishedSystemBase cleanup pattern.
Server-Side Leaks (HIGH Priority)
ModelCache - GPU Memory Leak (CRITICAL)
ModelCache - GPU Memory Leak (CRITICAL)
clear() and remove() methodsImpact: Prevents GPU memory exhaustion in long-running sessionsEventBridge - 50+ Listener Accumulation (HIGH)
EventBridge - 50+ Listener Accumulation (HIGH)
destroy() method to clean up all registered listenersPattern: Track listeners in Map, iterate and remove on destroyGameTickProcessor, TradingSystem, AgentManager (HIGH)
GameTickProcessor, TradingSystem, AgentManager (HIGH)
destroy() methodFiles Fixed:GameTickProcessor.ts- Tick event handlersTradingSystem/index.ts- PLAYER_LEFT/LOGOUT/DIED handlersAgentManager.ts- COMBAT_DAMAGE_DEALT listenerAutonomousBehaviorManager.ts- Agent lifecycle handlers
RTMPBridge - WebSocket Listeners (HIGH)
RTMPBridge - WebSocket Listeners (HIGH)
removeAllListeners() before closing WebSocket serversAggroSystem - Unbounded Maps (MEDIUM)
AggroSystem - Unbounded Maps (MEDIUM)
StarterChestEntity - Unbounded Set (MEDIUM)
StarterChestEntity - Unbounded Set (MEDIUM)
Client-Side Leaks (MEDIUM-HIGH Priority)
GPU Resource Hygiene
GPU Resource Hygiene
Component Lifecycle
Component Lifecycle
World Initialization Race Condition
World Initialization Race Condition
Memory Management Best Practices
When creating new systems or managers:- Track All Resources: Store references to intervals, listeners, handlers
- Implement Cleanup: Add
destroy(),shutdown(), orstop()methods - Follow SystemBase Pattern: Use the same cleanup patterns as SystemBase
- Clean Up on Hot Reload: Ensure resources are released during development
- Test for Leaks: Monitor memory usage during long-running sessions
Client Performance Optimizations
Movement System Overhaul
Immediate Move Processing
Pathfinding Rate Limit
BFS Iterations
Path Continuation
Minimap Rendering Optimization
Async Terrain Generation
Canvas Rotation Transform
Layer Synchronization
Client Memory Optimizations
- Machine ID Caching: Browser fingerprint cached in
_cachedMachineId(avoids canvas allocation on every token operation) - Activity Debouncing: 500ms debounce on saveSession() localStorage writes (was synchronous on every interaction)
- XP Drop Listener: Store bound handler so destroy() can call world.off() (eliminates leak that survived world teardown)
- Stale Health Bar Sweep: Reverse iteration to remove bars for despawned entities
Streaming Infrastructure Improvements
WebGPU Initialization & Diagnostics
Adapter Request Timeout
navigator.gpu.requestAdapter() to prevent indefinite hangsRenderer Init Timeout
renderer.init() to detect GPU driver issuesPreflight Testing
testWebGpuInit() runs on blank page before loading game contentGPU Diagnostics
captureGpuDiagnostics() extracts chrome://gpu info for debuggingVast.ai Deployment Architecture
The streaming pipeline requires specific GPU setup:1. GPU Rendering Modes (tried in order)
Xvfb with NVIDIA Vulkan
2. Deployment Validation
Early Display Driver Check
Early Display Driver Check
- Checks nvidia_drm kernel module
- Checks DRM device nodes (/dev/dri/)
- Queries GPU display_mode via nvidia-smi to verify display driver support
- Provides clear guidance to rent instances with
gpu_display_active=trueon Vast.ai
Vulkan ICD Validation
Vulkan ICD Validation
- Checks Vulkan ICD availability at
/usr/share/vulkan/icd.d/nvidia_icd.json - Logs actual ICD content and VK_LOADER_DEBUG output for diagnostics
- XDG_RUNTIME_DIR: Required for Vulkan/EGL initialization (set to
/tmp/runtime-root)
WebGPU Pre-Check Tests
WebGPU Pre-Check Tests
- Headless Vulkan
- Headless EGL
- Xvfb Vulkan
- Ozone Headless
- SwiftShader
- Playwright Xvfb
3. Vast.ai CLI Provisioner
New automated provisioner script:./scripts/vast-provision.sh
4. Stream Capture Improvements
- Chrome Executable: Set
STREAM_CAPTURE_EXECUTABLEto explicit Chrome path (e.g.,/usr/bin/google-chrome-unstable) for reliable WebGPU - Browser Restart: Automatic browser restart every 45 minutes to prevent WebGPU OOM crashes
- Page Navigation Timeout: Increased to 180s for Vite dev mode (production build recommended)
- Resolution Tracking: Automatic viewport recovery on resolution mismatch
- Probe Timeout: 5s timeout on probe evaluate calls to prevent hanging
5. macOS WebGPU Support
- Metal Backend: macOS uses Metal (not Vulkan) for WebGPU
- System Chrome Required: Auto-detects and uses system Chrome on macOS for WebGPU support
- Playwright Limitation: Bundled Chromium doesn’t have proper WebGPU support on macOS
- No Vulkan ICD: Don’t set
VK_ICD_FILENAMESon macOS (not applicable) - Chrome Flags: Remove Vulkan from feature flags on macOS (Metal is the backend)
Agent System Improvements
Dynamic Combat Progression
Monster Escalation
Combat Style Rotation
Cooking Phase
Gear Upgrade Phase
Stability Fixes
Critical Crash Fix
Critical Crash Fix
weapon.toLowerCase is not a function crash in getEquippedWeaponTier that broke ALL agents every tickRoot Cause: Weapon could be an object instead of stringFix: Added type guard and proper string extractionLLM Error Fallback
LLM Error Fallback
Quest Goal Detection
Quest Goal Detection
Configuration Improvements
- Combat Food Threshold: Increased from 5 → 10 for better survival
- World Data Manifest Loading: Monster tiers and gear tiers loaded from world-data
- Short-Circuit Dashboard Sync: All agents show activity logs even when skipping LLM
- LLM Rate Limiting: Exponential backoff for API calls (5s base, max 60s)
- Consecutive Failure Tracking: Resets on successful tick
Combat System Stability
Duel System Improvements
Combat Retry Timer
Phase Timeout
Combat Stall Nudge
Damage Event Cache
Gold Betting Demo - Mobile UI
Mobile Responsive Overhaul
Resizable Panels
Mobile Detection
Mobile Layout
Mobile Header
Data Integration
- Real Data Integration: Live SSE feed from game server (devnet mode) replaces mock data
- Simulation Mode: Available via
bun run dev:stream-ui(dev mode uses real endpoints only) - Tab Reordering: Trades tab moved first for better mobile UX
Console Noise Reduction
Recharts Warning Fix
Recharts Warning Fix
.hm-chart-container min-height to 120px (eliminates width/height=0 warnings)EventSource Auto-Reconnect
EventSource Auto-Reconnect
Exponential Backoff
Exponential Backoff
Testing Infrastructure
E2E Journey Tests
New comprehensive end-to-end tests inpackages/client/tests/e2e/complete-journey.spec.ts:
Test Stability Improvements
- GoldClob Fuzz Tests: 120s timeout for randomized invariant tests (4 seeds × 140 operations)
- Precision Fixes: Use larger amounts (10000n) to avoid gas cost precision issues
- Dynamic Import Timeout: 60s timeout for EmbeddedHyperscapeService beforeEach hooks
- Anchor Test Configuration: Use localnet instead of devnet for free SOL in
anchor test - CI Build Order: Build impostors/procgen before shared (dependency fix)
Model Cache & Rendering
Index Buffer Type Preservation
Issue: Silent geometry corruption and RangeError crashes on cached model restore Fix: Cache version bumped to 4 to invalidate corrupt entries Impact: Affects all GLB models loaded via ModelCache (resources, NPCs, items)Resource Management
Activity Logger Queue
- Max Size: 1000 entries with 25% eviction to prevent memory pressure
- Eviction Policy: LRU-style pruning when limit exceeded
Session Timeout
- 30-Minute Max: Via MAX_SESSION_TICKS for zombie session cleanup
- SessionCloseReason: Added “timeout” to type for proper session termination tracking
Breaking Changes
API Changes
ResourceVisualStrategy.onDepleted()
ResourceVisualStrategy.onDepleted()
boolean:true= strategy handled depletion (instanced stump)false= ResourceEntity should load individual depleted model
getHighlightMesh(ctx) for instanced entity highlightingTileMovementState
TileMovementState
requestedDestination: TileCoord | nulllastPathPartial: booleannextSegmentPrecomputed: boolean
createTileMovementState() - optional typing was removedtileMovementStart Packet
tileMovementStart Packet
isContinuation?: boolean field for path continuation supportMigration Guide
For Developers
Review Memory Cleanup
- Add
destroy()orshutdown()methods - Track and cleanup all event listeners
- Clear intervals and timeouts
Test Movement
- ActionQueue no longer buffers move requests
- Path continuation handles long-distance clicks automatically
For Vast.ai Deployments
Performance Metrics
Before vs After
| Metric | Before | After | Improvement |
|---|---|---|---|
| Move Click Latency | 0-600ms | ~0ms | Instant response |
| Pathfinding Range | ~22 tiles | ~44 tiles | 2× radius |
| Minimap Terrain Sampling | 40,000 pixels | 2,500 pixels | 16× reduction |
| Memory Leaks Fixed | 20+ leaks | 0 known leaks | 100% |
| Browser Restart Interval | 60 min | 45 min | Prevents OOM |
| Combat Retry Timer | 1500ms | 3000ms | Tick-aligned |
| Phase Timeout | 30s | 10s | 3× faster detection |
Files Changed
Core Engine (packages/shared/)
Movement System
Movement System
systems/shared/movement/TileSystem.ts- Path continuation, immediate processingsystems/client/TileInterpolator.ts- Skating fix, optimistic targeting, allocation eliminationsystems/ServerNetwork/tile-movement.ts- Server-side pre-computationsystems/ServerNetwork/mob-tile-movement.ts- Mob movement state updates
Rendering & GPU
Rendering & GPU
utils/rendering/ModelCache.ts- Index buffer type preservation, geometry disposalsystems/client/XPDropSystem.ts- Object poolingsystems/client/DuelCountdownSplatSystem.ts- Texture pre-renderingsystems/client/HealthBars.ts- Timeout cleanup, stale bar sweepsystems/client/ProjectileRenderer.ts- Reference-counted geometrylib/ThreeResourceManager.ts- Teardown method
Memory Management
Memory Management
components/ColliderComponent.ts- Collision handler cleanupentities/npc/MobEntity.ts- PLAYER_SET_DEAD listener cleanupplatform/shared/Socket.ts- WebSocket handler cleanupsystems/client/ClientLiveKit.ts- Voice Map and room listener cleanup
Server (packages/server/)
Systems
Systems
systems/GameTickProcessor.ts- Event handler cleanupsystems/TradingSystem/index.ts- Player lifecycle handler cleanupsystems/ServerNetwork/event-bridge.ts- Listener tracking and cleanupsystems/ServerNetwork/action-queue.ts- PlayerQueues cleanupsystems/ServerNetwork/ScriptQueue.ts- Queue cleanup methodssystems/shared/combat/AggroSystem.ts- Player data cleanup on disconnect
Entities
Entities
entities/world/StarterChestEntity.ts- Bounded lootedByCharacters Set
Infrastructure
Infrastructure
startup/shutdown.ts- Rate limiter and idempotency service cleanupstreaming/rtmp-bridge.ts- WebSocket listener cleanupstreaming/stream-capture.ts- Browser restart, timeout improvementssystems/ServerNetwork/services/Logger.ts- Cleanup interval tracking
Eliza/Agents
Eliza/Agents
eliza/AgentManager.ts- COMBAT_DAMAGE_DEALT listener cleanup, LLM rate limitingeliza/managers/autonomous-behavior-manager.ts- Event handler cleanup
Duel System
Duel System
systems/DuelSystem/index.ts- Combat retry timer, phase timeoutsystems/StreamingDuelScheduler/managers/DuelOrchestrator.ts- Combat stall nudge
Client (packages/client/)
Game Client
Game Client
game/EmbeddedGameClient.tsx- Cancelled flag for async stategame/hud/Minimap.tsx- Async terrain generation, canvas rotation, layer syncauth/PlayerTokenManager.ts- beforeUnloadHandler cleanup, machine ID caching, activity debouncing
Tests
Tests
tests/e2e/complete-journey.spec.ts- NEW: Full journey teststests/e2e/utils/visualTesting.ts- Screenshot comparison utilities
Scripts
scripts/vast-provision.sh- NEW: Automated Vast.ai provisionerscripts/deploy-vast.sh- Enhanced WebGPU validation and diagnostics
Gold Betting Demo (packages/gold-betting-demo/)
app/src/App.tsx- Mobile responsive UIapp/src/AppRoot.tsx- Mode routing (stream-ui vs normal)app/src/lib/useResizePanel.ts- NEW: Resizable panel hookapp/src/components/ResizeHandle.tsx- NEW: Resize handle componentapp/src/spectator/useStreamingState.ts- EventSource auto-reconnect fixapp/src/spectator/useDuelContext.ts- Exponential backoff pollingkeeper/src/db.ts- NEW: Persistence layer