We need to maximize the inference capabilities of our local machine while using local…
- User
We need to maximize the inference capabilities of our local machine while using local llms. Examine what we've done so far and what we need to improve and or validate/verify. Remember we are test driven, spec-enabled, compound-engineering focused for increased context awarness and token efficiencies.
Assistant
Let me look at the failing tests and what's actually running vs what's spec'd:
Assistant
Now I have the full picture. Let me check the last critical gaps:
Assistant
- User
Proceed
Assistant
Now I have everything I need. The async fixture issue is clear, and
handle_requestpassesmodel=Nonetoallocate()which will crash. I'll fix both simultaneously with Task 4.Assistant
Now create
context_model_router.pywithModelContextProfileand a model size registry (Task 4):Assistant
There's a bug in that file -
ModelProfileAliasis called during dict construction but references_REGISTRYbefore it exists, and is defined after the dict. Let me fix it:Assistant
Now fix
handle_requestinenhanced_model_pool_system.pyto use the new profile lookup instead ofmodel=None:Assistant
Now verify the fixture fixes work:
Assistant
Fixtures fixed - now a real logic bug:
emergency_shutdowndoesn't setlast_emergency_shutdown. Let me read the monitor:Assistant
The bug is clear:
last_emergency_shutdownis only set inside the process-kill loop, but the test patches out all processes. It should be set at the top ofemergency_shutdownto record that the emergency was triggered. Let me check_current_time:Assistant
Good. Now fix
emergency_shutdownto setlast_emergency_shutdownat the top of the method:Assistant
All 3 emergency shutdown tests passing. Now run the integration tests:
Assistant
17/17 integration tests passing. Tasks 1 and 4 done:
Assistant
Now Task 2: wire real AMD memory telemetry. The
OverloadCoordinator.handle_memory_pressure()is called from_monitor_memory_pressure()viaMemoryBandwidthAnalyzer.analyze_memory_pressure(). Let me check that analyzer:Assistant
The sysfs VRAM (512MB) is just the dedicated slice — unified memory pressure is via RAM. The
MemoryBandwidthAnalyzercachesavailable_memory_gbat init, so it never updates. Let me fix it with tests first:TDD — write the failing test for real-time memory pressure:
Assistant
Writing tests first (RED phase) for the memory telemetry fix:
Assistant
RED confirmed. Now implement the fixes in
dynamic_model_router.py:Assistant
Verify GREEN:
Assistant
5/5 GREEN. Now wire
get_ollama_loaded_gbinto_monitor_memory_pressureso the coordinator gets Ollama-aware pressure:Assistant
Now Task 3: implement the OverloadCoordinator stub actions. Tests first:
Assistant
RED confirmed. Now implement the three stubs in
overload_coordinator.py:Assistant
All 3 GREEN. Task 3 done:
Assistant
Now run the full swarm test suite and then a focused regression check:
Assistant
My change removed
available_memory_gbas an instance attribute but other code still references it directly. I need to add it back as a property while keeping the live-read behavior:Assistant
The tests used patching only during init, relying on the stale cache. Now that
analyze_memory_pressure()reads live, I need to:- Restore
available_memory_gbas an attribute (updated each call) - Fix the tests to patch psutil for the full test, not just during init
- Restore
Assistant
Now fix the test helper to patch psutil for the full test scope, not just init:
Assistant
I need to update all remaining test methods that still use the old
_make()API (expecting just an analyzer, not a tuple). Let me do a targeted fix:Assistant
Now fix the
TestDynamicModelRoutertests that also call_make()via the analyzer:Assistant
The attribute needs to be available without calling
analyze_memory_pressure()first. The cleanest fix: make it a property onMemoryBandwidthAnalyzer:Assistant
22/22 passing. Now run the full suite to see the net improvement: