Skip to content

Add strategy governance lifecycle controls#165

Merged
Pigbibi merged 3 commits into
mainfrom
codex/strategy-governance-console-20260706
Jul 5, 2026
Merged

Add strategy governance lifecycle controls#165
Pigbibi merged 3 commits into
mainfrom
codex/strategy-governance-console-20260706

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add lifecycle/gate fields to platform strategy profiles and generated console assets.
  • Enforce live/research/paper switching rules in backend settings generation and Worker validation.
  • Align defaults to runtime-enabled strategies, especially Binance live pool rotation, and expand generated profile assets.

Validation

  • python3 python/scripts/build_config.py --check
  • python3 -m unittest python/tests/test_runtime_settings.py
  • python3 -m unittest discover -s python/tests -v
  • node tests/strategy_switch_worker_validation.mjs
  • node tests/test_cash_financing.js
  • git diff --check origin/main...HEAD

Co-Authored-By: Codex <noreply@openai.com>
@cursor

cursor Bot commented Jul 5, 2026

Copy link
Copy Markdown

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.

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

🤖 Codex PR Review

⚠️ Human review required: The Codex review could not be completed.

No Codex service URL or API key configured. Set CODEX_AUDIT_SERVICE_URL, ANTHROPIC_API_KEY, or OPENAI_API_KEY.

Please ensure a human reviewer checks this PR before merging.

Co-Authored-By: Codex <noreply@openai.com>
@cursor

cursor Bot commented Jul 5, 2026

Copy link
Copy Markdown

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>
@cursor

cursor Bot commented Jul 5, 2026

Copy link
Copy Markdown

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +1342 to +1343
} else if (allowedModes.length && !allowedModes.includes(executionMode)) {
throw new Error(`strategy ${inputs.strategy_profile} does not allow ${executionMode} execution`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +1333 to +1334
if (strategy.runtime_enabled !== true || strategy.can_switch_live === false) {
throw new Error(`strategy ${inputs.strategy_profile} is not live-enabled`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +417 to +418
if execution_mode != "live":
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@Pigbibi Pigbibi merged commit 322ab72 into main Jul 5, 2026
16 of 19 checks passed
@Pigbibi Pigbibi deleted the codex/strategy-governance-console-20260706 branch July 5, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant