Commit a219b2d
UN-2901 [FIX] Prevent invalid status updates (EXECUTING/ERROR) from duplicate file processing runs (#1606)
* UN-2901 [FIX] Prevent invalid status updates (EXECUTING/ERROR) from duplicate file processing runs
Fixes race condition where late-arriving workers overwrite COMPLETED status
with invalid EXECUTING or ERROR states, causing files to appear failed/stuck
even though processing succeeded.
Changes:
- FileAPIClient: Fixed URL construction and method call bugs
- Fresh DB validation: Check current status before updating to EXECUTING
- Grace period optimization: Early exit when duplicate detected during tool polling
- File count accuracy: Include skipped files in total_files calculation
Impact: Files now correctly maintain COMPLETED status; no duplicate processing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* coderabbit commnets addressed
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 91f17dc commit a219b2d
7 files changed
Lines changed: 507 additions & 157 deletions
File tree
- unstract
- core/src/unstract/core
- tool-sandbox/src/unstract/tool_sandbox
- workflow-execution/src/unstract/workflow_execution
- workers
- file_processing
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
861 | 861 | | |
862 | 862 | | |
863 | 863 | | |
864 | | - | |
865 | 864 | | |
866 | 865 | | |
867 | 866 | | |
| 867 | + | |
868 | 868 | | |
869 | 869 | | |
870 | 870 | | |
| |||
883 | 883 | | |
884 | 884 | | |
885 | 885 | | |
886 | | - | |
887 | | - | |
| 886 | + | |
888 | 887 | | |
889 | 888 | | |
890 | 889 | | |
| |||
904 | 903 | | |
905 | 904 | | |
906 | 905 | | |
907 | | - | |
| 906 | + | |
908 | 907 | | |
909 | 908 | | |
910 | 909 | | |
| |||
Lines changed: 23 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
163 | 186 | | |
164 | 187 | | |
165 | 188 | | |
| |||
300 | 323 | | |
301 | 324 | | |
302 | 325 | | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | 326 | | |
309 | 327 | | |
310 | 328 | | |
| |||
319 | 337 | | |
320 | 338 | | |
321 | 339 | | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | 340 | | |
328 | 341 | | |
329 | 342 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
131 | 153 | | |
132 | 154 | | |
133 | 155 | | |
| |||
0 commit comments