v2.6.0: structured errors — translate non-2xx at the engine #56
All Vouch review confidence checks passed
Residual risk 0.37 = Change Risk (0.71) × (1 − Review Confidence (0.48)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.71 · 785 lines diff across 18 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.00 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.399
Shallow Review Depth
shallow_review_depth
0.350
Mass File Touch
mass_file_touch
0.080
Real PR Conversation Timeline
2 items
Approved
Approved these changes.
tjkilgore93-stack
karaposu
Makes SDK failures machine-readable. Today
AsyncEngineconverts only HTTP 401 and 403 into exceptions and hands every other non-2xx back as an ordinary response, so each subsystem improvises its own answer and six of the seven exception types carry nothing but a prose message.Two failures this fixes
A rate-limited request surfaced as a JSON parse error.
/datasets/filteranswers 429 with the bare stringtoo_many_parallel_jobsunder a non-JSON content type, anddatasets/base.pycalledresponse.json()before checking the status. The user saw an aiohttp content-type error, never "you are rate limited".A token expiring mid-poll was reported as
"Job failed with status: error".DatasetAPIClient.get_statuscollapsed every non-200 into the string"error", discarding the status code unread — so an authentication problem was blamed on the user's scrape.What changed
429→ newRateLimitError(withretry_afterparsed from the header), other 4xx/5xx →APIError. Bodies are read as text first, so a non-JSON error degrades to a readable message instead of a parse exception.status_code,url,method,retry_after,retryable, andraw(bounded to 4 KB).ScrapeResult/CrawlResultgainedcause, populated wherever an exception is converted into a result — without this the structure was discarded atpoll_until_ready, so it never reached scraper callers at all:retry_with_backoffno longer retries by exception type. An error with no status code is raised locally — sometimes after the server accepted the work — so repeating it could create a duplicate billed job; those are never retried. Explicit 5xx still is. 429 never is, since those responses consume quota and retrying extends the lockout.Deliberately preserved
scraper_studio.trigger_immediate, and elsewhere drives theDataNotReadyError→poll_until_readyrecovery — the only working recovery path in the SDK. Covered by regression tests.crawler.crawl()still returnsCrawlResulton HTTP errors, and the unlocker's asyncget_statusstill returns a status string for its poll loop — both would otherwise have started raising.except DatasetErrorstill catches dataset failures: the datasets layer re-types engine errors, lettingRateLimitErrorthrough as the more specific type.TimeoutError-before-OSErrorordering and the SSL guidance messages are unchanged.Notes for review
status_codeinstead. A bounded 200-char body excerpt is appended so a bareprint(exc)stays useful.DatasetErrornow subclassesBrightDataError(still catchable as before).RateLimitErrorandDataNotReadyErrorare exported frombrightdatatop level.Tests: 321 → 365. Version → 2.6.0.