Uh oh!
There was an error while loading. Please reload this page.
refactor(api): migrate v2 knowledge operations - #6413
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview v2 handlers switch to Upload path: quota admission before buffering on v2 multipart POST; Copilot open-resource and VFS mutate/rm paths use Reviewed by Cursor Bugbot for commit 7216d96. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR migrates v2 knowledge operations to shared authorized use cases and strengthens multipart upload completion and recovery.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains. The previously reported processing-dispatch failure is now awaited, leaves the upload in retriable finalizing state, and is retried only for the exact bound pending document.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/knowledge/application/upload-sessions.ts | Adds credential-bound upload authorization, durable registration, awaited processing dispatch, and recovery of failed dispatches without reproducing the previously reported stuck-document path. |
| apps/sim/lib/uploads/upload-session/service.ts | Implements lease-scoped upload completion transitions that serialize finalization and preserve retriable failure state. |
| apps/sim/app/api/v2/knowledge/[id]/documents/route.ts | Migrates document listing and bounded multipart upload admission to the shared v2 route and knowledge-use-case infrastructure. |
| apps/sim/lib/knowledge/application/operations.ts | Defines the semantic knowledge operation registry used by routes and delegated callers. |
| apps/sim/lib/knowledge/application/authorized-knowledge-use-case.ts | Centralizes principal authorization, workspace scoping, and semantic audit behavior for knowledge operations. |
Sequence Diagram
sequenceDiagram
participant Client
participant Route as Upload completion route
participant UseCase as Authorized completion use case
participant Session as Upload-session state
participant Docs as Knowledge documents
participant Queue as Processing queue
Client->>Route: Complete upload
Route->>UseCase: Execute with authenticated principal
UseCase->>Session: Claim completion lease
Session-->>UseCase: finalizing session
UseCase->>Docs: Find or register bound document
UseCase->>Queue: Await processing dispatch
alt Dispatch accepted
Queue-->>UseCase: Accepted
UseCase->>Session: Mark completed
UseCase-->>Route: Document result
Route-->>Client: Success
else Every dispatch fails
Queue-->>UseCase: Failure
UseCase->>Session: Persist failure and remain finalizing
Route-->>Client: Failure
Client->>Route: Retry completion
Route->>UseCase: Execute with fresh authorization
UseCase->>Session: Claim recovery lease
UseCase->>Docs: Load exact bound pending document
UseCase->>Queue: Retry processing dispatch
end
Reviews (4): Last reviewed commit: "Merge remote-tracking branch 'origin/imp..." | Re-trigger Greptile
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
TheodoreSpeaks
commented
Aug 8, 2026
TheodoreSpeaks
commented
Aug 8, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
TheodoreSpeaks
commented
Aug 8, 2026
TheodoreSpeaks
commented
Aug 8, 2026
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 8a5cea9. Configure here.
…odex/v2-application-knowledge # Conflicts: # apps/sim/lib/api/server/routes/v2-json-route.ts # apps/sim/lib/folders/orchestration.ts
TheodoreSpeaks
commented
Aug 8, 2026
TheodoreSpeaks
commented
Aug 8, 2026
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 7216d96. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Deferred / non-goals
Validation
Notes
The direct multipart document upload remains outside the ordinary JSON lifecycle so authorization and quota admission happen before bounded body acquisition, followed by fresh authorization and billing attribution at durable registration. Search retains the v2 vector-only behavior and existing bounds/response shape.