- **Restore 82 completed tasks** from tasks/complete/ back to tasks/ top level (all <7 days old per the cleanup policy; premature bulk archive was fixed). - **Dashboard: fix scroll-reset on auto-refresh** — renderBoard rebuilds the board via innerHTML every 2s, destroying each column-body's scrollTop. Now snapshots column-body scrollTop + board.scrollLeft + view.scrollTop before rebuild and restores after (matched by PHASE_GROUPS index). - **Dashboard UI additions** (pre-existing unstaged work): approval section cards, transition buttons, inline artifact editor (textarea for writing missing SPEC/VERDICT/etc from the detail modal). - **Bind ornith as Implement model** — config.md: Model explicit to omlx/Ornith-1.0-35B-4bit-mlx, context window 32768. Interactive autopilot already used ornith via opencode default; now explicit. - **Fix cleanup stub** — automaton-cleanup.sh had a stale --project arg pointing at a pytest temp dir (test isolation leak). Rewired to point at ~/.automaton. - **Fix plist-isolation test** — test asserted host plist doesn't exist, but a real install creates it. Now snapshots mtime before run, asserts unchanged after (only a write during the test counts as bleed). - **New Playwright smoke test** (tests/test_dashboard_ui.py) — 2 tests: board renders tasks, column scroll survives auto-refresh tick. Verified the test fails without the scroll fix (scrollTop resets to 0). Skipped via importorskip when playwright is absent (main CI stays green). - **Clarify SI loop scope in README** — new-project onboarding section documents the framework-scoped self-improvement loop and options (leave/pause/create project loop). - **CHANGELOG** documents all changes including the known model-divergence gap (mde tasks marked complete but per-role model binding was never implemented).
5.9 KiB
SPEC — vram-detect-cross-platform
Parent: runnable-test-suite (see PARENT_SPEC.md).
Scope
Make scripts/vram_detect.py work on macOS, Windows, and Linux without behavior
change on Cachyos/Linux. The existing version was developed on Cachyos and only
fully works on Linux. Pure detection logic — no CLI/JSON-shape changes.
Files this sub-task touches (and ONLY this)
scripts/vram_detect.py— surgical edits to detection functions only.
MUST NOT touch
tests/test_vram_detect.py(subtask-3 owns all vram_detect tests)- Any other test file
- Any documentation, prompt, or install script (subtask-1 owns those)
- CLI args, JSON output shape, main() flow — only detection internals
Functions to refactor (by current line in scripts/vram_detect.py)
run_command() (vram_detect.py:54-70)
- On Windows, route PowerShell cmdlets via
powershell -NoProfile -NoLogo -Command "..."wrapper. - Keep
shutil.which()gating so missing tools return None on all OSes. - Do not break Linux path.
detect_gpu_vram() (vram_detect.py:73-108)
Branch on platform.system():
- Linux: keep
nvidia-smi→lspci -vnnpath exactly as-is. Regression guard. - Darwin (macOS): add
system_profiler SPDisplaysDataTypeparser. ParseVRAM (Total):line for Intel Macs, and for Apple Silicon unified memory, detectChipset Model: Apple M*and treat total RAM as shared VRAM (callsysctl -n hw.memsizeonce and use that number, since Apple Silicon has no dedicated VRAM). Print clearly which kind was detected. Fallback (ifsystem_profilermissing):ioreg -c IOPlatformDevice -r -d 1. - Windows: add
wmic path win32_VideoController get AdapterRAM,Name /format:list(deprecated but ubiquitous; works on Win10/11). SumAdapterRAM=values across GPUs. PowerShell fallback:powershell -NoProfile -Command "Get-CimInstance Win32_VideoController | Select-Object AdapterRAM"
detect_ram() (vram_detect.py:137-162)
Branch on platform.system():
- Linux: keep
/proc/meminfopath. ParseMemTotal+MemAvailable. Regression guard. - Darwin: keep
sysctl -n hw.memsizepath (currently the fallback; promote to the macOS branch as primary). Returns (total_kb, total_kb) because macOS doesn't expose "available RAM" via sysctl directly — leave available == total. Print clear "available RAM detection not supported on macOS, reporting total" message once. - Windows: add
wmic ComputerSystem get TotalPhysicalMemory /format:list. Returns bytes — divide by 1024 for KB. PowerShell fallback:powershell -NoProfile -Command "(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory"
MODEL_CONTEXT_WINDOWS dict (vram_detect.py:24-47)
Additive only. Add these local-LLM entries with context sizes from public model cards:
llama-3.1-8b: 128_000llama-3.3-70b: 128_000qwen2.5-7b: 128_000 (Qwen2.5 supports up to 128k per model card)qwen2.5-72b: 128_000mistral-7b: 32_000mistral-large: 128_000deepseek-r1: 64_000 (DeepSeek-R1)deepseek-v3: 64_000glm-4: 128_000glm-4.5: 128_000gemma-2: 8_000gemma-2-27b: 8_000phi-3: 128_000phi-4: 16_000
Add a docstring comment above each: # Source: <model card URL or repo> — never
fabricate. If a number is uncertain, use the smaller conservative value and
leave a comment noting the uncertainty.
detect_model_context() (vram_detect.py:175-228)
Add an ollama list probe when no config file names a model AND the system has
ollama on PATH. Steps:
ollama list→ parse first non-header row's NAME column (strip:latesttag).- Look up the cleaned name in
MODEL_CONTEXT_WINDOWSvia existing_lookup_model_context. - If matched, return that context. If not matched, fall through to fail-open
0.
Do NOT modify any other code path in detect_model_context.
MUST NOT regress
- The existing Linux output of
python3 vram_detect.pymust produce byte-identical stdout (after the equivalent hardware probe) on the original Cachyos box. Subtask-3 will write a Linux-fixture test to lock this in. - Do not remove or alter any existing OpenAI/Anthropic entry in
MODEL_CONTEXT_WINDOWS.
Acceptance criteria
python3 scripts/vram_detect.pyon Darwin printsgpu_vram_gb > 0(currently prints 0).python3 scripts/vram_detect.pyJSON contains the same keys, same order, same types.python3 -m py_compile scripts/vram_detect.pyexits 0.- On a Linux fixture (simulated by subtask-3 tests with patched
platform.system), stdout matches the pre-refactor output line-by-line for GPU/RAM sections. python3 scripts/vram_detect.pydoes not crash on Windows stub (subtask-3 setsmonkeypatch.setattr(platform, "system", lambda: "Windows")and mocks subprocess).- No new third-party imports.
Anti-spin rails
- Unknown model name → fail open with
0. NEVER guess a context window. - If
platform.system()returns an unexpected string (e.g. "AIX"), fall through to Linux path or print "Unsupported OS: X" and return 0s. Do not crash. - If
system_profileroutput format on the local M-series Mac is different from what you parsed, STOP and report. Don't patch a half-working parser.
Hardware context (this box)
- Darwin arm64, Python 3.9.6 (stock CommandLineTools).
system_profiler SPDisplaysDataTypeis the canonical probe.- You can iterate locally by running
python3 scripts/vram_detect.pyafter each edit.
Recommended approach
- Add the local-LLM entries to
MODEL_CONTEXT_WINDOWSfirst (mechanical). - Refactor
detect_ram()with aplatform.system()dispatch — easiest, lowest risk. - Refactor
detect_gpu_vram()— hardest, leave for after RAM is green. - Add the
ollama listprobe. - Wrapping
run_command()for Windows PowerShell — defer until last. - After each function, run
python3 scripts/vram_detect.pyand confirm no crash + correct output. - Do NOT touch
tests/test_vram_detect.py. Subtask-3 will write tests against your function signatures.