Conversation
…e while processing
…fication creation logic
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="backend/onyx/db/notification.py">
<violation number="1" location="backend/onyx/db/notification.py:20">
P1: The check-then-insert pattern creates a race condition window where concurrent calls can create duplicate notifications. Consider using SQLAlchemy's atomic insert().on_conflict_do_update() to handle existing notifications atomically.
(Based on your team's feedback about avoiding TOCTOU race conditions with atomic operations.) [FEEDBACK_USED]</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Greptile OverviewGreptile SummaryThis PR implements three key improvements to the agent creation flow when files are being uploaded: Changes Made
Critical Issues Found1. Duplicate Notification Bug
|
| Filename | Score | Overview |
|---|---|---|
| backend/onyx/indexing/adapters/user_file_indexing_adapter.py | 2/5 | Added notification logic for assistant file completion; critical bug with duplicate notifications when multiple files complete in same batch |
| backend/onyx/db/notification.py | 3/5 | Added autocommit parameter for transaction control; deduplication may not work correctly with autocommit=False |
| web/src/refresh-pages/AgentEditorPage.tsx | 3/5 | Added file status checks to disable Create/Save button and show processing message; potential edge case where undefined file status could allow submission |
Sequence Diagram
sequenceDiagram
participant User
participant AgentEditorPage
participant Backend
participant IndexingAdapter
participant NotificationService
participant Database
User->>AgentEditorPage: Upload files & create/edit agent
AgentEditorPage->>AgentEditorPage: Check file status (UPLOADING)
alt Files still uploading
AgentEditorPage-->>User: Disable Create/Save button
end
AgentEditorPage->>Backend: Submit agent with user_file_ids
Backend->>Database: Create/update agent with file associations
Backend-->>User: Agent created
Note over Backend,IndexingAdapter: File processing happens async
IndexingAdapter->>IndexingAdapter: Process uploaded files
IndexingAdapter->>Database: Update file status to PROCESSING
IndexingAdapter->>IndexingAdapter: Index file content
IndexingAdapter->>Database: Update file status to COMPLETED
IndexingAdapter->>IndexingAdapter: Check if all assistant files completed
alt All files completed
IndexingAdapter->>NotificationService: Create ASSISTANT_FILES_READY notification
NotificationService->>Database: Check for duplicate notification
NotificationService->>Database: Save notification (autocommit=false)
IndexingAdapter->>Database: Commit transaction
end
Database-->>User: Notification sent
User->>AgentEditorPage: Click notification link
AgentEditorPage->>Backend: Navigate to /assistants/{id}
Backend-->>User: Show agent with all files ready
…cessing message clarity
Description
This pull request addresses below:
ticket -> https://linear.app/onyx-app/issue/ENG-3124/user-uploaded-large-files-block-agent-creation
How Has This Been Tested?
Tested by creating the assistant before the files were processed and verified whether the notification was received.

Additional Options
Summary by cubic
Improve agent creation flow by blocking Create/Save while files upload, showing a clear processing message, and notifying owners when all files finish indexing. Addresses Linear ENG-3124 so large uploads don’t stall creation and owners know when agents have full file access.
New Features
Bug Fixes
Written for commit 211cd5b. Summary will update on new commits.