Repository navigation
Conversation
The ChatGPT/Claude onboarding memory import looped one POST /v3/memories per extracted memory. On import bursts this tripped the backend memories:create rate limiter (429s) and caused Firestore cross-transaction contention (503s), so imports failed partway through. Convert the save loop to chunk through POST /v3/memories/batch via APIClient.createMemoriesBatch, mirroring the accepted local-file import path in OnboardingPagedIntroCoordinator. One batch = one Firestore write + one embeddings call + one Pinecone upsert regardless of size. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Verified the batched-write conversion against the existing APIs and reference path — this looks solid. What I checked:
Scope is appropriately tight for acceptance criterion #1 of #8760; the broader audit/UX items are correctly excluded. Not approving formally since this is a sequenced fix touching the memory write path — leaving for a human maintainer to give the final merge call. Thanks @kodjima33 for the clean, well-commented fix. 🤖 Automated review by Omi PR maintainer monitor (glm-5.2). Actions taken: comment only, no approve/merge/label changes. |
…#8975) ## What Users can start (`POST /v1/import/limitless`), list (`GET /v1/import/jobs`), and check the status of an import job, but there was no way to cancel a stuck or running import or remove a finished/failed one, so old jobs pile up in the list with no recourse. This adds the two missing lifecycle verbs. It sits in the actively-built ChatGPT/Claude/Limitless memory-bank import area (#4862, #8764), and it wires up the `delete_import_job` db helper that already shipped but was never called by any router. Purely additive: no existing route or behavior changes. ## Changes - `models/import_job.py` — add a `cancelled` status to `ImportJobStatus`. - `routers/imports.py` - `POST /v1/import/jobs/{job_id}/cancel` — cancels a `pending` or `processing` job (sets `cancelled` + an error note); 409 if the job is already terminal. - `DELETE /v1/import/jobs/{job_id}` — deletes a terminal job (`completed`/`failed`/`cancelled`); 409 while it is still in progress (cancel first). - Both mirror the existing `get_import_job_status` ownership checks (404 unknown, 403 wrong owner). The two endpoints form a clean state machine (cancel for in-progress, delete for terminal), so the delete path never races the background worker. - `utils/imports/limitless.py` — the worker re-reads the job right before its final status write and bails if it was cancelled, so a mid-run cancel is not overwritten by `completed`/`failed`. ## Tests `tests/routers/test_imports.py` (14 cases): cancel of pending/processing sets `cancelled` and calls `update_import_job`; cancel of a terminal job is 409; delete of completed/failed/cancelled calls `delete_import_job`; delete of an in-progress job is 409; and both 404 on a missing job and 403 on a wrong-owner job. The module is imported normally and the db helpers are patched (no `sys.modules` mutation, no network). <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/8975?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
|
Closing — opened by an automated bot and left unreviewed. The bot policy has changed: it now tests and merges fixes directly (or reports them), and no longer leaves open PRs for review. If this fix is still wanted, reopen and it'll be landed properly (tested → merged). 🤖 |
|
Hey @kodjima33 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Bug (#8760)
ChatGPT/Claude onboarding memory imports could fail partway through after a user pastes an export. The UI reports memories couldn't be created, but the root cause is the write phase:
OnboardingMemoryLogImportServiceloopedAPIClient.createMemoryonce per extracted memory (onePOST /v3/memorieseach).On an import burst this:
memories:createlimiter → bursts of 429s (issue shows 344/435 requests 429'd in one burst), andAborted due to cross-transaction contention).Root cause
Fan-out of N individual
POST /v3/memorieswrites from the import path, instead of using the existing batch endpoint.Fix
Convert the save loop to chunk the extracted memory strings through
APIClient.createMemoriesBatch(POST /v3/memories/batch), chunked byAPIClient.memoriesBatchMaxSize. One batch request = one Firestore write + one embeddings call + one Pinecone upsert on the server, regardless of size.This mirrors the already-accepted local-file import path in
OnboardingPagedIntroCoordinator.importLocalFileMemories. Metadata preserved: content/visibility/category/tags/headline (thechatgpt/claude/memory_logsource info is already carried intags; the batch model has nosourcefield, same as the reference path — not a silent drop, documented in a code comment).Addresses acceptance criterion #1 of the issue (import creates memories through
/v3/memories/batch, not N individual requests). The broader Apple Notes / Gmail / Calendar audit, UX error-differentiation, and Pineconenullmetadata items in the issue are intentionally left out of this scoped fix.Testing
xcrun swift build -c debug --package-path Desktop→ Build complete (only pre-existing warnings).🤖 automated by hourly watchdog; opened for review, not merged.