@@ -210,16 +210,21 @@ jobs:
210210 for i in {1..90}; do
211211 echo "Checking stats, attempt $i..."
212212
213- mkfifo error_pipe
214- stats=$(timeout 5 ./occ context_chat:stats 2>error_pipe)
213+ stats_err=$(mktemp)
214+ stats=$(timeout 5 ./occ context_chat:stats 2>"$stats_err")
215+ stats_exit=$?
215216 echo "Stats output:"
216217 echo "$stats"
218+ if [ -s "$stats_err" ]; then
219+ echo "Stderr:"
220+ cat "$stats_err"
221+ fi
217222 echo "---"
223+ rm -f "$stats_err"
218224
219225 # Check for critical errors in output
220- if echo "$stats" | grep -q "Error during request"; then
221- echo "Backend connection error detected, retrying..."
222- rm -f error_pipe
226+ if [ $stats_exit -ne 0 ] || echo "$stats" | grep -q "Error during request"; then
227+ echo "Backend connection error detected (exit=$stats_exit), retrying..."
223228 sleep 10
224229 continue
225230 fi
@@ -236,7 +241,6 @@ jobs:
236241 if echo "$stats" | grep -q "Indexed documents:"; then
237242 echo " Indexed documents section found but could not extract count"
238243 fi
239- rm -f error_pipe
240244 sleep 10
241245 continue
242246 fi
@@ -256,7 +260,6 @@ jobs:
256260 # Check if difference is within tolerance
257261 if (( $(echo "$diff <= $threshold" | bc -l) )); then
258262 echo "Indexing within 2% tolerance (diff=$diff, threshold=$threshold)"
259- rm -f error_pipe
260263 success=1
261264 break
262265 else
@@ -268,11 +271,9 @@ jobs:
268271 ccb_alive=$(ps -p $(cat pid.txt) -o cmd= | grep -c "main.py" || echo "0")
269272 if [ "$ccb_alive" -eq 0 ]; then
270273 echo "Error: Context Chat Backend process is not running. Exiting."
271- rm -f error_pipe
272274 exit 1
273275 fi
274276
275- rm -f error_pipe
276277 sleep 10
277278 done
278279
0 commit comments