Add agent-owned Dreams memory policy - #37
Conversation
Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Sorry @trotsky1997, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Other Top Model review requested via Multica WS-164, assigned to claude-wsl-opus. Review focus: agent-owned Dreams policy/state seam, skip reasons, input filtering/cap, decide_use adoption gate, config default/schema, and no-live-API boundary. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 767be9751d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| pub fn update(&mut self, status: DreamStatus, output_store_id: Option<impl Into<String>>) { | ||
| self.status = status; | ||
| if let Some(output_store_id) = output_store_id { | ||
| self.output_store_id = Some(output_store_id.into()); | ||
| } |
There was a problem hiding this comment.
Clear stale dream output when updates omit it
If a job is updated with an output while it is still running and a later completion update omits the output store, this branch leaves the previous output_store_id in place; adopt_output will then adopt that stale/partial store even though the completed update had no output. This contradicts the documented gate that completed jobs without an output store must not become active, so update should clear or replace the stored output when output_store_id is None for the new state.
Useful? React with 👍 / 👎.
| if sessions_since_last_dream < self.policy.min_sessions_between_dreams { | ||
| return ShouldDreamDecision::Skip(DreamSkipReason::NotEnoughSessions); | ||
| } | ||
| ShouldDreamDecision::Dream |
There was a problem hiding this comment.
Honor disabled generation before scheduling dreams
When a user or thread disables generate_memories, should_dream can still return Dream once the session count threshold is met, even though starting a dream creates a new generated memory store. This means the same policy knob that suppresses ordinary memory generation is bypassed for Dreams; the scheduler should skip when generation is disabled before allowing the agent to start synthesis.
Useful? React with 👍 / 👎.
| .filter(|candidate| { | ||
| !candidate.is_active | ||
| && candidate.session_duration >= self.policy.min_session_duration | ||
| }) |
There was a problem hiding this comment.
Exclude external-context sessions from dream inputs
When [memory] disable_on_external_context = true, a candidate that has has_external_context set still passes this filter and can be sent into a dream as long as it is inactive and long enough. Ordinary memory generation suppresses exactly that case via decide_generation, so Dreams can persist external-context material that the memory policy was configured to avoid; include the same external-context check when selecting inputs.
Useful? React with 👍 / 👎.
|
Reviewed PR #37 at commit Verdict: request changes before merge. The pure Dreams policy/state direction is right, and focused validation is green, but there are material policy/state bugs to fix:
Validation I ran locally from the PR snapshot:
CI is also green. Sourcery did not provide a usable review due to rate limiting; the GitHub Codex inline review flagged the same three issues above. |
87e1761 to
61884a9
Compare
Summary
memory_entry.rs.DreamScheduler, explicitShouldDreamDecision/DreamSkipReason, dream input selection with active/short filtering and the 100-session cap,DreamJob/DreamStatus, and adoption through the existingdecide_usegate.[memory] min_sessions_between_dreamswith default10, regenerate schema, update example config, archive the OpenSpec change, and document the generated-state/source-evidence boundary.Handoff Notes
Validation
cargo fmt --checkcargo test --test memory_entrycargo test --test memory_systemcargo test config::tests::memory_defaults_disabled_and_parses_aliasescargo testopenspec validate add-agent-owned-dreams-memory --strictopenspec validate --specs --strict