agent/php/tests/Feature/Brain
Snider b6565263f3 fix(agent/brain): lock forget+supersede paths against late index writes
Cache::lock keyed by memory id wraps the delete path in BrainService::
forget(); supersede cleanup in remember() lifted to the same idiom.
forget() now ALWAYS queues DeleteFromIndex on a successful delete
(was previously skipped when indexed_at was null — left late writes
from stale preloaded models a window to land entries after the
underlying memory was gone).

Index write paths (qdrantUpsert / elasticIndex) re-check that the
memory row still exists before writing — defence-in-depth against any
future caller that holds a stale model reference past a forget.

Pest coverage extended in SupersedeForgetIndexCleanupTest:
- never-indexed forget queues cleanup
- late stale-model index writes are skipped after forget
- never-indexed supersede cleanup queues deletion
- late stale-model index writes are skipped after supersede

Co-authored-by: Codex <noreply@openai.com>
Closes tasks.lthn.sh/view.php?id=999
2026-04-25 18:04:55 +01:00
..
CircuitBreakerTest.php fix(agent/brain): batch — org maxLength + retry semantics + forget index cleanup 2026-04-25 14:55:40 +01:00
OrgScopingTest.php fix(brain): close openbrain audit gaps — org scoping + index cleanup + reindex flags + MCP schemas + circuit layer 2026-04-24 08:14:06 +01:00
ReindexFlagsTest.php fix(brain): close openbrain audit gaps — org scoping + index cleanup + reindex flags + MCP schemas + circuit layer 2026-04-24 08:14:06 +01:00
SupersedeForgetIndexCleanupTest.php fix(agent/brain): lock forget+supersede paths against late index writes 2026-04-25 18:04:55 +01:00