fix: harden remote import error handling and clean up code#339
Merged
Conversation
Self-review follow-up for PR #338: - Only swallow 400/404 on remote history fetch (project not yet known); re-throw 500/auth/network errors instead of silently skipping dedup - Wrap remotePost for import/extract in try/catch — log error and continue to next agent instead of aborting entire import - Wrap remotePost for import/record in try/catch — log warning instead of losing all extraction progress - Use projectQueryParams() for remote history fetch instead of duplicating git remote resolution inline - Remove redundant dynamic import of exportLoreFile (already static) - Clarify ensureProject skip comment (local project may be created later by belt-and-suspenders recordImport — that's intentional)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Self-review follow-up for PR #338. Hardens error handling in the remote import path and cleans up code duplication.
Fixes
Critical:
remotePostfor/api/v1/import/recordin try/catch. Previously a single record failure would abort the entire import, losing all progress for remaining agents/sessionsremotePostfor/api/v1/import/extractin try/catch. On extraction failure, logs error and continues to next agent instead of crashingCleanup:
projectQueryParams()fromremote.ts(eliminates code duplication)import("@loreai/core")forexportLoreFile— already statically importedensureProjectskip comment: local project creation from belt-and-suspendersrecordImport()is intentional, not a bugFiles Changed
packages/gateway/src/cli/import.ts