fix(pipeline): resilient cursor save + SQLite cursor lock + gateway retry + scheduled autoretry [修复组④] - #29
Conversation
…etry classification + scheduled autoretry [C10,C11,C13,C14]
|
Warning Review limit reached
Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (16)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Health: 7.7 📋 At a glance Files & modules (2)
🚨 Change risk: 9.3/10 (high)
🔎 More signals (2)🔥 Hotspots touched (4)
1 more
💀 Dead code (1 finding)
👀 Suggested reviewers @xujinghua 📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-18 18:17 UTC |
There was a problem hiding this comment.
Code Review
This pull request introduces several robust improvements to the pipeline's reliability and error handling. Key changes include migrating from SELECT ... FOR UPDATE to optimistic concurrency control using a new version column on source_cursors (ensuring SQLite compatibility), making cursor-saving failures non-fatal to prevent false run failures, and enhancing retry strategies with exponential backoff and jitter for Celery tasks. Additionally, gateway timeouts and Cloudflare-specific error codes are now classified as retryable. The reviewer's feedback correctly points out that 408 (Request Timeout) should be added to RETRY_STATUS in http_client.py to align with its classification as a retryable status in error_taxonomy.py.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| #: codes) belong alongside 502/503 — a slow/misbehaving upstream through a | ||
| #: proxy surfaces as any of these, not just 502/503, and none of them are | ||
| #: reasons to give up permanently. | ||
| RETRY_STATUS = frozenset({429, 500, 502, 503, 504, 520, 522, 524}) |
There was a problem hiding this comment.
在 backend/pipeline/error_taxonomy.py 中,您已将 408 (Request Timeout) 归类为可重试的 HTTP 状态码(is_retryable_http_status)。然而,在 backend/pipeline/http_client.py 的 RETRY_STATUS 集合中,并没有包含 408。这会导致 RateLimitedClient 在遇到 408 时不会在 HTTP 客户端级别进行轻量级重试,而是直接抛出异常并触发重量级的 Celery 任务级重试。建议将 408 补充到 RETRY_STATUS 中,以保持一致性并提高重试效率。
| RETRY_STATUS = frozenset({429, 500, 502, 503, 504, 520, 522, 524}) | |
| RETRY_STATUS = frozenset({408, 429, 500, 502, 503, 504, 520, 522, 524}) |
修复组④ — 游标与重试 (账本 C10/C11/C13/C14)
Sonnet 实施, Fable 审计通过 (代码 diff + migration 单 head 确认 + 主 repo 真跑测试)。
SELECT FOR UPDATE在 SQLite 是静默 no-op) → 乐观锁 version 列:UPDATE ... WHERE id=? AND version=?检 rowcount, 0 行=他人已推进则重读重试 (3 次上限)。SQLite/Postgres 同语义, 不依赖后端锁。带 alembic migrationt9y0z1a2b3c4(batch_alter + server_default=0, 现有行填 0)审计确认
t9y0z1a2b3c4(migration 正确挂链尾, down_revision=s8x9y0z1a2b3; 之前担心的 z6..add_plans 只是文件名字母序靠后非 chain head)Deviation (审计已收, 均合理)
uv sync --python 3.13重建 (.venv gitignored, 无害) — 也暴露了 worktree env 坑, 后续统一在主 repo 验测fetch()路径 (base.py 注释确认 runner 只调 fetch, collect() 是 prod-dead 的重复处理器), 不动 collect()_AlertOnRetriesExhaustedTask— 该类 on_failure 把 args[0] 当 CollectionTask id 解析, 但 scheduled 首参是 schedule_id (不同 id 空间), 复用会 silently 查错行。只加 retry config 不绑 alert task。好判断, 避免了一个静默 bugTest
合并顺序
④⑤⑥ 共同热点 pipeline.py。本 PR 改 C11 区 (cursor save ~372)。与 ⑤ 的 C21 区 (~404) 不同区域, 但同文件, 后合者 rebase。