Repository navigation
fix(rsi): harden factor sandbox, governance split, RSI engine, council/crossover, and arena OOS (Rounds 7-11) - #29
Open
ZhuLinsen wants to merge 1 commit into
Conversation
…l/crossover, and arena OOS (Rounds 7-11)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed (Batch 3: Rounds 7–11)
src/alphaevo/alpha_factory/sandbox.py,factory.py):exec()in_build_indicator_fnwith AST/bytecodepreflight_code()+ 8-entry LRU cache (_df_cache_keysensitive to column/index dtypes,CategoricalDtypecategory order/dtypes, andobject-dtype Python element types)._SafeModuleProxy(np/pd/math) + persistentspawnworker with BLAS single-thread env caps,RLIMIT_AS, deep PIT row slicing (df.iloc[: idx + 1].copy(deep=True)), and PEP 578sys.addaudithookgated by_IN_FACTOR_EXEC.FactorSandbox.probe_pitthrough the hardenedspawnworker (instead of unhardenedfork).src/alphaevo/alpha_factory/governance.py,rsi/co_steer.py):_fwd_retcolumn leak from factor execution panels; implemented calendar-aligned purged train/OOS split with causal warmup (_SplitPanelData) + valid non-NaN forward-return horizon guards so disjoint/short calendars never auto-retire PIT-safe factors.FactorGovernanceEnginePIT checks throughself._sandbox.probe_pit; fixed signed IR (train_ic / train_ic_std,oos_ic / oos_ic_std).expected_directionpreservation, built-in/dynamic name collision guards, active-metric preservation, and retired-factor protection across LLM and offline Co-STEER synthesis.src/alphaevo/rsi/engine.py,alpha_factory/factor_store.py,strategy/store.py,reflection/experience.py):locked_holdout_pct > 0, non-starving candidate selection, unconditional order-invariant round-end DSR recomputation viaTrialLedger.compute_dsr_for_trials, post-refresh MAP-Elites archive insertion, atomicFactorStore.save_if_absent(ON CONFLICT DO NOTHING) beforemark_trial_accepted, and exception-safe transient L2 dynamic factor lease refcounting.timeout=30.0,WAL,busy_timeout=5000, andclose()/ context managers.src/alphaevo/rsi/council.py,crossover.py,reflection/mutator.py,rsi/mechanism.py):committee.overall_status == "fail"under overfit, fixed<= / <negative/zero relaxation math, and made configured CLI / LiteLLM prosecutors (includingALPHAEVO_API_KEYenv var beforeConfigManager.load()) fail closed.exit.triggers,stop_loss.conditions(Nonevs[]exact),Noneresets, sharedprune_dangling_exit_tunables, and sharedpromote_legacy_conditions_to_triggersacross crossover and mutator so audit replays match grafted children identically.EvaluationKernel/BacktestEngineexecution, OOS-only slicing, and market-derived null pool verification.src/alphaevo/arena/runner.py):>= 15pre-cutoff bars) strictly beforeshadow_start_date, preventingShadowLedgereff_endbaseline fallback and reportingshadow_verified = Falsewhen skipped or failed.Why
Eliminates lookahead leakage, sandbox escape vectors, premature factor retirement/reactivation races, proposal-order DSR skew, fail-open critic paths, and in-sample/OOS overlap across Levels 1–3 while keeping the L0 Truth Kernel (
src/alphaevo/truth/,src/alphaevo/evaluator/metrics.py) strictly untouched.Verification
.venv/bin/ruff format&.venv/bin/ruff check: All checks passed (0issues)..venv/bin/mypy src/: Success: no issues found in 135 source files..venv/bin/pytest -q: 1102 passed in 137.77s, 0 warnings (including dedicated Batch 3 hardening suites intests/unit/test_round7_to_11_sandbox_governance_rsi_arena_integrity.py).git diff --name-only main -- src/alphaevo/truth/ src/alphaevo/evaluator/metrics.pyis empty.OpenAI Codex CLI gpt-6.2-sol, final task-3387):LGTM.Risks
FactorSandbox.probe_pitvia persistentspawnworkers increases cold-start latency slightly on the first PIT call per worker, amortized by process reuse and LRU caching; tested on Linux and will be verified on Windows (windows-smoke) via CI.