[codex] add strategy lifecycle CLI#160
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17b51a082b
ℹ️ 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".
| for step in steps: | ||
| _print(f"[lifecycle] Step: {step}") | ||
| _print(f"[lifecycle] -> {step} complete") |
There was a problem hiding this comment.
Run the lifecycle steps instead of only logging completion
When a schedule invokes the new quant-lifecycle lifecycle command, this handler only prints each step as complete and returns success; it never calls run_monitor, run_drift_detection, optimization, or build_dashboard. That makes the advertised “full lifecycle pipeline” a no-op while still exiting 0, so production jobs can silently skip snapshot generation, drift checks, and dashboard updates.
Useful? React with 👍 / 👎.
| "quant_platform_kit.strategy_lifecycle.drift_detector", | ||
| "run_drift_detection", | ||
| ) | ||
| results = run_drift_detection(domain=args.domain, strategy_profile=args.strategy) |
There was a problem hiding this comment.
Publish drift alerts from the drift command
For direct schedules that run quant-lifecycle drift, this only calls run_drift_detection, which saves drift results but does not build or publish notification events; the existing alert path is in strategy_lifecycle.drift_alerts (build_drift_alert/publish_drift_alerts). Because the new subcommand help says it emits alerts, operators can end up with critical/review drift persisted but no Telegram/email/webhook alert sent.
Useful? React with 👍 / 👎.
| ) | ||
| result = process_update(proposal_path=args.proposal, auto_approve=args.auto_approve) | ||
| _print(f"[update] Result: stage={result.get('stage')}, reason={result.get('reason', '')}") | ||
| return 0 |
There was a problem hiding this comment.
Return non-zero when update processing reports an error
If process_update returns an error result instead of raising, this command still exits successfully. For example, process_update returns {"stage": "error", ...} for proposal sources it cannot load such as gs:// paths, so a scheduled quant-lifecycle update can be marked successful even though no proposal was applied; map at least stage == "error" to a non-zero exit code.
Useful? React with 👍 / 👎.
- Add quant-lifecycle console script backed by QuantPlatformKit lifecycle modules - Keep the CLI dependency-free by using argparse - Cover command delegation and compatibility wrapper behavior Co-Authored-By: Codex <noreply@openai.com>
17b51a0 to
12b02be
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12b02be4bc
ℹ️ 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".
| drift_status = _run_drift( | ||
| argparse.Namespace( | ||
| domain=args.domain, | ||
| strategy=None, |
There was a problem hiding this comment.
Propagate the lifecycle strategy filter
When a domain schedule runs quant-lifecycle lifecycle --domain us_equity --strategy foo, this hard-codes the drift stage to strategy=None (and the monitor stage above does the same), so the lifecycle still processes and can publish drift alerts for every strategy in the domain while only optimizing foo. The standalone monitor and drift commands already pass --strategy through, so a strategy-scoped lifecycle run can produce unrelated snapshots/alerts and extra work; pass args.strategy into these stages or clarify/remove the option.
Useful? React with 👍 / 👎.
Summary
quant-lifecycleconsole script as the shared strategy lifecycle CLI.argparseto avoid a new production dependency.Validation
python3 -m pytest tests/test_lifecycle_cli.py tests/test_lifecycle_drift.py tests/test_lifecycle_reviewer.py -qpython3 -m ruff check src/quant_platform_kit/strategy_lifecycle/cli.py tests/test_lifecycle_cli.pyPYTHONPATH=src python3 -m quant_platform_kit.strategy_lifecycle.cli --helpquant-lifecycle --helpfrom a temporary venvgit diff --check