Skip to content

feat: memory consolidation step 1 — pending_review age expiry (B4) - #244

Merged
jkyberneees merged 2 commits into
mainfrom
feat/memory-consolidation
Sep 16, 2026
Merged

jkyberneees merged 2 commits into
mainfrom
feat/memory-consolidation

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Summary

  • Unconfirmed pending-review inferences accumulated until the count cap (default 20) pushed them out — and the cap keeps the NEWEST, so stale chains rode in the protected memory head indefinitely (visible every turn in the USER MODEL block).
  • New knob user_state_pending_max_age_days (*int, default 14, explicit 0 = never expire): applyDiff prunes unconfirmed entries older than the window, BEFORE the count trim so stale entries can't evict fresh ones.
  • Confirmed facts are never touched; no LLM involved — the smallest safe consolidation step (B4 of the T3 roadmap).

Review-found fixes (3-judge panel)

  • MAJOR (all 3 judges converged): plain int + != 0 Resolve guard made the documented '0 disables' unreachable; field is *int now with a JSON→Resolve→disable contract test.
  • Expiry reordered before the count cap trim.
  • Security cleared: confirmed/promoted items never pass through PendingReview; IPI flood bounded better (count + age); knob is operator-config-only (project odek.json memory sections are nulled).

Test plan

  • RED-first: internal/memory/extended/pending_expiry_test.go (5 tests incl. Resolve contract)
  • internal/memory + internal/memory/extended green under -race; full cmd/odek green under -race (×2)
  • golangci-lint clean locally
  • 3 adversarial judges; all findings fixed

…e-trim

- UserStatePendingMaxAgeDays is *int now: explicit JSON 0 disables expiry
  (a plain int with a != 0 Resolve guard made 0 unreachable — MAJOR
  finding confirmed by all three judges); nil = default 14
- age expiry runs BEFORE the maxPending count trim so a stale entry can
  no longer evict a fresh one from a cap slot
- TestResolve_ZeroAgeDisables pins the JSON->Resolve->disable contract
@jkyberneees
jkyberneees merged commit 41d81ce into main Sep 16, 2026
10 checks passed
@jkyberneees
jkyberneees deleted the feat/memory-consolidation branch September 16, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant