Private
Public Access
Fulfills the existing backlog entry at conductor/tracks.md:152 (2026-06-05 root-cause analysis of live_gui wait_for_server timeouts). Main Thread Purity Invariant: the main thread (entering immapp.run()) must never import a module heavier than imgui_bundle and the lean gui_2 skeleton. Enforced by: - static gate: scripts/audit_main_thread_imports.py (CI) - runtime hook: tests/test_main_thread_purity.py (sys.addaudithook) Threading constraint: no new threading.Thread(...) calls in src/. All background work goes through AppController._io_pool (ThreadPoolExecutor, max_workers=4, thread_name_prefix='controller-io'). 9 phases, 57 tasks: audit+baseline, job pool, lazy-load SDKs, lazy-load FastAPI, lazy-load feature-gated GUI, migrate ad-hoc threads, runtime enforcement, hook API + diagnostics, verify+checkpoint. Expected savings: ~2000-2400ms off main-thread import cost. Target: import src.ai_client < 50ms (from ~1800ms), live_gui fixtures no longer time out at wait_for_server(timeout=15).
111 lines
7.6 KiB
TOML
111 lines
7.6 KiB
TOML
# Track state for startup_speedup_20260606
|
|
# Updated by Tier 2 Tech Lead as tasks complete
|
|
|
|
[meta]
|
|
track_id = "startup_speedup_20260606"
|
|
name = "Sloppy.py Startup Speedup"
|
|
status = "active"
|
|
current_phase = 1
|
|
last_updated = "2026-06-06"
|
|
|
|
[phases]
|
|
phase_1 = { status = "in_progress", checkpoint_sha = "", name = "Audit + Benchmark + Foundation" }
|
|
phase_2 = { status = "pending", checkpoint_sha = "", name = "Job Pool Foundation (no new threads)" }
|
|
phase_3 = { status = "pending", checkpoint_sha = "", name = "Lazy-load AI provider SDKs" }
|
|
phase_4 = { status = "pending", checkpoint_sha = "", name = "Lazy-load FastAPI in HookServer" }
|
|
phase_5 = { status = "pending", checkpoint_sha = "", name = "Lazy-load feature-gated GUI modules" }
|
|
phase_6 = { status = "pending", checkpoint_sha = "", name = "Migrate ad-hoc threads to _io_pool" }
|
|
phase_7 = { status = "pending", checkpoint_sha = "", name = "Enforcement: runtime audit hook" }
|
|
phase_8 = { status = "pending", checkpoint_sha = "", name = "Hook API + Diagnostics" }
|
|
phase_9 = { status = "pending", checkpoint_sha = "", name = "Verify + Checkpoint" }
|
|
|
|
[tasks]
|
|
# Phase 1: Audit + Benchmark + Foundation
|
|
t1_1 = { status = "pending", commit_sha = "", description = "Capture baseline benchmark" }
|
|
t1_2 = { status = "pending", commit_sha = "", description = "Audit src/gui_2.py imports (first-frame vs feature-gated)" }
|
|
t1_3 = { status = "pending", commit_sha = "", description = "Add StartupProfiler and instrument init" }
|
|
t1_4 = { status = "pending", commit_sha = "", description = "Write scripts/audit_main_thread_imports.py (static CI gate)" }
|
|
t1_5 = { status = "pending", commit_sha = "", description = "Commit baseline + audit script" }
|
|
# Phase 2: Job Pool Foundation
|
|
t2_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_app_controller_io_pool.py" }
|
|
t2_2 = { status = "pending", commit_sha = "", description = "Green: add _io_pool ThreadPoolExecutor + submit_io helper to AppController" }
|
|
t2_3 = { status = "pending", commit_sha = "", description = "Confirm T2.1 tests pass + full suite still passes" }
|
|
t2_4 = { status = "pending", commit_sha = "", description = "Commit T2" }
|
|
# Phase 3: Lazy-load AI Provider SDKs
|
|
t3_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_ai_client_lazy_imports.py" }
|
|
t3_2 = { status = "pending", commit_sha = "", description = "Green: move provider SDK imports into _send_* funcs" }
|
|
t3_3 = { status = "pending", commit_sha = "", description = "Fix existing test_ai_client.py breakage" }
|
|
t3_4 = { status = "pending", commit_sha = "", description = "Confirm T3.1 tests PASS" }
|
|
t3_5 = { status = "pending", commit_sha = "", description = "Commit T3" }
|
|
t3_6 = { status = "pending", commit_sha = "", description = "Update tracks.md T3 row" }
|
|
# Phase 4: Lazy-load FastAPI
|
|
t4_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_hook_server_lazy_fastapi.py" }
|
|
t4_2 = { status = "pending", commit_sha = "", description = "Green: move fastapi imports into HookServer methods" }
|
|
t4_3 = { status = "pending", commit_sha = "", description = "Fix existing test_api_hooks.py breakage" }
|
|
t4_4 = { status = "pending", commit_sha = "", description = "Confirm T4.1 tests PASS" }
|
|
t4_5 = { status = "pending", commit_sha = "", description = "Commit T4" }
|
|
# Phase 5A: Command Palette
|
|
t5a_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_command_palette_lazy.py" }
|
|
t5a_2 = { status = "pending", commit_sha = "", description = "Green: lazy-load in src/commands.py" }
|
|
t5a_3 = { status = "pending", commit_sha = "", description = "Fix existing test_command_palette.py" }
|
|
t5a_4 = { status = "pending", commit_sha = "", description = "Commit T5A" }
|
|
# Phase 5B: NERV Theme
|
|
t5b_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_theme_nerv_lazy.py" }
|
|
t5b_2 = { status = "pending", commit_sha = "", description = "Green: lazy-load in src/theme_2.py" }
|
|
t5b_3 = { status = "pending", commit_sha = "", description = "Fix existing test_theme_2.py + test_theme_nerv.py" }
|
|
t5b_4 = { status = "pending", commit_sha = "", description = "Commit T5B" }
|
|
# Phase 5C: Markdown Table
|
|
t5c_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_markdown_helper_lazy.py" }
|
|
t5c_2 = { status = "pending", commit_sha = "", description = "Green: lazy-load in src/markdown_helper.py" }
|
|
t5c_3 = { status = "pending", commit_sha = "", description = "Fix existing test_markdown_helper.py" }
|
|
t5c_4 = { status = "pending", commit_sha = "", description = "Commit T5C" }
|
|
# Phase 5D: gui_2 feature-gated imports
|
|
t5d_1 = { status = "pending", commit_sha = "", description = "Run audit_gui2_imports.py and collect feature-gated list" }
|
|
t5d_2 = { status = "pending", commit_sha = "", description = "Apply TDD pattern per feature-gated import" }
|
|
t5d_3 = { status = "pending", commit_sha = "", description = "Run full GUI test suite; fix" }
|
|
t5d_4 = { status = "pending", commit_sha = "", description = "Commit per feature group" }
|
|
# Phase 6: Migrate ad-hoc threads
|
|
t6_1 = { status = "pending", commit_sha = "", description = "Audit threading.Thread( spawns; document each" }
|
|
t6_2 = { status = "pending", commit_sha = "", description = "Refactor each ad-hoc thread to use controller.submit_io" }
|
|
t6_3 = { status = "pending", commit_sha = "", description = "Run full test suite; fix" }
|
|
t6_4 = { status = "pending", commit_sha = "", description = "Commit per migration; final grep shows zero new spawns" }
|
|
# Phase 7: Enforcement - Runtime Audit Hook
|
|
t7_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_main_thread_purity.py" }
|
|
t7_2 = { status = "pending", commit_sha = "", description = "Confirm test passes after Phase 3-5" }
|
|
t7_3 = { status = "pending", commit_sha = "", description = "Wire into CI as @pytest.mark.slow gating test" }
|
|
t7_4 = { status = "pending", commit_sha = "", description = "Commit T7" }
|
|
# Phase 8: Hook API + Diagnostics
|
|
t8_1 = { status = "pending", commit_sha = "", description = "Add /api/startup_profile endpoint" }
|
|
t8_2 = { status = "pending", commit_sha = "", description = "Add /api/io_pool_status endpoint" }
|
|
t8_3 = { status = "pending", commit_sha = "", description = "Add startup profile + io_pool status to Diagnostics panel" }
|
|
t8_4 = { status = "pending", commit_sha = "", description = "Update docs/guide_api_hooks.md" }
|
|
t8_5 = { status = "pending", commit_sha = "", description = "Tests for endpoints + profiler round-trip" }
|
|
t8_6 = { status = "pending", commit_sha = "", description = "Commit T8" }
|
|
# Phase 9: Verify + Checkpoint
|
|
t9_1 = { status = "pending", commit_sha = "", description = "Re-run benchmark; diff vs baseline" }
|
|
t9_2 = { status = "pending", commit_sha = "", description = "Re-run audit_main_thread_imports.py; exit 0" }
|
|
t9_3 = { status = "pending", commit_sha = "", description = "Run test_main_thread_purity.py; pass" }
|
|
t9_4 = { status = "pending", commit_sha = "", description = "Run live_gui test batch; confirm wait_for_server passes" }
|
|
t9_5 = { status = "pending", commit_sha = "", description = "Manual smoke (normal, test-hooks, headless modes)" }
|
|
t9_6 = { status = "pending", commit_sha = "", description = "Phase checkpoint commit + git note" }
|
|
t9_7 = { status = "pending", commit_sha = "", description = "Update tracks.md; archive track" }
|
|
|
|
[verification]
|
|
# To be filled at Phase 9
|
|
baseline_ai_client_ms = 0
|
|
after_ai_client_ms = 0
|
|
baseline_gui_2_ms = 0
|
|
after_gui_2_ms = 0
|
|
baseline_app_controller_ms = 0
|
|
after_app_controller_ms = 0
|
|
live_gui_passed = 0
|
|
live_gui_failed = 0
|
|
audit_main_thread_violations = 0
|
|
io_pool_max_workers = 4
|
|
io_pool_thread_name_prefix = "controller-io"
|
|
new_threading_thread_calls = 0
|
|
|
|
[ad_hoc_threads]
|
|
# Filled in Phase 6 T6.1 audit
|
|
# Format: {file = "src/foo.py", line = 42, current_target = "lambda", proposed_target = "controller.submit_io(...)"}
|