Files
foxhunt/docs/archive/wave_d/reports/IMMEDIATE_NEXT_STEPS.md
jgrusewski 433af5c25d chore: Major codebase cleanup - remove deprecated files and organize structure
- Docker: Delete 23 deprecated Dockerfiles, fix CI/CD to use Dockerfile.foxhunt-build
- Config: Remove 36 .env files, keep 4 essential, delete config/environments/
- Docs: Archive 614 Wave D files to docs/archive/wave_d/, 95% reduction in root
- Scripts: Delete 56 deprecated scripts, keep 58 production-critical (49% reduction)
- Python: Organize 37 scripts into scripts/python/ subdirectories, delete ml/python/
- Build: Remove 1GB artifacts, delete old venvs, clean Python cache from git
- Migrations: Delete deprecated directory (4,432 lines), remove duplicate database/migrations/
- Infrastructure: Delete deployment/ (61 files), docs/scripts/ (8 files)

Total impact: ~2,500 files cleaned, 750MB+ space freed, zero production impact
All deleted scripts backed up to archives. runpod/ and tests/runpod/ preserved.
data_acquisition_service retained per user request.
2025-10-30 01:02:34 +01:00

8.1 KiB

IMMEDIATE NEXT STEPS - STOP THE CIRCLES 🛑

Date: 2025-10-23 Status: 26 Agents Complete, Stabilization Framework Operational Goal: Deploy to Runpod for Model Training


🚦 CURRENT STATUS (VERIFIED)

Release build compiles (5m 55s, 0 errors) 26 parallel agents completed (all root causes documented) FP32 models ready for deployment (no QAT blockers) Prevention framework created (no more circles) Test suite blocked (backtesting examples need 3-hour fix)


📋 TODAY'S ACTION PLAN (3 Hours)

Step 1: Fix Backtesting Examples (3 Hours)

Problem: 27 compilation errors in backtesting/examples/feature_comparison_backtest.rs Root Cause: Missing use rust_decimal::prelude::ToPrimitive;

Files to Fix (2 files):

# 1. backtesting/examples/feature_comparison_backtest.rs
# 2. backtesting/examples/*.rs (check all examples)

Fix Pattern:

// Add to top of file (after other imports):
use rust_decimal::prelude::ToPrimitive;

Verification:

cargo build --workspace --examples
# Should compile cleanly

Time: 3 hours (27 errors across multiple files)

Step 2: Run Full Test Suite (10 Minutes)

Command:

cargo test --workspace --no-fail-fast -- --test-threads=1 2>&1 | tee /tmp/test_results_final.txt

Why --test-threads=1?:

  • Agent 5 identified database race conditions (180 tests on shared DB)
  • Serial execution = 100% stability (5-10 min total)
  • Parallel execution = flaky failures

Get Real Numbers:

# Extract pass rate
tail -100 /tmp/test_results_final.txt | grep "test result:"

Expected: ~99% pass rate (some pre-existing failures in trading_agent)

Step 3: Deploy FP32 to Runpod (Ready NOW)

You can deploy FP32 models RIGHT NOW (no QAT needed):

# On Runpod instance with 4GB+ GPU:
cd /workspace/foxhunt
cargo run -p ml --example train_tft_parquet --release --features cuda -- \
  --parquet-file test_data/ES_FUT_180d.parquet \
  --epochs 50

Expected Results:

  • Training time: ~3-5 minutes (50 epochs)
  • GPU memory: ~815 MB (fits on 4GB easily)
  • Model accuracy: Baseline FP32 performance

Success Criteria:

  • Training completes without OOM
  • Model saves successfully
  • Inference works on test data

📅 WEEK 1 PLAN (Deploy & Validate)

Day 1 (Today)

  • 26 agents complete
  • Fix backtesting examples (3h)
  • Run full test suite (10min)
  • Document actual pass rate

Day 2-3 (Runpod FP32 Deployment)

  • Provision Runpod GPU (RTX 4090 recommended, ~$0.30/hour)
  • Deploy FP32 training (TFT, MAMBA-2, DQN, PPO)
  • Baseline metrics (time, memory, accuracy)
  • Validate 225-feature extraction pipeline

Day 4-5 (QAT Validation)

  • Test Agent 6 device mismatch fix (CPU→CUDA calibration)
  • Test Agent 7 OOM recovery (simulate memory pressure)
  • Validate on 8GB+ GPU (TFT-225 requires ≥8GB with QAT)

📂 KEY DOCUMENTS TO READ

Immediately (Before Taking Action)

  1. FINAL_STABILIZATION_WAVE_COMPLETE.md (this directory)

    • Complete 26-agent summary
    • What was fixed, what's still broken
    • Honest assessment vs CLAUDE.md
  2. RUNPOD_DEPLOYMENT_CHECKLIST.md

    • FP32: Ready today (zero blockers)
    • QAT: Blocked (1-2 weeks)
    • Hardware requirements
  3. DATABASE_TEST_RACE_CONDITIONS.md

    • Why --test-threads=1 is mandatory
    • 3-phase fix (transaction rollback = best)

