Add strategy governance lifecycle controls#165
Conversation
Co-Authored-By: Codex <noreply@openai.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
🤖 Codex PR ReviewPlease ensure a human reviewer checks this PR before merging. |
Co-Authored-By: Codex <noreply@openai.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Co-Authored-By: Codex <noreply@openai.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b776110326
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else if (allowedModes.length && !allowedModes.includes(executionMode)) { | ||
| throw new Error(`strategy ${inputs.strategy_profile} does not allow ${executionMode} execution`); |
There was a problem hiding this comment.
Allow dry_run-only profiles through paper-mode switches
When a profile is configured with allowed_execution_modes: ["dry_run"] (several of the newly added research profiles are), the console/worker can still only submit live or paper because normalizeSwitchInputs rejects dry_run; this direct comparison therefore rejects the paper-mode request as does not allow paper execution. That makes the new dry-run-only profiles impossible to dispatch or sync from the strategy switch console unless paper is treated as satisfying dry_run (or the worker accepts dry_run).
Useful? React with 👍 / 👎.
| if (strategy.runtime_enabled !== true || strategy.can_switch_live === false) { | ||
| throw new Error(`strategy ${inputs.strategy_profile} is not live-enabled`); |
There was a problem hiding this comment.
Enforce lifecycle gates before dispatching live switches
For live switches this server-side gate only rejects runtime_enabled=false, can_switch_live=false, missing live mode, or an explicit blocked_live_reason, but the same payload now accepts lifecycle_stage, latest_evidence_status, and plugin_gate_status. If an admin/KV strategy profile has runtime_enabled=true and can_switch_live=true while lifecycle_stage is still research_backtest_only or evidence/plugin status is blocked, /api/switch still dispatches a live run even though the Python validator and UI treat those fields as live gates.
Useful? React with 👍 / 👎.
| if execution_mode != "live": | ||
| return |
There was a problem hiding this comment.
Reject live targets on dry-run-only platforms
When a platform is marked dry-run-only, this live path still only checks the strategy policy and never checks the platform deployment policy. For example, changing examples/targets/qmt/industry_etf_dry_run.example.json to execution_mode=live and dry_run_only=false validates with no errors, so the manual workflow can generate live QMT runtime settings even though the worker UI explicitly rejects QMT live execution.
Useful? React with 👍 / 👎.
Summary
Validation
python3 python/scripts/build_config.py --checkpython3 -m unittest python/tests/test_runtime_settings.pypython3 -m unittest discover -s python/tests -vnode tests/strategy_switch_worker_validation.mjsnode tests/test_cash_financing.jsgit diff --check origin/main...HEAD