fix(tradein/avito): route sidecar timeout/transport errors as transient, not crash #2523
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#2523
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/avito-serp-timeout-graceful"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
avito_full_loadhas failed since 2026-07-02 (8 runsstatus=failed, some witherror='')._fetch_serp_html_browser(serp.py) only caughthttpx.HTTPStatusErrorfromBrowserFetcher.fetch. When the sidecar fetch fails withhttpx.TimeoutException/httpx.TransportError(ReadTimeout/ConnectError/RemoteProtocolError) afterBrowserFetcher's own internal retry, the exception was unhandled and propagated through_paginate_incremental_bracketintorun_avito_full_load's genericexcept Exception→mark_failed(str(exc)).str(ReadTimeout())==''produces an empty error, andmark_faileddoes NOT persistdone_buckets(unlikemark_banned), losing the resume checkpoint.Root cause / fix
exceptclause in_fetch_serp_html_browserto also catchhttpx.TimeoutException/httpx.TransportError, mirroring the existing pattern already used in_probe_totalin the same file.HTTPStatusErrorexceptions have no HTTP status → classifiedstatus=0with a descriptiveerror_text(f"{type(exc).__name__}: {exc}") and routed through the existing transient-backoff branch — confirmedstatus=0/ the exception text never match the soft-ban keyword checks (too_many_requests,status==503,browser unavailable,proxy may be down), so no false soft-ban/rotation is triggered._AVITO_SIDECAR_TRANSIENT_RETRIES=2) is exhausted, it raisesAvitoRateLimitedError— same as a sidecarHTTPStatusError— whichrun_avito_full_load's dedicatedexcept (AvitoBlockedError, AvitoRateLimitedError)routes tomark_banned, which does persistdone_buckets(verified by readingpipeline.py:3289-3298vs the generic-exception branch at3329-3332).Test plan
test_fetch_serp_html_browser_timeout_routes_transient_not_bare_exceptionintradein-mvp/backend/tests/test_pipeline_browser_routing.py: mocksBrowserFetcher.fetchto raisehttpx.ReadTimeout(""), asserts_fetch_serp_htmldoes NOT propagate an unhandled exception, retries 3× total (1 initial + 2 transient retries), and raisesAvitoRateLimitedError(the graceful banned-path) rather than a bare/generic exception.cd tradein-mvp/backend && uv run python -m pytest tests/ -k "avito or scraper_kit_pipeline or serp" -q→ 165 passed.uv run --no-project --with ruff ruff checkon both changed files → All checks passed.uv lockneeded.Refs #2464 (avito prod-incident cluster)