Merge pull request #131 from AKhozya/feat/preferences-cli-wiring
feat: wire documented --preferences flag through CLI/config into the backend
This commit is contained in:
@@ -91,6 +91,8 @@ def _add_common(p: argparse.ArgumentParser) -> None:
|
||||
p.add_argument("--progress", action="store_true",
|
||||
help="print phase progress to stderr")
|
||||
p.add_argument("--auto-adopt", action="store_true")
|
||||
p.add_argument("--preferences", default="",
|
||||
help="free-text house rules injected into the optimizer's reflect step")
|
||||
p.add_argument("--json", action="store_true")
|
||||
|
||||
|
||||
@@ -118,6 +120,8 @@ def _cfg_from_args(args, task_meta: Dict[str, Any] | None = None) -> Any:
|
||||
overrides["lookback_hours"] = lh
|
||||
if getattr(args, "edit_budget", 0):
|
||||
overrides["edit_budget"] = args.edit_budget
|
||||
if getattr(args, "preferences", ""):
|
||||
overrides["preferences"] = args.preferences
|
||||
if getattr(args, "max_sessions", 0):
|
||||
overrides["max_sessions_per_night"] = args.max_sessions
|
||||
if getattr(args, "max_tasks", 0):
|
||||
|
||||
@@ -41,6 +41,7 @@ DEFAULTS: Dict[str, Any] = {
|
||||
"gate_mode": "on", # "on" (validation-gated) | "off" (greedy, no hard filter)
|
||||
"codex_path": "", # "" => auto-detect the real @openai/codex binary
|
||||
"edit_budget": 4, # textual learning rate (max edits/night)
|
||||
"preferences": "", # free-text house rules injected into reflect as a prior
|
||||
"gate_metric": "mixed", # hard | soft | mixed (mixed best for tiny holdouts)
|
||||
"gate_mixed_weight": 0.5,
|
||||
"replay_mode": "mock", # "mock" (sandboxed prompt) | "fresh" (worktree)
|
||||
|
||||
@@ -120,6 +120,7 @@ def run_sleep_cycle(
|
||||
codex_path=cfg.get("codex_path", ""),
|
||||
project_dir=project,
|
||||
)
|
||||
backend.preferences = cfg.get("preferences", "")
|
||||
_progress(cfg, f"night {night}: project={project} backend={backend.name}")
|
||||
|
||||
# ── live skill/memory docs ───────────────────────────────────────────
|
||||
|
||||
@@ -199,6 +199,7 @@ class TestHarvest(unittest.TestCase):
|
||||
"max_sessions": 5,
|
||||
"max_tasks": 3,
|
||||
"target_skill_path": ".agents/skills/taste-skill/SKILL.md",
|
||||
"preferences": "Always use async/await",
|
||||
"progress": True,
|
||||
"auto_adopt": False,
|
||||
})
|
||||
@@ -206,6 +207,7 @@ class TestHarvest(unittest.TestCase):
|
||||
cfg = _cfg_from_args(Args())
|
||||
|
||||
self.assertEqual(cfg.get("backend"), "codex")
|
||||
self.assertEqual(cfg.get("preferences"), "Always use async/await")
|
||||
self.assertEqual(cfg.get("max_sessions_per_night"), 5)
|
||||
self.assertEqual(cfg.get("max_tasks_per_night"), 3)
|
||||
self.assertTrue(cfg.get("progress"))
|
||||
|
||||
Reference in New Issue
Block a user