fix(uploads): background queue + per-attempt timeout + My packages visibility - #23
Merged
Merged
Conversation
…sibility
Root cause of "skills never come back": the SkillForge author pipeline
spent 10-30s per file in serverless functions with no per-attempt
timeout, so a 5-file MCP upload blew the ~35s budget mid-loop and the
caller saw a 504 with zero packages persisted.
Changes:
- Process the FIRST file inline; persist the rest to a new
`package_upload_jobs` queue table (RLS: owners read; service-role
writes). The MCP `upload_packages` response now includes
`queued: [{id, filename}]` and a `next_step` that explains the
background drain.
- Add per-attempt `AbortSignal.timeout(12s)` inside `generateDraft` so a
single hung model fails fast and the fallback chain actually runs.
Trim the chain to 3 models for predictable upper-bound latency.
- New cron-callable `/api/jobs/drain-upload-queue` endpoint, wired in
`vercel.json` to run every minute (CRON_SECRET-gated). Also bumps
`maxDuration` on the MCP route to 60s.
- Surface in-flight jobs on `/account/packages` with a polling list so
the user watches the queue drain instead of staring at an empty page.
- Add the missing "My packages" link to both desktop and mobile nav.
https://claude.ai/code/session_019gMoupKKTVydpNwiiACQRd
criptogus
marked this pull request as ready for review
May 23, 2026 03:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause of "skills never come back": the SkillForge author pipeline spent 10–30s per file in serverless with no per-attempt timeout, so a multi-file MCP upload blew the ~35s budget mid-loop and the caller saw a 504 with zero packages persisted.
package_upload_jobsqueue table. The MCPupload_packagesresponse now includesqueued: [{id, filename}]and anext_stepthat explains the background drain.AbortSignal.timeout(12s)insidegenerateDraftso a single hung model fails fast and the fallback chain actually runs. Trim the chain to 3 models for predictable upper-bound latency./api/jobs/drain-upload-queue(CRON_SECRET-gated) wired invercel.jsonto run every minute. Also bumpsmaxDurationon the MCP route to 60s./account/packageswith a polling list so the user watches the queue drain instead of staring at an empty page.Test plan
CRON_SECRETin Vercel envs (any random string) so the cron auth gate is enabled.20260525000000_package_upload_jobs.sql.upload_packages: response should showuploaded: 1, queued_count: 2, plus the two queued ids./account/packages(now reachable from the Account menu): "Upload queue" section should show the queued files; refresh every 5s until they flip to "done" / appear as packages./api/jobs/drain-upload-queuehitting once per minute with200 ok.https://claude.ai/code/session_019gMoupKKTVydpNwiiACQRd
Generated by Claude Code