KB-39E6

GPT Review — OGV-0 Root Cause Report + Next Directive

3 min read Revision 1
gpt-reviewogv-0orphan-vectorsoft-deleteagent-directivelegacy-vector

GPT Review — OGV-0 Root Cause Report + Next Directive

Date: 2026-05-03

Verdict

OGV-0 report is accepted. The root cause is sufficiently clear to move from investigation to controlled fix planning.

Key accepted findings:

  • Orphans: 47, matching VRC baseline.
  • Ghosts: 6, all correct-behavior ghosts (empty_body / too_short), 0 ghost bugs.
  • Primary root cause: soft-delete vector resurrection.
  • Mechanism: API delete removes Qdrant vectors, then PG soft-delete updates deleted_at; PG trigger emits UPDATE; listener treats UPDATE as upsert and recreates vectors for deleted docs.
  • Ongoing leak: yes, code path remains deployed.

Required correction to next step

Do not frame this as a simple cleanup task. Cleanup before patch will only remove symptoms and may recur.

Do not implement immediate synchronous embedding or bypass the PG CRUD Hot Path Contract. Fix must preserve async/vector-as-projection principles.

Next directive to Opus

Opus must draft a controlled Agent fix prompt for P0 soft-delete vector resurrection prevention, but must not execute.

The prompt must include:

  1. Preflight read-only verification of current code paths and trigger payload semantics.
  2. Qdrant backup/snapshot precondition before any destructive cleanup.
  3. Defensive listener patch: if a document is deleted/soft-deleted (deleted_at IS NOT NULL or status deleted), call delete_document() / retire vector, never upsert_document().
  4. Trigger semantic patch: soft-delete transition must emit DELETE semantic, not UPDATE semantic, if the trigger owns operation classification.
  5. API delete path review: prevent delete-then-soft-delete sequence from resurrecting vectors; avoid double side effects.
  6. Tests: create temp test doc, embed, delete, verify no resurrection after listener/trigger event; repeat update on non-deleted doc verifies normal upsert; metadata-only update does not re-embed if supported.
  7. Cleanup only after patch passes: remove 47 known orphan vectors using existing safe endpoint or Qdrant filter delete with documented IDs; then re-audit must show 0 orphan bug vectors.
  8. Ghost handling: do not reindex 6 correct-behavior ghosts; classify them as skipped/empty/too_short so they do not pollute ghost bug metrics.
  9. Observability: health/audit must distinguish orphan bugs from correct-behavior ghosts.
  10. No IU-0 full draft expansion until P0 prompt is reviewed; non-vector IU sections may continue only after root-cause patch plan is locked.

Roadmap

  1. Opus drafts P0 Fix Prompt, no execution.
  2. GPT/User review prompt.
  3. Dispatch Agent to implement patch in controlled sequence.
  4. Agent reports patch + test evidence.
  5. Backup confirmed.
  6. Cleanup 47 orphan vectors.
  7. Re-audit.
  8. Update Legacy Vector Stabilization and IU-0 references with final evidence.
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-ogv0-root-cause-next-directive-2026-05-03.md