#4556

feat(dream): wire up model_override for Dream consolidation

Opendajiaohuangwants to merge intofrom

Fixes #4029 — applies DreamConfig.model_override at runtime during periodic memory consolidation.

Activity

3
D
09d2b21
chengyongrureviewed4mo ago
chengyongru4mo ago

Automated PR review by nanobot. This is not a human maintainer review or approval.

This PR wires up the model_override field in DreamConfig (already present in schema as "pending implementation") in the CLI Dream cron path. Before Dream runs, it swaps agent.model to the override; in finally, it restores the saved model.

What's done well

  • The save/restore logic is symmetric: if dream_model: guards both the set and restore, so no-op when unconfigured.
  • try/finally ensures restoration even if Dream throws.
  • Uses the existing schema field — no schema change needed.

No blocking issues found. One minor observation: agent.model = dream_model is a direct string assignment that bypasses any provider-level model validation. If the override string doesn't match a configured provider model, the error surfaces at API-call time during Dream rather than at config load. This is acceptable given model_override is already validated as a string in the schema.