openwork icon indicating copy to clipboard operation
openwork copied to clipboard

[Bug]: INBOX Performance Issue - UI Freeze During File Scanning

Open iljaiass opened this issue 9 months ago • 5 comments

Summary

Problem Description The OpenWork INBOX feature causes severe UI freezing when the file scanning indicator is active. The application becomes completely unresponsive during inbox directory monitoring, making it unusable for users.

Severity: Critical - Blocks all user interaction Affected Users: All users with INBOX enabled (default configuration) Frequency: Consistent - Occurs every time INBOX scanning is active

Technical Details Root Cause: Synchronous file system operations in the inbox scanning process block the main UI thread.

Affected Code Locations:

packages/server/src/server.ts:

  • Line 814: resolveInboxDir()
  • Line 1043: listInbox()
  • Line 2205: GET /workspace/:id/inbox endpoint
  • Line 2238: POST /workspace/:id/inbox endpoint Process Flow:

INBOX monitoring starts automatically when OPENWORK_INBOX_ENABLED=1 (default) Continuous polling of .opencode/openwork/inbox/ directory Synchronous file operations in listInbox() and listArtifacts() functions UI thread becomes blocked during scanning Application freezes until scanning completes How to Reproduce Steps: Start OpenWork with default settings (INBOX enabled) Open any workspace Observe the spinning scanning indicator in the INBOX panel Try to interact with the application (click buttons, type, navigate) Result: UI becomes frozen and unresponsive Environment: Platform: Windows (win32) OpenWork Version: Latest Configuration: Default (INBOX enabled) How to Verify the Issue Method 1: Enable/Disable Test bash

Test 1: Default state (should freeze)

Start OpenWork normally - UI should freeze during scanning

Test 2: Disable INBOX (should work normally)

OPENWORK_INBOX_ENABLED=0

Start OpenWork - UI should remain responsive

Method 2: Performance Monitoring Open browser DevTools (F12) Go to Performance tab Start recording Trigger inbox scanning Expected result: Long blocking tasks visible in main thread Method 3: User Experience Test Start OpenWork (default config) Try to: Type in the chat input Click on sidebar items Navigate between sections Open settings Expected result: All interactions are delayed or blocked during scanning Current Workaround bash

Temporary fix: Disable INBOX feature

export OPENWORK_INBOX_ENABLED=0

or

OPENWORK_INBOX_ENABLED=0 openwork Proposed Solutions Async File Operations

Replace synchronous fs calls with async equivalents Use await properly in listInbox() and related functions Debounced Scanning

Add configurable scan interval: OPENWORK_INBOX_SCAN_INTERVAL (default: 5000ms) Implement debouncing to reduce scan frequency Background Processing

Move file monitoring to a worker thread or separate process Use message passing for UI updates User Controls

Add pause/resume toggle for inbox scanning Show scanning status with ability to cancel Optimized Watching

Use native file system events (fsevents/inotify) instead of polling Add OPENWORK_INBOX_WATCH_MODE configuration Configuration Variables Current:

OPENWORK_INBOX_ENABLED - Enable/disable (default: 1) OPENWORK_INBOX_MAX_BYTES - Max file size (default: 50MB) Missing (needed for fix):

OPENWORK_INBOX_SCAN_INTERVAL - Polling interval in ms OPENWORK_INBOX_WATCH_MODE - Watch strategy: polling|fsevents|none Expected Behavior INBOX scanning should run asynchronously without blocking UI Users should be able to interact with the application during file monitoring Scanning indicator should show progress without causing freezes File operations should be responsive and non-intrusive Testing After Fix Verification Steps: Start OpenWork with INBOX enabled Upload a file to inbox via drag-and-drop Verify file appears in inbox list During scanning: Confirm UI remains responsive Test all UI interactions (typing, clicking, navigation) Monitor browser DevTools for blocking operations Test with various file sizes and quantities

Steps to reproduce

Problem Description The OpenWork INBOX feature causes severe UI freezing when the file scanning indicator is active. The application becomes completely unresponsive during inbox directory monitoring, making it unusable for users.

Severity: Critical - Blocks all user interaction Affected Users: All users with INBOX enabled (default configuration) Frequency: Consistent - Occurs every time INBOX scanning is active

Technical Details Root Cause: Synchronous file system operations in the inbox scanning process block the main UI thread.

Affected Code Locations:

packages/server/src/server.ts:

  • Line 814: resolveInboxDir()
  • Line 1043: listInbox()
  • Line 2205: GET /workspace/:id/inbox endpoint
  • Line 2238: POST /workspace/:id/inbox endpoint Process Flow:

INBOX monitoring starts automatically when OPENWORK_INBOX_ENABLED=1 (default) Continuous polling of .opencode/openwork/inbox/ directory Synchronous file operations in listInbox() and listArtifacts() functions UI thread becomes blocked during scanning Application freezes until scanning completes How to Reproduce Steps: Start OpenWork with default settings (INBOX enabled) Open any workspace Observe the spinning scanning indicator in the INBOX panel Try to interact with the application (click buttons, type, navigate) Result: UI becomes frozen and unresponsive Environment: Platform: Windows (win32) OpenWork Version: Latest Configuration: Default (INBOX enabled) How to Verify the Issue Method 1: Enable/Disable Test bash

