Repository navigation
fix(ingest): import attachments from private repos via signed URLs - #1268
Conversation
GitHub 404s an installation token on github.com/user-attachments links in private repos, so every attachment there was skipped as asset_not_found. On a 403/404, read the source's body_html and fetch the signed private-user-images URL for the same asset instead. Also log webhook ingest skips, which were otherwise invisible. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CvhtYD1ej6agd8LiARpXp
|
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 2
🚫 Excluded labels (none allowed): 1
Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Requested by Zach · project thread
Why
Images dragged into PRs on private repos were never imported. GitHub only serves
github.com/user-attachments/assets/<id>to users with repo access: a user token gets a 302 to S3, but the app's installation token gets a 404, which ingest records as a permanentasset_not_foundskip. The production ledger has zero user-attachment rows for the private sunny-sdk/sunny repo, only Cursor artifacts. A manualuploads ingest --pr 3332there skipped both images asasset_not_found.The webhook path also threw the ingest summary away, so these skips never showed up in Worker logs.
What
application/vnd.github.html+json,body_html). It carries a short-lived signedprivate-user-images.githubusercontent.com/...<uuid>...?jwt=URL for the same asset. Fetch that without auth. I checked this by hand on sunny-sdk/sunny#3332: the signed URL returns 200image/pngwith no auth header.github ingest skipped attachments(repo, number, source, reasons) when a webhook ingest skips anything.Public repos are unchanged: the direct fetch succeeds, so the fallback never runs.
Tests
body_html, with&decoded and no auth header sent.vitest run ingest: 54 tests), and so doespnpm typecheck.Generated by Claude Code