Files
manual_slop/conductor/tracks/startup_speedup_20260606/state.toml
T
ed 7eb743c6cb conductor(plan): Phase 2 complete - io_pool + warmup foundation in place
Phase 2 of startup_speedup_20260606 is done.

Tasks:
  T2.1 (Red)   tests/test_io_pool.py         1354679e  4 tests
  T2.2 (Green) src/io_pool.py                1354679e  make_io_pool() factory
  T2.3 (Red)   tests/test_warmup.py          1354679e  10 tests
  T2.4 (Green) src/warmup.py                 1354679e  WarmupManager
  T2.5 (Wire)  AppController integration     922c5ad9  io_pool + warmup in __init__ + 5 public delegation methods
  T2.6 (Plan)  this commit

What now exists:
  - make_io_pool() returns a 4-worker ThreadPoolExecutor named 'controller-io-N'
  - WarmupManager class with submit/status/is_done/wait/on_complete/reset
  - AppController creates self._io_pool + self._warmup early in __init__
  - Warmup is submitted immediately (jobs run concurrent with the rest of init)
  - Public API: controller.warmup_status(), controller.is_warmup_done(),
    controller.wait_for_warmup(timeout), controller.on_warmup_complete(cb)
  - controller._compute_warmup_list() returns 9 always + 2 conditional (fastapi)
  - shutdown() now also shuts down the io_pool

Currently the warmup is a no-op for modules already imported at the top
of app_controller.py (fastapi, requests). Phase 3 will remove those
top-level imports; the warmup infrastructure will then start doing
real work.

18/18 tests passing (4 io_pool + 10 warmup + 4 test_app_controller_*).

Next: Phase 3 (remove top-level SDK imports from src/ai_client.py).
Expected to fix ~3 audit violations (google.genai, anthropic, openai).
2026-06-06 14:52:04 -04:00

