Skip to content

feat: make runtime settings market aware - #194

Merged
Pigbibi merged 5 commits into
mainfrom
codex/runtime-hardening-qrs-20260730
Jul 30, 2026
Merged

feat: make runtime settings market aware#194
Pigbibi merged 5 commits into
mainfrom
codex/runtime-hardening-qrs-20260730

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • model market calendar, timezone, session close, and execution windows per runtime target instead of applying one US-weekday rule globally
  • derive runtime timing from the selected strategy/profile metadata so multi-strategy platforms remain switch-safe
  • make manual switch validation fail closed on partial or contradictory market metadata while retaining legacy no-metadata compatibility
  • update the strategy-switch worker, schema, examples, generated console assets, and operator documentation together

Validation

  • platform config and runtime target validation: passed
  • Python tests: 116 passed
  • strategy-switch worker validation and JavaScript syntax checks: passed
  • generated asset diff check: clean
  • git diff --check

Pigbibi and others added 2 commits July 30, 2026 12:49
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>

@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: e09ff0a347

ℹ️ 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 thread python/scripts/runtime_settings.py
Comment thread python/scripts/build_runtime_switch.py Outdated
Co-Authored-By: Codex <noreply@openai.com>

@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


P2 Badge Force QMT switches to remain dry-run only

When platform=qmt is selected, the form still defaults execution_mode to live, and neither the workflow safety gate nor validate_target enforces QMT's configured dry_run_only=true and live_configured=false. For cn_industry_etf_rotation, which permits live execution, an apply run therefore validates successfully and writes execution_mode=live, dry_run_only=false, and QMT_DRY_RUN_ONLY=false, despite QMT being marked not_wired; reject live QMT switches or force paper/dry-run before allowing writes.

ℹ️ 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".

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

@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: e4d0c129d8

ℹ️ 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 thread web/strategy-switch-console/worker.js
@Pigbibi
Pigbibi enabled auto-merge (squash) July 30, 2026 06:01
Co-Authored-By: Codex <noreply@openai.com>
@Pigbibi

Pigbibi commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Also addressed the QMT live-mode review in 9271e6a: runtime target validation now rejects live execution whenever the platform deployment declares live_configured=false. QMT dry-run targets remain valid; the new regression test confirms live QMT targets fail before variable writes.

@Pigbibi
Pigbibi merged commit 407223c into main Jul 30, 2026
7 checks passed
@Pigbibi
Pigbibi deleted the codex/runtime-hardening-qrs-20260730 branch July 30, 2026 06:06

@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: 9271e6a53e

ℹ️ 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".


function usesServiceTargetsAsRuntimeSource(platform) {
return platform === "ibkr";
return ["ibkr", "schwab", "firstrade"].includes(platform);

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 Read LongBridge inventories for repository-scoped switches

When a LongBridge switch explicitly uses variable_scope=repository and CLOUD_RUN_SERVICE_TARGETS_JSON already exists, the inspected manual workflow fetches and patches that inventory, and build_switch_target emits only the patched inventory rather than direct RUNTIME_TARGET_JSON/STRATEGY_PROFILE assignments. Because this predicate excludes LongBridge, the console never reads the updated source and continues showing the previous environment/direct-variable strategy; include LongBridge here or reject repository-scoped LongBridge switches.

Useful? React with 👍 / 👎.

Comment on lines 472 to +479
execution_mode = str(runtime_target.get("execution_mode") or "").strip().lower()
deployment = platform.get("deployment", {}) if isinstance(platform, dict) else {}
if (
execution_mode == "live"
and isinstance(deployment, dict)
and deployment.get("live_configured") is False
):
errors.append(f"platform {platform_id} has no live runtime configuration")

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 Enforce disabled live platforms before profile lookup

When a hand-authored target uses an uncatalogued strategy profile, the early return above this new check skips the live_configured gate entirely. For example, a QMT target with strategy_profile="unknown_profile", execution_mode="live", and dry_run_only=false currently passes validate_target with no errors and can be applied, despite QMT being declared to have no live configuration; perform the platform-level live check before returning for an unknown strategy.

Useful? React with 👍 / 👎.

Comment on lines +687 to +699
for name, value in repository_variables.items():
if name in GENERATED_VARIABLES:
errors.append(f"repository_variables.{name} duplicates a generated variable")
if name in extra_variable_names:
errors.append(f"repository_variables.{name} duplicates extra_variables.{name}")
if name in RESEARCH_ONLY_EXTRA_VARIABLES:
errors.append(
f"repository_variables.{name} is research-only and must not be stored in live switch settings"
)
if is_secret_variable_name(name):
errors.append(f"repository_variables.{name} looks like a secret and must not be stored here")
if isinstance(value, str) and "\n" in value:
errors.append(f"repository_variables.{name} must be a single-line value")

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 Validate dry-run flags in repository variables

When a hand-authored target places a platform dry-run flag in the newly supported repository_variables, this validator omits the consistency check that validate_extra_variables applies. A Schwab target with execution_mode="paper", dry_run_only=true, and repository_variables.SCHWAB_DRY_RUN_ONLY="false" therefore validates and renders contradictory assignments, allowing consumers of the platform-specific flag to run with live behavior; apply the same platform dry-run consistency validation here or restrict this field to the service inventory variable.

Useful? React with 👍 / 👎.

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