Skip to content

fix(knowledge): remove connections with durable background cleanup - #7854

Merged
icecrasher321 merged 1 commit into
stagingfrom
codex/connection-removal-cleanup
Sep 15, 2026
Merged

icecrasher321 merged 1 commit into
stagingfrom
codex/connection-removal-cleanup

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

  • Return from connection removal after atomically disabling the source and saving a durable cleanup job. Hide its documents immediately and reject late indexing or sync writes.
  • Drain documents, search chunks, member records, and sync history in bounded transactions, preserving storage cleanup intents and retry progress. Keep the existing document-retention behavior.
  • Return all source detail views to Sources after successful removal, with navigation running before cache invalidation and surviving component unmounts.

Type of Change

  • Bug fix

Testing

  • Targeted Vitest coverage for removal, navigation, cache invalidation, document access, indexing, and tag cleanup.
  • Disposable PostgreSQL integration tests cover 501 documents and 1,001 chunks, storage accounting, rollback, late sync rejection, storage cleanup, and concurrent source saves.
  • Application type-check, repository lint, strict API validation, block registry checks, generated-artifact checks, and all repository audits passed.
  • Static scaling review: indexed batches cap each transaction at 250 documents or 1,000 chunks/history/member rows, with up to four batches per invocation and resumable continuations. Cleanup uses the existing fair outbox scheduler. The foreground document count still scales with source size and has a statement timeout; this change does not establish production throughput benchmarks.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 15, 2026 6:21pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable correctness, security, or repository-rule violations remain.

Summary

This PR changes connector removal into an atomic tombstone-and-outbox workflow, immediately hides documents belonging to removed sources, rejects late indexing and sync writes, and performs physical cleanup in bounded resumable transactions.

  • Adds durable, retryable cleanup for chunks, documents, sync history, member records, storage objects, credential grants, and unused tags.
  • Preserves the existing keep-documents path and storage accounting behavior.
  • Navigates source-detail views back to Sources before cache reconciliation, including when the initiating component unmounts.
  • Adds focused unit and PostgreSQL integration coverage for lifecycle, concurrency, rollback, accounting, access, navigation, and cleanup batching.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Authorized connector removal] --> B{Delete documents?}
    B -- No --> C[Detach documents and account for storage]
    C --> D[Delete connector]
    B -- Yes --> E[Lock knowledge base and connector]
    E --> F[Disable and tombstone connector]
    F --> G[Enqueue cleanup event atomically]
    G --> H[Return success and navigate to Sources]
    H --> I[Outbox worker claims cleanup]
    I --> J[Drain bounded embedding batches]
    J --> K[Persist storage-cleanup intents]
    K --> L[Delete bounded document batches]
    L --> M[Drain sync and member records]
    M --> N[Delete connector tombstone]
    N --> O[Revoke credential access]
    O --> P[Remove unused tag definitions]
    J -->|More work| I
    L -->|More work| I
    M -->|More work| I
Loading

Reviews (1) · Last reviewed commit: "fix(knowledge): remove connections with ..."

@icecrasher321
icecrasher321 merged commit d48d985 into staging Sep 15, 2026
33 checks passed
@icecrasher321
icecrasher321 deleted the codex/connection-removal-cleanup branch September 15, 2026 18:33
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