Skip to content

Batch onboarding memory imports and improve ChatGPT/Claude import failure UX #8760

Closed

Description

@Git-on-my-level

Problem

Beta/dev users can fail ChatGPT/Claude memory imports after pasting an export response into Omi. The UI reports that durable memories could not be created / extracted, but the root cause is usually the write phase: onboarding/import paths fan out many individual POST /v3/memories writes.

This can exceed the backend memories:create limiter and also creates Firestore ledger transaction contention.

Evidence from beta/dev investigation

Project: based-hardware-dev
Cloud Run service: backend
Observed revision label: backend-03eb3ac-1 (03eb3ace...)

One affected burst from a beta client/IP between 2026-07-01T17:00:00Z and 18:00:00Z:

POST /v3/memories total: 435
200 OK: 59
503: 32
429: 344

Minute breakdown:

17:33  43 OK, 32 503, 90 429
17:34  12 OK, 181 429
17:35   3 OK, 21 429
17:39–17:41  repeated 429s

Sampled /v3/memories beta traffic for the day:

200: 931
429: 658
503: 43

Relevant backend policy:

# backend/utils/rate_limit_config.py
"memories:create": (60, 3600)
"memories:batch": (30, 3600)

Representative 503 root cause in logs:

google.api_core.exceptions.Aborted: 409 Aborted due to cross-transaction contention
ValueError: Failed to commit transaction in 5 attempts.
ERROR:routers.memories:Firestore create_memory failed uid=...

Also observed non-blocking vector failures after successful memory saves:

Pinecone 400: Metadata value must be a string, number, boolean or list of strings,
got 'null' for field 'source_commit_id'
ERROR:routers.memories:Vector upsert failed ... (memory saved, vector missing)

Code paths to fix

ChatGPT / Claude memory-log import

desktop/macos/Desktop/Sources/OnboardingMemoryLogImportService.swift

Current behavior:

  • Extracts memoryStrings from the pasted ChatGPT/Claude memory log.
  • Loops over each memory.
  • Calls APIClient.shared.createMemory(...) once per memory.

This should use APIClient.shared.createMemoriesBatch(...) with MemoryBatchItem chunks.

Other onboarding/import paths that still fan out writes

Audit and batch/pacing candidates:

  • desktop/macos/Desktop/Sources/AppleNotesReaderService.swift
    • synthesized profile memories
    • raw note memories via concurrent saveAsMemories
  • desktop/macos/Desktop/Sources/GmailReaderService.swift
    • synthesized profile memories
    • raw email memories via concurrent saveAsMemories
  • desktop/macos/Desktop/Sources/CalendarReaderService.swift
    • synthesized profile memories
    • raw event memories via concurrent saveAsMemories
  • desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/MemoryExtraction/MemoryAssistant.swift
    • may need pacing/backoff rather than batching depending on UX expectations
  • desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/Focus/FocusAssistant.swift
  • desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/Insight/InsightAssistant.swift

Positive reference path:

  • desktop/macos/Desktop/Sources/OnboardingPagedIntroCoordinator.swift
    • importLocalFileMemories already chunks through POST /v3/memories/batch with APIClient.memoriesBatchMaxSize.

UX issues

The user-facing error conflates several failure modes:

  1. The pasted ChatGPT/Claude response contained no usable durable memories.
  2. Extraction succeeded, but saving memories was rate-limited (429).
  3. Extraction succeeded, but saving memories failed due to temporary backend/Firestore contention (503).
  4. Partial success: some memories were created, then later writes failed.

Recommended UX improvements:

  • Show a distinct message for “no durable memories found in the pasted response.”
  • Show retry/backoff guidance for rate limit or temporary server errors.
  • If partial success occurs, show how many memories were saved and offer retry for the remainder instead of treating the whole import as failed.
  • Log/track structured error reason (extraction_empty, save_rate_limited, save_transient, partial_success) so product/support can distinguish these cases.

Proposed implementation

  • Add a helper for batching memory strings into MemoryBatchItem chunks, using APIClient.memoriesBatchMaxSize.
  • Convert ChatGPT/Claude memory-log import to batch writes first.
  • Convert Apple Notes / Gmail / Calendar onboarding imports to batch writes where possible.
  • For ongoing proactive assistant writes, add paced/retry behavior if batching is not semantically appropriate.
  • Preserve tags/headline/category/visibility/source metadata where supported; if source is needed in batch items, extend the batch request/model deliberately rather than silently dropping it.
  • Handle partial batch failures with retry/backoff and explicit user feedback.

Acceptance criteria

  • ChatGPT/Claude memory-log import creates extracted memories through /v3/memories/batch, not N individual /v3/memories requests.
  • Onboarding import flows no longer generate bursts that can hit memories:create during normal use.
  • Firestore transaction contention from concurrent onboarding memory writes is materially reduced.
  • UI distinguishes extraction-empty vs save-failed vs partial-success cases.
  • Regression test or focused harness covers at least the ChatGPT/Claude import path and asserts batched API usage.
  • Pinecone vector metadata upsert no longer sends null metadata values such as source_commit_id: null.

Non-goal for now

Do not raise backend rate limits unless we see sustained pressure after batching ships.

Activity

  1. added a commit that references this issue on Jul 1, 2026
    2212dc1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    UXbugdesktopmemoriesonboarding

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions