fix(orchestrator): escludi prompt_library dal config_dict JSON

PromptLibrary e' un frozen dataclass non JSON-serializable. Quando passata in
cfg.prompt_library e poi spread via **cfg.__dict__ in config_dict, faceva
fallire repo.create_run() con TypeError al primo run dopo refactor.

Fix: filtra cfg.__dict__ escludendo prompt_library, e salva separatamente la
lista degli stili (prompt_library_styles) per reproducibility.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Adriano Dal Pastro
2026-05-16 13:21:08 +00:00
parent 9742df3a1f
commit 220e510d5e
2 changed files with 7 additions and 143 deletions
@@ -112,10 +112,16 @@ def run_phase1(
repo = Repository(cfg.db_path)
repo.init_schema()
# Escludi prompt_library (PromptLibrary dataclass non e' JSON-serializable);
# salva solo i nomi degli stili per reproducibility.
config_dict = {
**cfg.__dict__,
**{k: v for k, v in cfg.__dict__.items() if k != "prompt_library"},
"db_path": str(cfg.db_path),
"model_tier": cfg.model_tier.value,
"prompt_library_styles": (
list(cfg.prompt_library.cognitive_styles)
if cfg.prompt_library is not None else None
),
}
run_id = repo.create_run(name=cfg.run_name, config=config_dict)
@@ -1,142 +0,0 @@
{
"rules": [
{
"condition": {
"op": "and",
"args": [
{
"op": "gt",
"args": [
{
"kind": "indicator",
"name": "rsi",
"params": [
14
]
},
{
"kind": "literal",
"value": 70.0
}
]
},
{
"op": "gt",
"args": [
{
"kind": "indicator",
"name": "atr",
"params": [
14
]
},
{
"kind": "indicator",
"name": "sma",
"params": [
14
]
}
]
},
{
"op": "gt",
"args": [
{
"kind": "feature",
"name": "hour"
},
{
"kind": "literal",
"value": 9
}
]
},
{
"op": "lt",
"args": [
{
"kind": "feature",
"name": "hour"
},
{
"kind": "literal",
"value": 17
}
]
}
]
},
"action": "entry-short"
},
{
"condition": {
"op": "and",
"args": [
{
"op": "lt",
"args": [
{
"kind": "indicator",
"name": "rsi",
"params": [
14
]
},
{
"kind": "literal",
"value": 30.0
}
]
},
{
"op": "lt",
"args": [
{
"kind": "indicator",
"name": "atr",
"params": [
14
]
},
{
"kind": "indicator",
"name": "sma",
"params": [
14
]
}
]
},
{
"op": "gt",
"args": [
{
"kind": "feature",
"name": "hour"
},
{
"kind": "literal",
"value": 9
}
]
},
{
"op": "lt",
"args": [
{
"kind": "feature",
"name": "hour"
},
{
"kind": "literal",
"value": 17
}
]
}
]
},
"action": "entry-long"
}
]
}