omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(backend): Developer API PATCH persists a blank action-item description / conversation title

Open goldnbones opened this issue 2 months ago • 0 comments

Symptom

PATCH /v1/dev/user/action-items/{id} with {"description": " "} and PATCH /v1/dev/user/conversations/{id} with {"title": " "} both return HTTP 200 and persist an empty value: the action item's description becomes "", and the conversation's structured.title and user_title both become "". The sibling write paths reject the same input with 422 (POST /v1/dev/user/action-items, PATCH /v1/dev/user/memories/{id}), so only the two update endpoints silently blank a record. Any client can hit it — e.g. omi action-item update ID --description " " or omi conversation update ID --title " " from the Python CLI, or an agent that passes through an empty-ish string.

Evidence

  • backend/routers/developer.py UpdateActionItemRequest.description (line 759) and UpdateConversationRequest.title (lines 1123-1125) are Optional[str] with min_length=1 — whitespace satisfies min_length.
  • update_action_item (line ~995): update_data['description'] = request.description.strip() with no emptiness check, then action_items_db.update_action_item(...).
  • update_conversation_endpoint (line ~2236): conversations_db.update_conversation_title(uid, conversation_id, request.title.strip()), which writes structured.title and user_title unconditionally (backend/database/conversations.py line 1092).
  • Contrast: create_action_item (line ~855) raises 422 "description cannot be empty" on len(request.description.strip()) == 0; update_memory (line ~705) raises 422 "content must not be empty" on not request.content.strip().
  • Reproduced hermetically through the real FastAPI routes with TestClient and the database seam stubbed: both PATCHes return 200 on main and call the database update with ''.

Proposed Fix

Reject blank text at the request-model boundary, the way UpdateGoalRequest.required_text_cannot_be_null_or_blank already does: one shared helper plus field_validators on UpdateActionItemRequest.description and UpdateConversationRequest.title that return 422 for whitespace-only input and strip surrounding whitespace, while None (field omitted) keeps meaning "leave unchanged". No Firestore write happens for a blank value.

Tests

Regression tests in the existing Developer API harnesses backend/tests/unit/test_dev_api_action_items_poison.py and backend/tests/unit/test_dev_api_conversations_poison.py: a blank body returns 422 and never reaches update_action_item / update_conversation_title; a padded body is stripped before the write. The negative cases fail on main (HTTP 200) and pass with the fix.


Proposed Bounty Reward: $50.00 USD Bounty Payout Destination (PayPal): will be provided by email to [email protected] on payout

cc @josancamon19 @kodjima33

goldnbones avatar Sep 14 '26 21:09 goldnbones