Persist strategy change to DB when restarting an existing run
When start_strategy is called with a new strategy on an active run, update strategy_config in DB before building engine config so the new strategy is used both now and on future resumes/restarts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dd2b9480d3
commit
5dce19c7d8
@ -571,6 +571,12 @@ def start_strategy(req, user_id: str):
|
|||||||
}
|
}
|
||||||
if engine_external:
|
if engine_external:
|
||||||
return {"status": "already_running", "run_id": running_run_id}
|
return {"status": "already_running", "run_id": running_run_id}
|
||||||
|
# If caller explicitly passes a strategy, update the saved config so
|
||||||
|
# both the engine and future resumes use the new strategy.
|
||||||
|
req_strategy = getattr(req, "strategy_name", None) if req is not None else None
|
||||||
|
if req_strategy and req_strategy != running_cfg.get("strategy"):
|
||||||
|
running_cfg["strategy"] = req_strategy
|
||||||
|
save_strategy_config(running_cfg, user_id, running_run_id)
|
||||||
engine_config = _build_engine_config(user_id, running_run_id, req)
|
engine_config = _build_engine_config(user_id, running_run_id, req)
|
||||||
if engine_config:
|
if engine_config:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user