Bug Description
Several places in the codebase use bare except: clauses which catch KeyboardInterrupt and SystemExit in addition to regular exceptions. This prevents proper Celery worker shutdown and can mask critical errors.
Affected Files
apps/ops/celery/utils.py line 45:
try:
uuid.UUID(task_id)
except: # catches KeyboardInterrupt/SystemExit
return os.path.join(PROJECT_DIR, 'data', 'caution.txt')
Should use except (ValueError, AttributeError): since uuid.UUID() only raises ValueError on invalid UUIDs.
apps/application/flow/step_node/tool_node/impl/base_tool_node.py line 54:
except: # catches KeyboardInterrupt/SystemExit
return value
Should use except (json.JSONDecodeError, TypeError, ValueError): since the try block calls json.loads() and type comparisons.
Impact
During Celery worker shutdown or when a user sends SIGINT:
KeyboardInterrupt is silently swallowed, preventing graceful shutdown
SystemExit is caught, which can cause processes to hang instead of terminating
This follows the Python best practice documented in PEP 8: "When catching exceptions, mention specific exceptions whenever possible instead of using a bare except: clause."
Bug Description
Several places in the codebase use bare
except:clauses which catchKeyboardInterruptandSystemExitin addition to regular exceptions. This prevents proper Celery worker shutdown and can mask critical errors.Affected Files
apps/ops/celery/utils.pyline 45:Should use
except (ValueError, AttributeError):sinceuuid.UUID()only raisesValueErroron invalid UUIDs.apps/application/flow/step_node/tool_node/impl/base_tool_node.pyline 54:Should use
except (json.JSONDecodeError, TypeError, ValueError):since the try block callsjson.loads()and type comparisons.Impact
During Celery worker shutdown or when a user sends SIGINT:
KeyboardInterruptis silently swallowed, preventing graceful shutdownSystemExitis caught, which can cause processes to hang instead of terminatingThis follows the Python best practice documented in PEP 8: "When catching exceptions, mention specific exceptions whenever possible instead of using a bare
except:clause."