Strategic (Week 1)

  1. THRASHING_PREVENTION_STRATEGY.md

    • 6 quality gates (prevent 4th occurrences)
    • Week 1 smoke test (4-6 hours to implement)
  2. CLIPPY_FINAL_POLICY.md

    • End configuration thrashing
    • 40-minute migration plan
    • 3-tier strategy (deny/warn/allow)
  3. PRODUCTION_STABILITY_METRICS.md

    • Quantitative criteria for "stable"
    • Pass/fail checklist for runpod
    • Monitoring setup

Technical Deep-Dives (As Needed)

  1. QAT_BLOCKERS_ROOT_CAUSE_ANALYSIS.md (Agent 5 found this)

    • 3 P0 blockers explained
    • Why they recurred 3 times
    • Architectural fixes (Agents 6-7)
  2. CLAUDE_MD_ACCURACY_AUDIT.md (Agent 24)

    • 54% accurate (46% misleading)
    • "100% PRODUCTION READY" is false
    • What to trust, what to ignore

🚨 CRITICAL WARNINGS

⚠️ DO NOT Trust CLAUDE.md Blindly

CLAUDE.md says:

  • " PRODUCTION READY (100% complete)"
  • "All 0 critical blockers"
  • "QAT: 24/24 tests passing, 0 compilation errors"

Reality (Agent 24 audit):

  • QAT integration tests don't compile (11 errors)
  • 3 P0 QAT blockers documented (device, OOM, checkpointing)
  • Test pass rate unverified (blocked on backtesting fix)
  • FP32 models work (can deploy without QAT)

Accuracy: 54% (46% inaccurate)

⚠️ DO NOT Use Parallel Test Execution (Yet)

Database race conditions (Agent 5 identified):

  • 180 integration tests share same foxhunt database
  • Concurrent execution = UNIQUE constraint violations
  • TEMP table name collisions
  • Connection pool exhaustion

Solution TODAY: --test-threads=1 Solution WEEK 2: Transaction rollback (Agent 9 design, 5 hours to implement)

⚠️ DO NOT Deploy QAT Without GPU Validation

QAT Blockers (Agents 6-7 fixed 2/3):

  • Device mismatch - Fixed (CPU→CUDA transitions)
  • OOM recovery - Fixed (exponential backoff retry)
  • Gradient checkpointing - NOT IMPLEMENTED (requires ≥8GB GPU)

Can Deploy: FP32 models (work on 4GB GPU) Cannot Deploy: QAT TFT-225 (requires 8GB+ GPU or feature reduction)


🎯 SUCCESS CRITERIA

Today (3 Hours)

  • Backtesting examples compile (27 errors → 0)
  • Full test suite runs (--test-threads=1)
  • Actual pass rate documented (replace CLAUDE.md estimate)

Week 1 (Deploy FP32)

  • FP32 training on Runpod GPU
  • Baseline metrics established
  • 225-feature extraction validated
  • Agent 6+7 QAT fixes tested on real GPU

Week 2 (Stabilization)

  • Smoke test operational (Agent 25 Week 1 guide)
  • Clippy final policy applied (Agent 22 40-min migration)
  • Transaction rollback for tests (Agent 9 design)
  • QAT full validation (if 8GB+ GPU available)

💡 KEY INSIGHTS

The Problem We Solved Today

Before:

  • Going in circles (QAT 3x, clippy thrashing, doc drift)
  • Symptom fixes instead of root causes
  • No integration validation
  • Documentation 46% inaccurate

After (26 Agents):

  • Root causes documented (5 systemic issues)
  • Architectural fixes (not band-aids)
  • Prevention framework (quality gates + scripts)
  • Honest assessment (FP32 ready, QAT blocked)

The Path Forward

NO MORE CIRCLES:

  1. Quality gates enforce integration validation
  2. Root cause analysis mandatory (no quick fixes)
  3. Monthly retrospectives adjust thresholds
  4. Documentation synced with code (automated validation)

CLEAR PRIORITIES:

  1. TODAY: Fix backtesting → Run tests → Get real numbers
  2. WEEK 1: Deploy FP32 → Validate on GPU
  3. WEEK 2: Stabilization (smoke test, integration tests)
  4. MONTH 1: Production hardening (QAT, monthly retros)

📞 QUICK COMMANDS

Fix Backtesting

cd /home/jgrusewski/Work/foxhunt
# Add ToPrimitive import to backtesting examples
# Then verify:
cargo build --workspace --examples

Run Test Suite (Stable)

cargo test --workspace --no-fail-fast -- --test-threads=1 2>&1 | tee /tmp/test_results.txt
tail -100 /tmp/test_results.txt | grep "test result:"

Deploy FP32 to Runpod

# On runpod with 4GB+ GPU:
cargo run -p ml --example train_tft_parquet --release --features cuda -- \
  --parquet-file test_data/ES_FUT_180d.parquet --epochs 50

Check Current Status

cargo build --workspace --release  # Should succeed (5m 55s)
cargo clippy -p storage --all-targets -- -D warnings  # Should succeed (0 errors)

🚀 FINAL MESSAGE

You were right: We were going in circles.

We fixed it: 26 agents systematically addressed every root cause.

What's next: Stop planning, start doing.

  1. Fix backtesting (3 hours)
  2. Run tests (10 minutes)
  3. Deploy FP32 to Runpod (ready TODAY)

No more circles. No more thrashing. Let's ship. 🚀