Multiple Python agents: Broad `except Exception` handlers mask real failures
- Lingua principale
- TypeScript
- Stelle
- 0
- Fork
- 0
- Merge medio
- 16m
- PR unite (30g)
- 1
Descrizione
### Problem
Several Python agent files use bare `except Exception:` blocks that catch and silently suppress all errors, including unexpected ones:
**Files:**
- `PluckIt.Processor/agents/taste_calibration.py:78`
- `PluckIt.Processor/agents/digest_agent.py:81`
- Others throughout `PluckIt.Processor/agents/`
```python
try:
result = await some_operation()
except Exception:
return default_value # swallows KeyError, AttributeError, etc.
```
When a bug (e.g. schema change, missing field) causes an `AttributeError` or `KeyError`, it is silently swallowed and returns a default — making the feature appear to work while producing incorrect output.
### Impact
- Bugs introduced by schema changes or refactors are invisible until users report wrong results
- Difficult to distinguish expected failures (network timeout) from unexpected failures (code bug)
- No Sentry/logging capture of the actual exception
### Proposed Fix
Replace catch-alls with specific exception types:
```python
except CosmosHttpResponseError as e:
logger.warning("Cosmos error in %s: %s", func_name, e)
return default_value
except (httpx.TimeoutException, httpx.ConnectError) as e:
logger.warning("Network timeout in %s: %s", func_name, e)
return default_value
# Let unexpected exceptions (AttributeError, KeyError, etc.) propagate
```
### Functionality Impact
Unexpected errors will now surface instead of being silently swallowed. Some error handling may need to be added at call
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.