Repository navigation
refactor(memory): retire memory-maintenance-job and its dead pipeline - #23705
Conversation
David (2026-10-26): retire no-longer-active logic so future agents are not misled. Required intake moved inline at write time with Dream's sweep as retry/backlog owner (lane memreq); the daily sweep and knowledge-ledger drain were already retired (DEC-MEM-002, DEC-FREE-006). memory-maintenance-job was dev-only and never served production. Deleted: - backend/modal/memory_maintenance_job.py + Dockerfile (job entrypoint) - backend/utils/memory/canonical_short_term_maintenance_cron.py (its engine; no non-test importer once the job is gone) - .github/workflows/gcp_memory_maintenance_job.yml and _auto_dev.yml (the auto-dev workflow redeployed the dead job on every main push) - dev scheduler entry memory-maintenance-hourly (backend/deploy/scheduler/jobs.yaml) - backend/scripts/validate_memory_maintenance_scheduler.py (+ test) - backend/scripts/legacy_memory_retirement_readiness.py (+ test + fixtures), the one-time DELETE-AFTER: INV-MEM-6 tool whose purpose this completes - MEMORY_MAINTENANCE_CAPTURED_AFTER window (#23674; merged but never used): flag rows, env declarations, maintenance_captured_after() and the captured_after query params in canonical_required_processing/ canonical_consolidation (default was empty = inert) - MEMORY_CANONICAL_MAINTENANCE_ENABLED flag rows, manifest env entries and backend-listen chart entries Kept: canonical_required_processing (inline intake + Dream retry reuse it, per memreq coordination), canonical_consolidation (live via process_conversation), short_term_promotion + memory_outbox_worker (e2e lifecycle contract and dev-harness callers), the shared memory-maintenance-scheduler service accounts (day3-reengagement uses them in dev and prod), and all stored Firestore data. Runtime-env validation now refuses reintroduction (_validate_memory_job_retirement): no memory-maintenance-job manifest block, no MEMORY_CANONICAL_MAINTENANCE_ENABLED / MEMORY_MAINTENANCE_CAPTURED_AFTER on any job or surface, notifications-job keeps no memory bindings. Orphaned duties flagged for follow-up (never live in prod, were dev-only): deterministic TTL settling, rotating canonical-outbox drains, and already-enqueued recurrence delivery now have no scheduled owner; required intake is covered inline + Dream. See data/run-2026-10-26-memretire/REPORT.md (workspace repo) for the cloud retirement list the lead executes (dev schedulers/jobs; prod verified clean). Invariants: INV-DATA-1 (workflow deletion is code retirement only; no data read or mutation). INV-MEM-4 (runtime_env.yaml regenerated from sources after removing the job block and flag entries; receipts unchanged).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…emreq wiring; retire the switch from universal-memory-operations and .env.template Luna r1 (FIX-FIRST) findings addressed: - P1: dream-agent.md and canonical_memory_architecture.md now state the inline required-intake + Dream-retry target as lane memreq's in-flight wiring with an explicit merge-order note, and name the interim truth (pending items have no scheduled retry anywhere — identical to production's status quo) with the anx tracking step (memretire-orphaned-duties). - P2: universal-memory-operations.md no longer documents MEMORY_CANONICAL_MAINTENANCE_ENABLED as a control or rollback lever (incident actions now pause the Dream sweep Scheduler instead); backend/.env.template drops the retired variable and says validation rejects it.
|
Luna r1 (FIX-FIRST) — both findings addressed in 0fafe95: P1 (inline/Dream retry not wired): Correct observation — that wiring is lane P2 (universal-memory-operations.md + .env.template still taught the retired Not a behavior change: both fixes are documentation/template truthfulness; the code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bbe6795f70
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| text = text.replace("frame-request-retention-job", job_name) | ||
| text = text.replace("frame_request_retention_job", module_name) | ||
| text = text.replace("frame-request-retention-hourly", f"{job_name}-schedule") |
There was a problem hiding this comment.
Retarget the Scheduler identity in generated job workflows
When scaffolding a job with its own Scheduler service account, the generated workflow still binds SCHEDULER_SERVICE_ACCOUNT to vars.FRAME_REQUEST_RETENTION_SCHEDULER_SERVICE_ACCOUNT. The substitutions rename the Scheduler manifest lookup to the new job, but leave this retention-specific variable unchanged. Consequently, the generated Grant the declared Scheduler identity access to run this job step rejects the new job's declared account (or fails its nonempty check if the retention variable is unset), after the Cloud Run deployment has already occurred. Retarget this binding to a job-specific variable or derive the account from the selected Scheduler manifest entry.
Useful? React with 👍 / 👎.
Keeps #23710's inline required-memory intake wiring intact: the captured_after/captured_before/cursor pagination params on list_pending_required_processing_items, list_receipted_required_processing_items, Dream completion/retry ownership in canonical_consolidation, the inline-intake registry/env rows, and the runbook/AGENTS ownership pointers. Keeps #23705's retirement intact: memory-maintenance-job manifest blocks and workflows stay deleted, MEMORY_MAINTENANCE_CAPTURED_AFTER (helper, env rows, call sites) and MEMORY_CANONICAL_MAINTENANCE_ENABLED stay retired, validator guards from bbe6795 unchanged, feature-flag registry re-rendered without the job surface. No behavioral code beyond deleting the retired window call sites; targeted shard green (841 passed).
Second conflict round after #23739 reverted the FIRESTORE_READ_LEVERS flip (#23731) on main. Resolution identical in shape to c58ac2c: the memory-maintenance-job manifest blocks stay deleted (the revert's in-block lever edit dies with the block), live-surface lever values take main's reverted state via auto-merge, and the feature-flag registry is re-rendered from the resolved manifests (reverted lever values, no job surface). Checker OK; targeted shard 873 passed.
refactor(memory): retire memory-maintenance-job and its dead pipeline
David (2026-10-26 ~07:58Z): "retire/delete any old no longer active logic to avoid
confusing future agents." Required intake moved inline at write time with Dream as
retry/backlog owner (lane memreq, coordinated on the bus); the daily sweep and
knowledge-ledger drain were already retired (DEC-MEM-002 10-18, DEC-FREE-006).
memory-maintenance-jobwas dev-only and never served production (verified:ro-prod scheduler + Cloud Run job lists have no memory entries).
Deleted (no live prod caller; evidence in data/run-2026-10-26-memretire/REPORT.md, workspace repo)
backend/modal/memory_maintenance_job.py+Dockerfile.memory_maintenance_jobbackend/utils/memory/canonical_short_term_maintenance_cron.py(engine; only importer was the job).github/workflows/gcp_memory_maintenance_job.yml+gcp_memory_maintenance_job_auto_dev.yml(auto-dev redeployed the dead job to dev on every main push touching
backend/**)memory-maintenance-hourly(backend/deploy/scheduler/jobs.yaml)backend/scripts/validate_memory_maintenance_scheduler.py(+ its test)backend/scripts/legacy_memory_retirement_readiness.py(+ test + fixtures) — theone-time
DELETE-AFTER: INV-MEM-6tool whose purpose this retirement completesMEMORY_MAINTENANCE_CAPTURED_AFTER(feat(memory): forward-only maintenance window for memory-maintenance-job deploy readiness #23674 window, merged but never used): flagrows, env declarations,
maintenance_captured_after(),captured_afterqueryparams (default was empty = inert; inline intake does not use it — memreq acked)
MEMORY_CANONICAL_MAINTENANCE_ENABLED: flag rows, runtime_env entries (allsurfaces × dev/prod), backend-listen chart entries
Kept (live or shared)
canonical_required_processing(memreq inline + Dream retry reuse),canonical_consolidation(live via
process_conversation),short_term_promotion+memory_outbox_worker(e2e lifecycle contract, dev-harness runner, memory_admin router), the shared
memory-maintenance-scheduler@service accounts (day3-reengagement-email uses themin dev AND prod), and all stored Firestore data.
Guards added
Runtime-env validation refuses reintroduction (
_validate_memory_job_retirement:no
memory-maintenance-jobmanifest block; no retired env on any job or surface;notifications-job keeps no memory bindings). Retirement tests replace the contract
tests;
test_retired_daily_sweep_runtime_is_absentnow also asserts the job is absent.Orphaned duties flagged (were dev-only; prod behavior unchanged by this PR)
Deterministic TTL settling, rotating canonical-outbox drains, and already-enqueued
recurrence delivery now have no scheduled owner anywhere; required intake is
covered inline + Dream. Tracked in anx for David/lead to place (fold into Dream's
sweep, a new bounded owner, or accept as dead).
Product invariants affected
the scheduled maintenance host only; tier reads/writes and their fences are unchanged
(targeted unit shard covers the tier lifecycle tests).
backend/deploy/runtime_env.yamlregenerated from_base.yaml+overlays after removing the job block and flag entries; receipts unchanged.
mutated by this PR. Dev cloud resources (schedulers/jobs) are retired separately
by the lead from the report's command list; nothing here touches cloud state.
Workflow/CI pins refreshed for the deletions
checks-manifest, ci-budget (workflow budget entries + path lists),
backend-unit-tests path filters, check-deployment-concurrency contracts,
logging_rollout_pending,
scripts/pre-pushpin lists,scripts/worktree_env_doctor.py,backend/testing/workflow_contracts.json,backend/runtime_images.json,backend/pyrightconfig.json,fast_unit_duration_allowlist.txt, legacy memorysurface baseline keys, FC-flex-budget-stop-swallowed marked dormant
(host deleted; class cannot recur).
scaffold_cloud_run_job.shtemplates retargetedto the frame-retention job.
Deploy needed
None for prod (the job never existed there). The backend-listen chart env removal
rides the next listen train harmlessly. Dev cloud retirement (5 Cloud Run jobs +
3 schedulers) is lead-executed from data/run-2026-10-26-memretire/REPORT.md.
Verification
Targeted backend unit shard green via
backend/test.sh+BACKEND_UNIT_TEST_FILE_LIST(26 files: runtime-env validator/render, workflowcontracts, scheduler reconcile, runtime images, canonical required/consolidation
query, lifecycle/outbox/atomic-apply, notifications orchestrator, account deletion):
all passed locally at lane/memretire HEAD. Layer: hermetic unit tests; no
deploy claim.
UI-Evidence: none -- reason: no web/admin/app changes in this PR.
Failure-Class: none