Skip to content

refactor(b09): mount STRATEGY_RUNTIME onto RunContext during cycles - #360

Merged
Pigbibi merged 1 commit into
mainfrom
codex/b09-pr2-strategy-runtime-runcontext
Oct 9, 2026
Merged

Pigbibi merged 1 commit into
mainfrom
codex/b09-pr2-strategy-runtime-runcontext

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

B09 PR-2 (after #359): mount activated STRATEGY_RUNTIME onto cycle-scoped RunContext while keeping behavior-equivalent module fallback.

Changes

  • run_context.py: resolve_strategy_runtime / set_active_strategy_runtime; strategy_runtime field is live (no longer reserved-only).
  • _activate_execution_strategy_runtime still updates module globals (compat), returns the handle, and writes ctx.strategy_runtime when a context is bound.
  • build_live_runtime stores the handle on ExecutionRuntime.strategy_runtime.
  • execute_cycle mounts that handle onto RunContext.
  • Cycle-path reads (evaluate / metrics / artifact candidates / periodic BTC display name) go through resolve_strategy_runtime(STRATEGY_RUNTIME).
  • Tests: isolation + activate-while-bound + metrics equivalence through bound resolve.

Explicitly unchanged (B04)

  • No edits to runtime_support submission / owner / runtime_call_client logic (field-only: strategy_runtime).
  • No LB-HK / Firstrade / QRS Environments / secrets / Cloud Run.
  • Module STRATEGY_RUNTIME symbol kept as unbound fallback (PR-3 can tighten).

Verification

.venv/bin/python -m unittest tests.test_run_context -v
.venv/bin/python -m unittest \
  tests.test_state_service \
  tests.test_trend_pool_loading \
  tests.test_cycle_service \
  tests.test_runtime_support \
  tests.test_cycle_replay_runtime \
  tests.test_strategy_runtime \
  tests.test_notify_i18n \
  -v

Local: all green (11 + 133).

Author: Pigbibi. No CloudAgent.

PR-2 of B09: activate still writes module STRATEGY_RUNTIME for unbound
fallback/compat, and also stores the handle on ExecutionRuntime plus
active RunContext. Cycle-path evaluate/metrics/artifact/display reads
go through resolve_strategy_runtime. No submission/owner changes.
@Pigbibi
Pigbibi merged commit 077a64c into main Oct 9, 2026
1 check passed
@Pigbibi
Pigbibi deleted the codex/b09-pr2-strategy-runtime-runcontext branch October 9, 2026 09:57
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