fix: make DELETE idempotent — return 200 for already-deleted memories

Old sync clients without 404 handling get stuck in infinite retry
loops when trying to delete an already-deleted memory. Making the
endpoint idempotent (returning success regardless) fixes this for
all existing clients without requiring client upgrades.
This commit is contained in:
Viktor Barzin 2026-03-15 15:32:41 +00:00
parent b6869ef496
commit 6aa4d31170
No known key found for this signature in database
GPG key ID: 0EB088298288D958

View file

@ -260,7 +260,9 @@ async def delete_memory(memory_id: int, user: AuthUser = Depends(get_current_use
user.user_id,
)
if not row:
raise HTTPException(status_code=404, detail="Memory not found")
# Idempotent: return success even if already deleted
# Prevents old clients without 404-handling from infinite retry loops
return {"deleted": memory_id, "preview": "[already deleted]"}
if row["vault_path"]:
await delete_secret(user.user_id, row["vault_path"])