Add platform health monitor#167
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 733e790654
ℹ️ 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".
| catalog = _strategy_catalog_by_profile(strategy_catalog) | ||
| config_errors = validate(config) | ||
| default_profile_errors = report_default_strategy_profile_drift(config, catalog) | ||
| derivation_errors = report_strategy_profile_derivation_drift(config, catalog) |
There was a problem hiding this comment.
Preserve health report output when config schema fails
If platform-config.json has a schema error that validate() already detects, such as a strategy missing domain, this unconditional derivation check still calls strategy_to_json_compat() and raises KeyError before any health-report JSON is emitted. In the scheduled workflow that turns the actionable validation messages into only report_missing, so the repair issue loses the context this monitor is meant to provide; skip derivation when schema validation fails or make it tolerate incomplete strategy entries.
Useful? React with 👍 / 👎.
| node --check --input-type=module < web/strategy-switch-console/page_asset.js | ||
| node --check --input-type=module < web/strategy-switch-console/strategy_profiles_asset.js | ||
| node --check --input-type=module < web/strategy-switch-console/app_css.js | ||
| node --check --input-type=module < web/strategy-switch-console/app_js.js |
There was a problem hiding this comment.
Check the served app script, not only its wrapper
app_js.js is a generated module that exports the contents of web/strategy-switch-console/app.js as a string, so this node --check only validates the wrapper syntax. A syntax error in the actual served /app.js would still break the strategy switch console in browsers while this scheduled monitor passes; add a direct check of web/strategy-switch-console/app.js or pipe that source into node --check.
Useful? React with 👍 / 👎.
| }, | ||
| { | ||
| "name": "live_candidate_queue", | ||
| "status": "warn" if live_candidate_queue else "pass", |
There was a problem hiding this comment.
Fail live-candidate profiles that become live-switchable
For a live_candidate/shadow_candidate profile that is accidentally made live-switchable (runtime_enabled: true, can_switch_live: true, live included in allowed_execution_modes, and no blocked_live_reason), the health report still treats the queue as only a warning and exits 0, so the scheduled workflow will not open a repair issue. This matters because the Worker live gate checks those switch fields but not lifecycle_stage, so the guardrail in the report should fail candidates that are already live-enabled rather than only counting them for review.
Useful? React with 👍 / 👎.
| """Report whether the generated strategy profile catalog drifts from platform-config.json.""" | ||
| expected = strategy_to_json_compat(config.get("strategies", {})) | ||
| expected_by_profile = {entry["profile"]: entry for entry in expected} | ||
| catalog = _strategy_catalog_by_profile(strategy_catalog) |
There was a problem hiding this comment.
Detect duplicate strategy profiles before collapsing
When strategy-profiles.example.json contains the same profile twice, this conversion collapses the list to a dict before the derivation checks run. If the first entry is stale or unsafe and a later duplicate matches platform-config.json, the report passes even though the Worker keeps the first duplicate when normalizing profiles, so the served switch catalog can still use the stale gate fields; detect duplicate profiles against the raw list before comparing the collapsed catalog.
Useful? React with 👍 / 👎.
Summary
Test Plan