agent/php
Snider c616ff1e32 fix(brain): close openbrain audit gaps — org scoping + index cleanup + reindex flags + MCP schemas + circuit layer
Closes the 5 PARTIAL items flagged in docs/AUDIT-openbrain-20260424.md.

- Gap A (org scoping persisted on writes): new migration adds `org`
  nullable+indexed column to brain_memories; BrainMemory fillable;
  RememberKnowledge action forwards org; BrainService::remember
  persists it.

- Gap B (supersede/forget Elastic cleanup): BrainService::forget
  dispatches DeleteFromIndex (handles both Qdrant + Elastic); supersede
  path dispatches cleanup for the old memory id before replacing it.
  DeleteFromIndex itself untouched — already handled both indexes.

- Gap C (brain:reindex flags): --org, --project, --stale (null OR
  >14d old), --dry-run (count+stop), --elastic-only added to the
  artisan command.

- Gap D (MCP schemas expose org): brain_remember, brain_recall,
  brain_list now accept `org` in input schema + forward into
  action/service.

- Gap E (resilience uneven): brain_list now wrapped in
  withCircuitBreaker('brain', ...) matching the pattern used by
  BrainRemember/Recall/Forget. BrainService gains retryableHttp()
  helper — 100/300/900ms exponential backoff, retries only on 5xx +
  connection errors, not on 4xx. Qdrant calls route through it;
  Ollama left alone (EmbedMemory job has its own retry).

Tests (Good/Bad/Ugly per gap):
- Feature/Brain/OrgScopingTest.php
- Feature/Brain/SupersedeForgetIndexCleanupTest.php
- Feature/Brain/ReindexFlagsTest.php
- Feature/Mcp/BrainSchemaOrgTest.php
- Feature/Brain/CircuitBreakerTest.php

php -l clean on all 13 files. Pest binary not in this checkout —
CI path validates the full suite.

Closes tasks.lthn.sh/view.php?id=107

Co-authored-by: Codex <noreply@openai.com>
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-24 08:14:06 +01:00
..
Actions fix(brain): close openbrain audit gaps — org scoping + index cleanup + reindex flags + MCP schemas + circuit layer 2026-04-24 08:14:06 +01:00
Configs revert fcb9c189e5 2026-04-23 12:32:57 +01:00
Console/Commands fix(brain): close openbrain audit gaps — org scoping + index cleanup + reindex flags + MCP schemas + circuit layer 2026-04-24 08:14:06 +01:00
Controllers feat(brain): add GET /v1/brain/search — ES full-text endpoint 2026-04-23 13:54:11 +01:00
docs revert fcb9c189e5 2026-04-23 12:32:57 +01:00
Facades revert fcb9c189e5 2026-04-23 12:32:57 +01:00
Jobs feat(brain): add DeleteFromIndex job 2026-04-23 12:55:45 +01:00
Lang/en_GB revert fcb9c189e5 2026-04-23 12:32:57 +01:00
Mcp fix(brain): close openbrain audit gaps — org scoping + index cleanup + reindex flags + MCP schemas + circuit layer 2026-04-24 08:14:06 +01:00
Middleware revert fcb9c189e5 2026-04-23 12:32:57 +01:00
Migrations fix(brain): close openbrain audit gaps — org scoping + index cleanup + reindex flags + MCP schemas + circuit layer 2026-04-24 08:14:06 +01:00
Models fix(brain): close openbrain audit gaps — org scoping + index cleanup + reindex flags + MCP schemas + circuit layer 2026-04-24 08:14:06 +01:00
Pipeline feat(pipeline): add MetaReader contract + Forgejo-backed implementation 2026-04-23 18:09:54 +01:00
Routes feat(brain): add GET /v1/brain/search — ES full-text endpoint 2026-04-23 13:54:11 +01:00
Service revert fcb9c189e5 2026-04-23 12:32:57 +01:00
Services fix(brain): close openbrain audit gaps — org scoping + index cleanup + reindex flags + MCP schemas + circuit layer 2026-04-24 08:14:06 +01:00
Support revert fcb9c189e5 2026-04-23 12:32:57 +01:00
tests fix(brain): close openbrain audit gaps — org scoping + index cleanup + reindex flags + MCP schemas + circuit layer 2026-04-24 08:14:06 +01:00
View revert fcb9c189e5 2026-04-23 12:32:57 +01:00
.DS_Store revert fcb9c189e5 2026-04-23 12:32:57 +01:00
agentic.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
AGENTS.md revert fcb9c189e5 2026-04-23 12:32:57 +01:00
Boot.php revert fcb9c189e5 2026-04-23 12:32:57 +01:00
config.php fix(brain): wire Qdrant api-key header from BRAIN_QDRANT_API_KEY 2026-04-24 05:21:15 +01:00
FINDINGS.md revert fcb9c189e5 2026-04-23 12:32:57 +01:00
GEMINI.md revert fcb9c189e5 2026-04-23 12:32:57 +01:00
TODO.md revert fcb9c189e5 2026-04-23 12:32:57 +01:00