130 lines
9.2 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 = 2
last_updated = "2026-06-07"
[phases]
phase_1 = { status = "completed", checkpoint_sha = "f9a01258", name = "Audit + Benchmark + Foundation" }
phase_2 = { status = "completed", checkpoint_sha = "f9a01258", name = "Job Pool + Warmup Foundation" }
phase_3 = { status = "pending", checkpoint_sha = "", name = "Remove top-level SDK imports (ai_client)" }
phase_4 = { status = "pending", checkpoint_sha = "", name = "Remove top-level FastAPI imports" }
phase_5 = { status = "pending", checkpoint_sha = "", name = "Remove top-level feature-gated GUI imports" }
phase_6 = { status = "pending", checkpoint_sha = "", name = "Migrate ad-hoc threads to _io_pool" }
phase_7 = { status = "pending", checkpoint_sha = "", name = "Warmup Notification (Hook API + GUI)" }
phase_8 = { status = "pending", checkpoint_sha = "", name = "Enforcement: runtime audit hook" }
phase_9 = { status = "pending", checkpoint_sha = "", name = "Verify + Checkpoint" }
[tasks]
# Phase 1: Audit + Benchmark + Foundation
t1_1 = { status = "completed", commit_sha = "6f9a3af2", description = "Capture baseline benchmark to docs/reports/startup_baseline_20260606.txt" }
t1_2 = { status = "completed", commit_sha = "6f9a3af2", description = "Write scripts/audit_gui2_imports.py + commit results to docs/reports/startup_audit_20260606.txt" }
t1_3 = { status = "completed", commit_sha = "5a856536", description = "Add StartupProfiler (src/startup_profiler.py + 5 tests)" }
t1_4 = { status = "completed", commit_sha = "6f9a3af2", description = "Write scripts/audit_main_thread_imports.py (static CI gate) + 9 tests" }
t1_5 = { status = "in_progress", commit_sha = "", description = "Commit plan update (this commit)" }
# Phase 2: Job Pool + Warmup Foundation
t2_1 = { status = "completed", commit_sha = "1354679e", description = "Red: tests/test_io_pool.py (4 tests)" }
t2_2 = { status = "completed", commit_sha = "1354679e", description = "Green: src/io_pool.py make_io_pool factory" }
t2_3 = { status = "completed", commit_sha = "1354679e", description = "Red: tests/test_warmup.py (10 tests)" }
t2_4 = { status = "completed", commit_sha = "1354679e", description = "Green: src/warmup.py WarmupManager class" }
t2_5 = { status = "completed", commit_sha = "922c5ad9", description = "Wire _io_pool + warmup into AppController.__init__ + 5 public delegation methods + io_pool shutdown" }
t2_6 = { status = "in_progress", commit_sha = "", description = "Plan update (this commit)" }
# Phase 3: Remove top-level SDK imports
t3_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_ai_client_no_top_level_sdk_imports.py" }
t3_2 = { status = "pending", commit_sha = "", description = "Green: remove top-level SDK imports from src/ai_client.py; add _require_warmed helper; update _send_* to use it" }
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: Remove top-level FastAPI imports
t4_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_hook_server_no_top_level_fastapi.py" }
t4_2 = { status = "pending", commit_sha = "", description = "Green: remove fastapi imports from src/api_hooks.py; use _require_warmed" }
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 5: Remove top-level feature-gated GUI imports
t5a_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_command_palette_no_top_level_import.py" }
t5a_2 = { status = "pending", commit_sha = "", description = "Green: remove from src/commands.py; use _require_warmed" }
t5a_3 = { status = "pending", commit_sha = "", description = "Fix existing test_command_palette.py" }
t5a_4 = { status = "pending", commit_sha = "", description = "Commit T5A" }
t5b_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_theme_nerv_no_top_level_import.py" }
t5b_2 = { status = "pending", commit_sha = "", description = "Green: remove from src/theme_2.py; use _require_warmed" }
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" }
t5c_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_markdown_helper_no_top_level_import.py" }
t5c_2 = { status = "pending", commit_sha = "", description = "Green: remove from src/markdown_helper.py; use _require_warmed" }
t5c_3 = { status = "pending", commit_sha = "", description = "Fix existing test_markdown_helper.py" }
t5c_4 = { status = "pending", commit_sha = "", description = "Commit T5C" }
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 same pattern per feature-gated import in src/gui_2.py; numpy in bg_shader" }
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: Warmup Notification (Hook API + GUI)
t7a_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_api_hooks_warmup.py" }
t7a_2 = { status = "pending", commit_sha = "", description = "Green: add /api/warmup_status and /api/warmup_wait endpoints" }
t7a_3 = { status = "pending", commit_sha = "", description = "Register warmup_status in _gettable_fields" }
t7a_4 = { status = "pending", commit_sha = "", description = "Commit T7A" }
t7b_1 = { status = "pending", commit_sha = "", description = "Add status-bar indicator in src/gui_2.py that polls warmup_status each frame" }
t7b_2 = { status = "pending", commit_sha = "", description = "Register on_warmup_complete callback that shows toast on success" }
t7b_3 = { status = "pending", commit_sha = "", description = "Update docs for status bar + hook API" }
t7b_4 = { status = "pending", commit_sha = "", description = "Commit T7B" }
# Phase 8: Enforcement - Runtime Audit Hook
t8_1 = { status = "pending", commit_sha = "", description = "Red: tests/test_main_thread_purity.py" }
t8_2 = { status = "pending", commit_sha = "", description = "Confirm test passes after Phase 3-5" }
t8_3 = { status = "pending", commit_sha = "", description = "Wire into CI as @pytest.mark.slow gating test" }
t8_4 = { 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_warmup_mechanism.py; warmup completes and notifications fire" }
t9_4 = { status = "pending", commit_sha = "", description = "Run test_main_thread_purity.py; pass" }
t9_5 = { status = "pending", commit_sha = "", description = "Run live_gui test batch; confirm wait_for_server passes" }
t9_6 = { status = "pending", commit_sha = "", description = "Manual smoke: provider-switch is INSTANT after warmup" }
t9_7 = { status = "pending", commit_sha = "", description = "Phase checkpoint commit + git note" }
t9_8 = { status = "pending", commit_sha = "", description = "Update tracks.md; archive track" }
[verification]
baseline_ai_client_ms = 0
after_ai_client_ms = 0
baseline_gui_2_ms = 1770
after_gui_2_ms = 0
baseline_app_controller_ms = 0
after_app_controller_ms = 0
warmup_completes_within_seconds = 0
warmup_modules_in_sys_modules = 0
provider_switch_latency_ms_after_warmup = 0
live_gui_passed = 0
live_gui_failed = 0
audit_main_thread_violations = 67
io_pool_max_workers = 4
io_pool_thread_name_prefix = "controller-io"
new_threading_thread_calls = 0
function_body_heavy_imports = 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(...)"}
[warmup_list]
# Filled in Phase 2 T2.4 implementation
google_genai = true
anthropic = true
openai = true
requests = true
src_command_palette = true
src_theme_nerv = true
src_theme_nerv_fx = true
src_markdown_table = true
numpy = true
fastapi = "conditional" # only when enable_test_hooks or web_host
fastapi_security_api_key = "conditional"