Test 1: Default state (should freeze)

Start OpenWork normally - UI should freeze during scanning

Test 2: Disable INBOX (should work normally)

OPENWORK_INBOX_ENABLED=0

Start OpenWork - UI should remain responsive

Method 2: Performance Monitoring Open browser DevTools (F12) Go to Performance tab Start recording Trigger inbox scanning Expected result: Long blocking tasks visible in main thread Method 3: User Experience Test Start OpenWork (default config) Try to: Type in the chat input Click on sidebar items Navigate between sections Open settings Expected result: All interactions are delayed or blocked during scanning Current Workaround bash

Temporary fix: Disable INBOX feature

export OPENWORK_INBOX_ENABLED=0

or

OPENWORK_INBOX_ENABLED=0 openwork Proposed Solutions Async File Operations

Replace synchronous fs calls with async equivalents Use await properly in listInbox() and related functions Debounced Scanning

Add configurable scan interval: OPENWORK_INBOX_SCAN_INTERVAL (default: 5000ms) Implement debouncing to reduce scan frequency Background Processing

Move file monitoring to a worker thread or separate process Use message passing for UI updates User Controls

Add pause/resume toggle for inbox scanning Show scanning status with ability to cancel Optimized Watching

Use native file system events (fsevents/inotify) instead of polling Add OPENWORK_INBOX_WATCH_MODE configuration Configuration Variables Current:

OPENWORK_INBOX_ENABLED - Enable/disable (default: 1) OPENWORK_INBOX_MAX_BYTES - Max file size (default: 50MB) Missing (needed for fix):

OPENWORK_INBOX_SCAN_INTERVAL - Polling interval in ms OPENWORK_INBOX_WATCH_MODE - Watch strategy: polling|fsevents|none Expected Behavior INBOX scanning should run asynchronously without blocking UI Users should be able to interact with the application during file monitoring Scanning indicator should show progress without causing freezes File operations should be responsive and non-intrusive Testing After Fix Verification Steps: Start OpenWork with INBOX enabled Upload a file to inbox via drag-and-drop Verify file appears in inbox list During scanning: Confirm UI remains responsive Test all UI interactions (typing, clicking, navigation) Monitor browser DevTools for blocking operations Test with various file sizes and quantities

Expected behavior

text text

Actual behavior

text

iljaiass avatar Feb 22 '26 08:02 iljaiass

@iljaiass i've experienced this as well will have a look to see what the issue is today.

thx for reporting it helps a lot to get all this extra info.

benjaminshafii avatar Feb 22 '26 16:02 benjaminshafii

i expect this to be solved. closing for now, but let me know if you're still having issues.

benjaminshafii avatar Feb 23 '26 20:02 benjaminshafii

Confirmed on v0.11.123 (Windows)

I can confirm this issue is still present in OpenWork v0.11.123 on Windows 10

Environment

  • OpenWork Version: 0.11.123
  • Platform: Windows (win32)
  • OpenCode Engine: 1.1.53
  • Configuration: Default (INBOX enabled)

Symptoms Confirmed

✅ Complete UI freeze during INBOX file scanning
✅ Cannot type, click, or navigate while scanning active
✅ Spinning indicator in INBOX panel
✅ Freeze duration: 2-30+ seconds depending on file count

Root Cause Verified

The issue is in synchronous file operations blocking the main UI thread:

  • packages/server/src/server.ts:1043 - listInbox() uses sync fs calls
  • No background worker or async operations
  • Continuous polling blocks UI on every scan cycle

Workaround (Tested & Working)

Windows PowerShell:

[System.Environment]::SetEnvironmentVariable('OPENWORK_INBOX_ENABLED', '0', 'User')

Windows CMD:

setx OPENWORK_INBOX_ENABLED 0

Then restart OpenWork.

Result:

  • ✅ UI fully responsive
  • ✅ No freezes
  • ❌ INBOX functionality disabled (temporary trade-off)

iljaiass avatar Feb 26 '26 08:02 iljaiass

Regression after sleep/wake cycle:

Steps to reproduce:

Set OPENWORK_INBOX_ENABLED=0 (User env var) Start OpenWork → INBOX disabled ✅ Put laptop to sleep (without closing OpenWork) Wake up → OpenWork reconnects INBOX re-enables via remote config.patch ❌ Root cause: Env var only checked at process start, not after remote config sync.

Workaround: Restart OpenWork after wake.

iljaiass avatar Feb 26 '26 17:02 iljaiass

@iljaiass can you let us know wether this is still happening in the latest release? https://github.com/different-ai/openwork/releases/tag/v0.11.207

jcllobet avatar Apr 14 '26 01:04 jcllobet