Skip to content

Sync switch config after strategy changes#32

Merged
Pigbibi merged 1 commit into
mainfrom
codex/sync-switch-config-after-dispatch
Jun 9, 2026
Merged

Sync switch config after strategy changes#32
Pigbibi merged 1 commit into
mainfrom
codex/sync-switch-config-after-dispatch

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • sync the selected account's default_strategy_profile back into Worker KV after a successful web switch dispatch
  • add a token-protected Worker internal sync endpoint for the manual GitHub workflow callback after platform variables are applied
  • always render empty *_STRATEGY_PLUGIN_MOUNTS_JSON payloads so switching to strategies without plugin mounts clears stale plugin config
  • allow account matching against derived platform defaults from generated runtime targets

Validation

  • build_runtime_switch LongBridge SG SOXL render includes empty LONGBRIDGE_STRATEGY_PLUGIN_MOUNTS_JSON
  • node --check --input-type=module < web/strategy-switch-console/worker.js
  • embedded workflow Python syntax check
  • node --experimental-default-type=module tests/strategy_switch_worker_validation.mjs
  • python3 scripts/runtime_settings.py validate
  • python3 -m unittest discover -s tests -v
  • git diff --check

@Pigbibi Pigbibi merged commit 5188004 into main Jun 9, 2026
2 checks passed
@Pigbibi Pigbibi deleted the codex/sync-switch-config-after-dispatch branch June 9, 2026 10:46

@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: 1192c30b37

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

CONFIRM_APPLY: ${{ inputs.confirm_apply }}
PLATFORM_SYNC_WORKFLOW: ${{ inputs.platform_sync_workflow }}
STRATEGY_SWITCH_CONSOLE_URL: ${{ vars.STRATEGY_SWITCH_CONSOLE_URL }}
STRATEGY_SWITCH_SYNC_TOKEN: ${{ secrets.STRATEGY_SWITCH_SYNC_TOKEN || secrets.RUNTIME_SETTINGS_GH_TOKEN }}

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 Use the Worker sync token for workflow callbacks

When STRATEGY_SWITCH_CONSOLE_URL is configured but the new STRATEGY_SWITCH_SYNC_TOKEN secret is omitted, this fallback sends RUNTIME_SETTINGS_GH_TOKEN to /api/internal/sync-account-default. The Worker validates against env.STRATEGY_SWITCH_SYNC_TOKEN || env.RUNTIME_SETTINGS_DISPATCH_TOKEN, and the README documents the Worker-side default as RUNTIME_SETTINGS_DISPATCH_TOKEN, so the documented optional-secret setup will get a 401 after applying variables and the workflow will fail instead of syncing account defaults. Either require the sync secret explicitly here or fall back to the same dispatch token value the Worker expects.

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