fix(cron): add per-job memory_enabled override for memory provider access - #66775
Closed
eulahwu917 wants to merge 2 commits into
Closed
fix(cron): add per-job memory_enabled override for memory provider access#66775eulahwu917 wants to merge 2 commits into
eulahwu917 wants to merge 2 commits into
Conversation
…cess Cron sessions have always passed skip_memory=True to AIAgent to prevent cron system prompts from polluting user representations. This is correct for most jobs (daily briefings, reports, watchdogs) but blocks cron jobs whose entire purpose is memory maintenance (e.g. memory dump/filing via the hindsight provider). Add a memory_enabled field to the job schema following the existing attach_to_session pattern: - cron/jobs.py: add memory_enabled parameter to create_job() — persisted only when explicitly set as a bool, keeping existing jobs byte-identical. - cron/scheduler.py: make skip_memory conditional: not bool(job.get( "memory_enabled")). Default remains True (backward compatible). - tools/cronjob_tools.py: surface memory_enabled in both create and update paths of the cronjob tool. - AGENTS.md: document the override mechanism. Backward compatible: existing cron jobs are unaffected (absence of the key means skip_memory=True, the existing behavior). Only jobs that explicitly opt in gain memory access.
Collaborator
…andler plumbing) Reviewer approved-with-revisions on PR NousResearch#66775 — the feature was correct but lacked test coverage. Add 12 tests following the test_cron_workdir.py pattern, covering: 1. create_job() param plumbing for memory_enabled (True/False/None stored) 2. default-None preservation (no key written to jobs.json when unset) 3. run_job's skip_memory wiring: - memory_enabled=true -> skip_memory=False (memory active) - memory_enabled=false -> skip_memory=True (memory off, explicit) - memory_enabled unset -> skip_memory=True (backward compat default) 4. cronjob tool create/update JSON round-trip for memory_enabled While writing the tests, found and fixed two gaps: - registry handler was NOT forwarding memory_enabled to cronjob() - CRONJOB_SCHEMA lacked memory_enabled property - _format_job never surfaced memory_enabled when truthy
Author
|
Reviewer — test coverage added per your revision request (12 new tests in `tests/cron/test_cron_memory_enabled.py`).\n\nWhile writing the tests, I also found and fixed 3 gaps in the original PR:\n- registry handler was not forwarding `memory_enabled` to `cronjob()` — tool schema calls would silently ignore it\n- CRONJOB_SCHEMA lacked the `memory_enabled` property\n- _format_job never surfaced `memory_enabled` when truthy\n\nAll 33 tests pass (21 existing workdir tests + 12 new memory_enabled tests, no regressions).\n\nReady for final review/merge. |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Cron sessions pass
skip_memory=TruetoAIAgent, which prevents all cron jobs from using the memory tool or the external memory provider (e.g., hindsight). This is correct for most jobs (daily briefings, reports) but blocks cron jobs whose entire purpose is memory maintenance — likebepop-hindsight-memory-dump.Root Cause
cron/scheduler.pyhardcodedskip_memory=Trueat theAIAgentconstruction site (~line 3073). The memory provider plugin andMemoryStoreare never initialized whenskip_memory=True(agent/agent_init.py, lines 1335-1419), so thememorytool always returns\"Memory is not available.\"in cron sessions.Fix
Add a per-job
memory_enabledoverride following the same pattern asattach_to_session(already used in the codebase to opt cron jobs into session delivery):cron/scheduler.pyskip_memory=not bool(job.get(\"memory_enabled\"))— defaultsTrue(backward compatible)cron/jobs.pymemory_enabled: Optional[bool] = Nonetocreate_job(); persist only when explicitly set asbooltools/cronjob_tools.pymemory_enabledin both create and update paths of thecronjobtoolAGENTS.mdBackward Compatibility
job.get("memory_enabled")returnsNone→skip_memory=True(existing behavior).memory_enabledis only persisted when explicitlyTrueorFalse, keeping existingjobs.jsonentries byte-identical.