Skip to content

fix: harden remote import error handling and clean up code#339

Merged
BYK merged 1 commit into
mainfrom
fix/import-remote-dedup-followup
May 15, 2026
Merged

fix: harden remote import error handling and clean up code#339
BYK merged 1 commit into
mainfrom
fix/import-remote-dedup-followup

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented May 15, 2026

Summary

Self-review follow-up for PR #338. Hardens error handling in the remote import path and cleans up code duplication.

Fixes

Critical:

  • C2: Only swallow 400/404 on remote history fetch (project not yet known to remote). Server errors (500), auth failures (401), and network errors now propagate instead of silently skipping dedup — which could cause duplicate imports
  • C3: Wrap remotePost for /api/v1/import/record in try/catch. Previously a single record failure would abort the entire import, losing all progress for remaining agents/sessions
  • M5: Wrap remotePost for /api/v1/import/extract in try/catch. On extraction failure, logs error and continues to next agent instead of crashing

Cleanup:

  • M3: Replace hand-rolled git remote resolution with projectQueryParams() from remote.ts (eliminates code duplication)
  • Remove redundant dynamic import("@loreai/core") for exportLoreFile — already statically imported
  • Clarify ensureProject skip comment: local project creation from belt-and-suspenders recordImport() is intentional, not a bug

Files Changed

File Change
packages/gateway/src/cli/import.ts Error handling, code cleanup

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)
@BYK BYK merged commit 51b99d6 into main May 15, 2026
7 checks passed
@BYK BYK deleted the fix/import-remote-dedup-followup branch May 15, 2026 13:20
This was referenced May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant