Skip to content
This repository was archived by the owner on May 11, 2026. It is now read-only.

Commit 4916c25

Browse files
committed
fix: Address Bugbot feedback on submit_feedback and duplicated logic
1. submit_feedback now checks response.ok before parsing JSON 2. verify_before_trade uses approved variable instead of duplicating logic 3. Consistent error handling across all methods
1 parent 8253787 commit 4916c25

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

agents/connectors/cogdx.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ def verify_before_trade(
203203

204204
approved = validity >= min_validity and len(flaws) == 0
205205

206-
if validity >= min_validity and len(flaws) == 0:
206+
# Use approved variable to avoid duplicated logic
207+
if approved:
207208
recommendation = "proceed"
208209
elif validity >= 0.5:
209210
recommendation = "review"
@@ -302,6 +303,11 @@ def submit_feedback(
302303
timeout=30
303304
)
304305

306+
if response.status_code == 402:
307+
return {"error": "payment_required", "received": False}
308+
if not response.ok:
309+
return {"error": f"http_{response.status_code}", "received": False}
310+
305311
return response.json()
306312

307313
except Exception as e:

0 commit comments

Comments
 (0)